make all tubes call the routing functions
using their after_place/after_dig callbacks
This commit is contained in:
parent
e33b662274
commit
364633d884
@ -103,6 +103,14 @@ function pipeworks.scan_for_tube_objects(pos)
|
||||
end
|
||||
end
|
||||
|
||||
function pipeworks.after_place(pos)
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
end
|
||||
|
||||
function pipeworks.after_dig(pos)
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
end
|
||||
|
||||
if minetest.get_modpath("mesecons_mvps") then
|
||||
mesecon.register_on_mvps_move(function(moved_nodes)
|
||||
for _, n in ipairs(moved_nodes) do
|
||||
|
@ -22,6 +22,8 @@ minetest.register_node("pipeworks:steel_block_embedded_tube", {
|
||||
return vector.equals(dir, direction) or vector.equals(vector.multiply(dir, -1), direction)
|
||||
end,
|
||||
},
|
||||
after_place_node = pipeworks.after_place,
|
||||
after_dig_node = pipeworks.after_dig,
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
@ -67,6 +69,8 @@ minetest.register_node("pipeworks:steel_pane_embedded_tube", {
|
||||
return vector.equals(dir, direction) or vector.equals(vector.multiply(dir, -1), direction)
|
||||
end,
|
||||
},
|
||||
after_place_node = pipeworks.after_place,
|
||||
after_dig_node = pipeworks.after_dig,
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
|
@ -105,6 +105,8 @@ if pipeworks.enable_one_way_tube then
|
||||
end,
|
||||
priority = 75 -- Higher than normal tubes, but lower than receivers
|
||||
},
|
||||
after_place_node = pipeworks.after_place,
|
||||
after_dig_node = pipeworks.after_dig,
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "pipeworks:one_way_tube 2",
|
||||
|
@ -32,12 +32,8 @@ minetest.register_node("pipeworks:trashcan", {
|
||||
meta:set_string("infotext", "Trash Can")
|
||||
meta:get_inventory():set_size("trash", 1)
|
||||
end,
|
||||
after_place_node = function(pos)
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
end,
|
||||
after_dig_node = function(pos)
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
end,
|
||||
after_place_node = pipeworks.after_place,
|
||||
after_dig_node = pipeworks.after_dig,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack(""))
|
||||
end,
|
||||
|
@ -106,18 +106,8 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
|
||||
connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1},
|
||||
priority = 50
|
||||
},
|
||||
--[[after_place_node = function(pos)
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
if minetest.registered_nodes[rname].after_place_node_ then
|
||||
minetest.registered_nodes[rname].after_place_node_(pos)
|
||||
end
|
||||
end,
|
||||
after_dig_node = function(pos)
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
if minetest.registered_nodes[rname].after_dig_node_ then
|
||||
minetest.registered_nodes[rname].after_dig_node_(pos)
|
||||
end
|
||||
end]]
|
||||
after_place_node = pipeworks.after_place,
|
||||
after_dig_node = pipeworks.after_dig
|
||||
}
|
||||
if style == "6d" then
|
||||
nodedef.paramtype2 = "facedir"
|
||||
@ -196,12 +186,7 @@ local register_all_tubes = function(name, desc, plain, noctrs, ends, short, inv,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
description = "Pneumatic tube segment (legacy)",
|
||||
--[[after_place_node = function(pos)
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
if minetest.registered_nodes[name.."_1"].after_place_node_ then
|
||||
minetest.registered_nodes[name.."_1"].after_place_node_(pos)
|
||||
end
|
||||
end,]]
|
||||
after_place_node = pipeworks.after_place,
|
||||
groups = {not_in_creative_inventory = 1, tube_to_update = 1, tube = 1},
|
||||
tube = {connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1}},
|
||||
drop = name.."_1",
|
||||
|
Loading…
Reference in New Issue
Block a user