Fix name changing
This commit is contained in:
parent
4af53a9559
commit
51a96687b5
@ -38,7 +38,7 @@ local function matter_receiver_timer(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(pow_percent, name, player))
|
meta:set_string("formspec", get_formspec(pow_percent, name, player))
|
||||||
meta:set_string("infotext", "Matter Receiver\n" .. ele.capacity_text(capacity, storage))
|
meta:set_string("infotext", name .. "\n" .. ele.capacity_text(capacity, storage))
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -107,6 +107,10 @@ ele.register_machine("elepower_wireless:matter_receiver", {
|
|||||||
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)
|
minetest.get_node_timer(pos):start(0.2)
|
||||||
|
|
||||||
|
local strname = minetest.pos_to_string(pos)
|
||||||
|
if not elewi.loaded_receivers[strname] then return end
|
||||||
|
elewi.loaded_receivers[strname].name = fields["name"]
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
after_destruct = function (pos)
|
after_destruct = function (pos)
|
||||||
|
@ -31,8 +31,9 @@ local function matter_transmitter_timer(pos)
|
|||||||
local usage = ele.helpers.get_node_property(meta, pos, "usage")
|
local usage = ele.helpers.get_node_property(meta, pos, "usage")
|
||||||
|
|
||||||
local pow_percent = math.floor((storage / capacity) * 100)
|
local pow_percent = math.floor((storage / capacity) * 100)
|
||||||
|
local tpos = minetest.string_to_pos(target)
|
||||||
|
|
||||||
if storage >= usage then
|
if storage >= usage and tpos then
|
||||||
ele.helpers.swap_node(pos, "elepower_wireless:matter_transmitter_active")
|
ele.helpers.swap_node(pos, "elepower_wireless:matter_transmitter_active")
|
||||||
else
|
else
|
||||||
ele.helpers.swap_node(pos, "elepower_wireless:matter_transmitter")
|
ele.helpers.swap_node(pos, "elepower_wireless:matter_transmitter")
|
||||||
@ -44,7 +45,7 @@ local function matter_transmitter_timer(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
meta:set_string("formspec", get_formspec(pow_percent, name, player, target))
|
meta:set_string("formspec", get_formspec(pow_percent, name, player, target))
|
||||||
meta:set_string("infotext", "Matter Transmitter\n" .. ele.capacity_text(capacity, storage) .. extra)
|
meta:set_string("infotext", name .. "\n" .. ele.capacity_text(capacity, storage) .. extra)
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -112,6 +113,11 @@ ele.register_machine("elepower_wireless:matter_transmitter", {
|
|||||||
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)
|
||||||
|
|
||||||
|
local strname = minetest.pos_to_string(pos)
|
||||||
|
if not elewi.loaded_transmitters[strname] then return end
|
||||||
|
elewi.loaded_transmitters[strname].name = fields["name"]
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
after_destruct = function (pos)
|
after_destruct = function (pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user