mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-11-08 16:33:58 +01:00
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
|
||||||
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
|
if minetest.get_modpath("mesecons_mvps") then
|
||||||
mesecon.register_on_mvps_move(function(moved_nodes)
|
mesecon.register_on_mvps_move(function(moved_nodes)
|
||||||
for _, n in ipairs(moved_nodes) do
|
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)
|
return vector.equals(dir, direction) or vector.equals(vector.multiply(dir, -1), direction)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
after_place_node = pipeworks.after_place,
|
||||||
|
after_dig_node = pipeworks.after_dig,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft( {
|
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)
|
return vector.equals(dir, direction) or vector.equals(vector.multiply(dir, -1), direction)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
after_place_node = pipeworks.after_place,
|
||||||
|
after_dig_node = pipeworks.after_dig,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
|
@ -105,6 +105,8 @@ if pipeworks.enable_one_way_tube then
|
|||||||
end,
|
end,
|
||||||
priority = 75 -- Higher than normal tubes, but lower than receivers
|
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({
|
minetest.register_craft({
|
||||||
output = "pipeworks:one_way_tube 2",
|
output = "pipeworks:one_way_tube 2",
|
||||||
|
@ -32,12 +32,8 @@ minetest.register_node("pipeworks:trashcan", {
|
|||||||
meta:set_string("infotext", "Trash Can")
|
meta:set_string("infotext", "Trash Can")
|
||||||
meta:get_inventory():set_size("trash", 1)
|
meta:get_inventory():set_size("trash", 1)
|
||||||
end,
|
end,
|
||||||
after_place_node = function(pos)
|
after_place_node = pipeworks.after_place,
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
after_dig_node = pipeworks.after_dig,
|
||||||
end,
|
|
||||||
after_dig_node = function(pos)
|
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack(""))
|
minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack(""))
|
||||||
end,
|
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},
|
connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1},
|
||||||
priority = 50
|
priority = 50
|
||||||
},
|
},
|
||||||
--[[after_place_node = function(pos)
|
after_place_node = pipeworks.after_place,
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
after_dig_node = pipeworks.after_dig
|
||||||
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]]
|
|
||||||
}
|
}
|
||||||
if style == "6d" then
|
if style == "6d" then
|
||||||
nodedef.paramtype2 = "facedir"
|
nodedef.paramtype2 = "facedir"
|
||||||
@ -196,12 +186,7 @@ local register_all_tubes = function(name, desc, plain, noctrs, ends, short, inv,
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
description = "Pneumatic tube segment (legacy)",
|
description = "Pneumatic tube segment (legacy)",
|
||||||
--[[after_place_node = function(pos)
|
after_place_node = pipeworks.after_place,
|
||||||
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,]]
|
|
||||||
groups = {not_in_creative_inventory = 1, tube_to_update = 1, tube = 1},
|
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}},
|
tube = {connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1}},
|
||||||
drop = name.."_1",
|
drop = name.."_1",
|
||||||
|
Loading…
Reference in New Issue
Block a user