Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bri cassa 2022-06-25 16:52:37 +02:00
commit 503c1190ed
2 changed files with 30 additions and 7 deletions

View File

@ -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
}
})

View File

@ -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)