mirror of
https://github.com/sirrobzeroone/elepower.git
synced 2024-11-30 18:43:49 +01:00
Fix name changing
This commit is contained in:
parent
4af53a9559
commit
51a96687b5
@ -38,7 +38,7 @@ local function matter_receiver_timer(pos)
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
@ -107,6 +107,10 @@ ele.register_machine("elepower_wireless:matter_receiver", {
|
||||
if fields["name"] and fields["key_enter"] == "true" then
|
||||
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_receivers[strname] then return end
|
||||
elewi.loaded_receivers[strname].name = fields["name"]
|
||||
end
|
||||
end,
|
||||
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 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")
|
||||
else
|
||||
ele.helpers.swap_node(pos, "elepower_wireless:matter_transmitter")
|
||||
@ -44,7 +45,7 @@ local function matter_transmitter_timer(pos)
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
@ -112,6 +113,11 @@ ele.register_machine("elepower_wireless:matter_transmitter", {
|
||||
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)
|
||||
|
||||
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,
|
||||
after_destruct = function (pos)
|
||||
|
Loading…
Reference in New Issue
Block a user