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)..
|
||||
"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 .. "]"..
|
||||
"button[6,5.75;2,0.25;refresh;Refresh]"..
|
||||
"label[0,5.75;Owned by " .. player .. "]"..
|
||||
"list[current_player;main;0,6.25;8,1;]"..
|
||||
"list[current_player;main;0,7.5;8,3;8]"..
|
||||
@ -158,6 +159,11 @@ ele.register_machine("elepower_wireless:dialler", {
|
||||
return
|
||||
end
|
||||
|
||||
if fields["refresh"] then
|
||||
minetest.get_node_timer(pos):start(0.2)
|
||||
return
|
||||
end
|
||||
|
||||
if not fields["transmitter"] and not fields["receiver"] then
|
||||
return
|
||||
end
|
||||
|
@ -106,6 +106,7 @@ ele.register_machine("elepower_wireless:matter_receiver", {
|
||||
local meta = minetest.get_meta(pos)
|
||||
if fields["name"] and fields["key_enter"] == "true" then
|
||||
meta:set_string("name", fields["name"])
|
||||
minetest.get_node_timer(pos):start(0.2)
|
||||
end
|
||||
end,
|
||||
after_destruct = function (pos)
|
||||
|
@ -141,19 +141,25 @@ minetest.register_abm({
|
||||
local tpos = minetest.string_to_pos(meta:get_string("target"))
|
||||
|
||||
if tpos then
|
||||
local storage = ele.helpers.get_node_property(meta, pos, "storage")
|
||||
local usage = ele.helpers.get_node_property(meta, pos, "usage")
|
||||
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 usage = ele.helpers.get_node_property(meta, pos, "usage")
|
||||
|
||||
if storage >= usage then
|
||||
local top = vector.add(tpos, {x = 0, y = 1, z = 0})
|
||||
local topnode = minetest.get_node_or_nil(top)
|
||||
if storage >= usage then
|
||||
local top = vector.add(tpos, {x = 0, y = 1, z = 0})
|
||||
local topnode = minetest.get_node_or_nil(top)
|
||||
|
||||
if not topnode or topnode.name == "air" then
|
||||
player:set_pos(top)
|
||||
meta:set_int("storage", storage - usage)
|
||||
-- TODO: Sound
|
||||
break
|
||||
if not topnode or topnode.name == "air" then
|
||||
player:set_pos(top)
|
||||
meta:set_int("storage", storage - usage)
|
||||
-- TODO: Sound
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
meta:set_string("target", "")
|
||||
minetest.get_node_timer(pos):start(0.2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user