Some fixes

This commit is contained in:
Evert Prants 2018-08-02 20:01:55 +03:00
parent f4b8853bff
commit 4af53a9559
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 23 additions and 10 deletions

View File

@ -42,6 +42,7 @@ local function get_formspec(power, player, transmitters, receivers)
ele.formspec.power_meter(power).. ele.formspec.power_meter(power)..
"textlist[1,0;6.8,2.5;transmitter;" .. table.concat(list_tr, ",") .. tr_spc .. "]".. "textlist[1,0;6.8,2.5;transmitter;" .. table.concat(list_tr, ",") .. tr_spc .. "]"..
"textlist[1,3;6.8,2.5;receiver;" .. table.concat(list_re, ",") .. re_spc .. "]".. "textlist[1,3;6.8,2.5;receiver;" .. table.concat(list_re, ",") .. re_spc .. "]"..
"button[6,5.75;2,0.25;refresh;Refresh]"..
"label[0,5.75;Owned by " .. player .. "]".. "label[0,5.75;Owned by " .. player .. "]"..
"list[current_player;main;0,6.25;8,1;]".. "list[current_player;main;0,6.25;8,1;]"..
"list[current_player;main;0,7.5;8,3;8]".. "list[current_player;main;0,7.5;8,3;8]"..
@ -158,6 +159,11 @@ ele.register_machine("elepower_wireless:dialler", {
return return
end end
if fields["refresh"] then
minetest.get_node_timer(pos):start(0.2)
return
end
if not fields["transmitter"] and not fields["receiver"] then if not fields["transmitter"] and not fields["receiver"] then
return return
end end

View File

@ -106,6 +106,7 @@ ele.register_machine("elepower_wireless:matter_receiver", {
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if fields["name"] and fields["key_enter"] == "true" then if fields["name"] and fields["key_enter"] == "true" then
meta:set_string("name", fields["name"]) meta:set_string("name", fields["name"])
minetest.get_node_timer(pos):start(0.2)
end end
end, end,
after_destruct = function (pos) after_destruct = function (pos)

View File

@ -141,6 +141,8 @@ minetest.register_abm({
local tpos = minetest.string_to_pos(meta:get_string("target")) local tpos = minetest.string_to_pos(meta:get_string("target"))
if tpos then if tpos then
local tnode = minetest.get_node_or_nil(tpos)
if tnode and ele.helpers.get_item_group(tnode.name, "matter_receiver") then
local storage = ele.helpers.get_node_property(meta, pos, "storage") local storage = ele.helpers.get_node_property(meta, pos, "storage")
local usage = ele.helpers.get_node_property(meta, pos, "usage") local usage = ele.helpers.get_node_property(meta, pos, "usage")
@ -155,6 +157,10 @@ minetest.register_abm({
break break
end end
end end
else
meta:set_string("target", "")
minetest.get_node_timer(pos):start(0.2)
end
end end
end end
end end