add infotexts to the teleportation tube

this should also debunk the myth of some players, that they are the only ones seeing the channel
This commit is contained in:
Tim 2015-01-29 19:04:20 +01:00
parent 9d45599872
commit 1e50644487

View File

@ -153,6 +153,7 @@ pipeworks.register_tube("pipeworks:teleport_tube","Teleporting Pneumatic Tube Se
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
update_meta(meta, true) update_meta(meta, true)
meta:set_string("infotext", "unconfigured Teleportation Tube")
end, end,
on_receive_fields = function(pos,formname,fields,sender) on_receive_fields = function(pos,formname,fields,sender)
if not fields.channel then if not fields.channel then
@ -206,9 +207,12 @@ pipeworks.register_tube("pipeworks:teleport_tube","Teleporting Pneumatic Tube Se
if dirty then if dirty then
if channel ~= "" then if channel ~= "" then
set_tube(pos, channel, can_receive) set_tube(pos, channel, can_receive)
local cr_description = (can_receive == 1) and "sending and receiving" or "sending"
meta:set_string("infotext", string.format("Teleportation Tube %s on '%s'", cr_description, channel))
else else
-- remove empty channel tubes, to not have to search through them -- remove empty channel tubes, to not have to search through them
remove_tube(pos) remove_tube(pos)
meta:set_string("infotext", "unconfigured Teleportation Tube")
end end
end end
end, end,