summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--textures/pipeworks_detector_tube_end.pngbin0 -> 2577 bytes
-rw-r--r--textures/pipeworks_detector_tube_inv.pngbin0 -> 1267 bytes
-rw-r--r--textures/pipeworks_detector_tube_noctr.pngbin0 -> 1979 bytes
-rw-r--r--textures/pipeworks_detector_tube_plain.pngbin0 -> 2583 bytes
-rw-r--r--textures/pipeworks_detector_tube_short.pngbin0 -> 1248 bytes
-rw-r--r--tubes.lua60
6 files changed, 58 insertions, 2 deletions
diff --git a/textures/pipeworks_detector_tube_end.png b/textures/pipeworks_detector_tube_end.png
new file mode 100644
index 0000000..e5d7be6
--- /dev/null
+++ b/textures/pipeworks_detector_tube_end.png
Binary files differ
diff --git a/textures/pipeworks_detector_tube_inv.png b/textures/pipeworks_detector_tube_inv.png
new file mode 100644
index 0000000..52c4cd7
--- /dev/null
+++ b/textures/pipeworks_detector_tube_inv.png
Binary files differ
diff --git a/textures/pipeworks_detector_tube_noctr.png b/textures/pipeworks_detector_tube_noctr.png
new file mode 100644
index 0000000..a654bba
--- /dev/null
+++ b/textures/pipeworks_detector_tube_noctr.png
Binary files differ
diff --git a/textures/pipeworks_detector_tube_plain.png b/textures/pipeworks_detector_tube_plain.png
new file mode 100644
index 0000000..46003aa
--- /dev/null
+++ b/textures/pipeworks_detector_tube_plain.png
Binary files differ
diff --git a/textures/pipeworks_detector_tube_short.png b/textures/pipeworks_detector_tube_short.png
new file mode 100644
index 0000000..8576b87
--- /dev/null
+++ b/textures/pipeworks_detector_tube_short.png
Binary files differ
diff --git a/tubes.lua b/tubes.lua
index d788493..9789143 100644
--- a/tubes.lua
+++ b/tubes.lua
@@ -222,9 +222,14 @@ for zp = 0, 1 do
for key,value in pairs(special) do
if key=="on_construct" or key=="after_dig_node" or key=="after_place_node" then
- key=key.."_"
+ nodedef[key.."_"]=value
+ elseif key=="groups" then
+ for group,val in pairs(value) do
+ nodedef.groups[group]=val
+ end
+ else
+ nodedef[key]=value
end
- nodedef[key]=value
end
minetest.register_node(name.."_"..tname, nodedef)
@@ -258,6 +263,9 @@ mese_end_textures={"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","
mese_short_texture="pipeworks_mese_tube_short.png"
mese_inv_texture="pipeworks_mese_tube_inv.png"
+detector_plain_textures={"pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png",
+ "pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png"}
+detector_inv_texture="pipeworks_detector_tube_inv.png"
meseadjlist={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=1,y=0,z=0},{x=-1,y=0,z=0}}
@@ -315,3 +323,51 @@ register_tube("pipeworks:mese_tube","Mese pneumatic tube segment",mese_plain_tex
return (inv:is_empty("line1") and inv:is_empty("line2") and inv:is_empty("line3") and
inv:is_empty("line4") and inv:is_empty("line5") and inv:is_empty("line6"))
end})
+
+
+mesecons_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=1,y=1,z=0},{x=1,y=-1,z=0},
+ {x=-1,y=1,z=0},{x=-1,y=-1,z=0},{x=0,y=1,z=1},{x=0,y=-1,z=1},{x=0,y=1,z=-1},{x=0,y=-1,z=-1}}
+
+register_tube("pipeworks:detector_tube_on","Detector tube segment on (you hacker you)",detector_plain_textures,noctr_textures,
+ end_textures,short_texture,detector_inv_texture,
+ {tube={can_go=function(pos,node,velocity,stack)
+ local meta = minetest.env:get_meta(pos)
+ local name = minetest.env:get_node(pos).name
+ local nitems=meta:get_int("nitems")+1
+ meta:set_int("nitems", nitems)
+ minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos)
+ return meseadjlist
+ end},
+ groups={mesecon=2,not_in_creative_inventory=1},
+ drop="pipeworks:detector_tube_off_000000",
+ mesecons={receptor={state="on",
+ rules=mesecons_rules}},
+ item_exit = function(pos)
+ local meta = minetest.env:get_meta(pos)
+ local nitems=meta:get_int("nitems")-1
+ local name = minetest.env:get_node(pos).name
+ if nitems==0 then
+ minetest.env:set_node(pos,{name=string.gsub(name,"on","off")})
+ mesecon:receptor_off(pos,mesecons_rules)
+ else
+ meta:set_int("nitems", nitems)
+ end
+ end,
+ on_construct = function(pos)
+ local meta = minetest.env:get_meta(pos)
+ meta:set_int("nitems", 1)
+ local name = minetest.env:get_node(pos).name
+ minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos)
+ end})
+
+register_tube("pipeworks:detector_tube_off","Detector tube segment",detector_plain_textures,noctr_textures,
+ end_textures,short_texture,detector_inv_texture,
+ {tube={can_go=function(pos,node,velocity,stack)
+ local name = minetest.env:get_node(pos).name
+ minetest.env:set_node(pos,{name=string.gsub(name,"off","on")})
+ mesecon:receptor_on(pos,mesecons_rules)
+ return meseadjlist
+ end},
+ groups={mesecon=2},
+ mesecons={receptor={state="off",
+ rules=mesecons_rules}}})