forked from mtcontrib/pipeworks
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
503c1190ed
@ -83,10 +83,21 @@ pipeworks.register_tube("pipeworks:broken_tube", {
|
||||
end
|
||||
return
|
||||
end
|
||||
pipeworks.logger(log_msg.." with "..wieldname.." to repair it.")
|
||||
log_msg = log_msg.."with "..wieldname.." to repair it"
|
||||
local nodedef = minetest.registered_nodes[was_node.name]
|
||||
if nodedef then
|
||||
pipeworks.logger(log_msg..".")
|
||||
if nodedef.tube and nodedef.tube.on_repair then
|
||||
nodedef.tube.on_repair(pos, was_node)
|
||||
else
|
||||
minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 })
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
end
|
||||
else
|
||||
pipeworks.logger(log_msg.." but original node "..was_node.name.." is not registered anymore.")
|
||||
minetest.chat_send_player(playername, S("This tube cannot be repaired."))
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -184,6 +184,18 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
|
||||
pos.y = target[d].y
|
||||
pos.z = target[d].z
|
||||
return pipeworks.meseadjlist
|
||||
end,
|
||||
on_repair = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local channel = meta:get_string("channel")
|
||||
minetest.swap_node(pos, { name = node.name, param2 = node.param2 })
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
if channel ~= "" then
|
||||
local can_receive = meta:get_int("can_receive")
|
||||
set_tube(pos, channel, can_receive)
|
||||
local cr_description = (can_receive == 1) and "sending and receiving" or "sending"
|
||||
meta:set_string("infotext", S("Teleportation Tube @1 on '@2'", cr_description, channel))
|
||||
end
|
||||
end
|
||||
},
|
||||
on_construct = function(pos)
|
||||
|
Loading…
Reference in New Issue
Block a user