summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-02-07 02:45:17 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-02-07 02:45:17 -0500
commit364633d884fa2420ab13f5444e06fb418e61d5c2 (patch)
tree113239b12b575367cb918f433d985d2e6138eb23
parente33b662274982bf6be8213975675407633d5d92e (diff)
downloadpipeworks-364633d884fa2420ab13f5444e06fb418e61d5c2.tar
pipeworks-364633d884fa2420ab13f5444e06fb418e61d5c2.tar.gz
pipeworks-364633d884fa2420ab13f5444e06fb418e61d5c2.tar.bz2
pipeworks-364633d884fa2420ab13f5444e06fb418e61d5c2.tar.xz
pipeworks-364633d884fa2420ab13f5444e06fb418e61d5c2.zip
make all tubes call the routing functions
using their after_place/after_dig callbacks
-rw-r--r--autoplace_tubes.lua8
-rw-r--r--decorative_tubes.lua4
-rw-r--r--routing_tubes.lua2
-rw-r--r--trashcan.lua8
-rw-r--r--tube_registration.lua21
5 files changed, 19 insertions, 24 deletions
diff --git a/autoplace_tubes.lua b/autoplace_tubes.lua
index 1d4732a..280bd60 100644
--- a/autoplace_tubes.lua
+++ b/autoplace_tubes.lua
@@ -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
diff --git a/decorative_tubes.lua b/decorative_tubes.lua
index 5bf7bf9..39ba8f3 100644
--- a/decorative_tubes.lua
+++ b/decorative_tubes.lua
@@ -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( {
diff --git a/routing_tubes.lua b/routing_tubes.lua
index 000c6ee..8620d20 100644
--- a/routing_tubes.lua
+++ b/routing_tubes.lua
@@ -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",
diff --git a/trashcan.lua b/trashcan.lua
index 0051aeb..87980ab 100644
--- a/trashcan.lua
+++ b/trashcan.lua
@@ -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,
diff --git a/tube_registration.lua b/tube_registration.lua
index d37bf7d..c926216 100644
--- a/tube_registration.lua
+++ b/tube_registration.lua
@@ -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",