Some fixes
This commit is contained in:
parent
f4b8853bff
commit
4af53a9559
@ -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
|
||||||
|
@ -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)
|
||||||
|
@ -141,19 +141,25 @@ 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 storage = ele.helpers.get_node_property(meta, pos, "storage")
|
local tnode = minetest.get_node_or_nil(tpos)
|
||||||
local usage = ele.helpers.get_node_property(meta, pos, "usage")
|
if tnode and ele.helpers.get_item_group(tnode.name, "matter_receiver") then
|
||||||
|
local storage = ele.helpers.get_node_property(meta, pos, "storage")
|
||||||
|
local usage = ele.helpers.get_node_property(meta, pos, "usage")
|
||||||
|
|
||||||
if storage >= usage then
|
if storage >= usage then
|
||||||
local top = vector.add(tpos, {x = 0, y = 1, z = 0})
|
local top = vector.add(tpos, {x = 0, y = 1, z = 0})
|
||||||
local topnode = minetest.get_node_or_nil(top)
|
local topnode = minetest.get_node_or_nil(top)
|
||||||
|
|
||||||
if not topnode or topnode.name == "air" then
|
if not topnode or topnode.name == "air" then
|
||||||
player:set_pos(top)
|
player:set_pos(top)
|
||||||
meta:set_int("storage", storage - usage)
|
meta:set_int("storage", storage - usage)
|
||||||
-- TODO: Sound
|
-- TODO: Sound
|
||||||
break
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
meta:set_string("target", "")
|
||||||
|
minetest.get_node_timer(pos):start(0.2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user