From 143aa0ee0404a05bc0f0a22bacd603df8c0df7f4 Mon Sep 17 00:00:00 2001 From: Novatux Date: Thu, 17 Jan 2013 19:49:27 +0100 Subject: [PATCH] Added detector tube --- textures/pipeworks_detector_tube_end.png | Bin 0 -> 2577 bytes textures/pipeworks_detector_tube_inv.png | Bin 0 -> 1267 bytes textures/pipeworks_detector_tube_noctr.png | Bin 0 -> 1979 bytes textures/pipeworks_detector_tube_plain.png | Bin 0 -> 2583 bytes textures/pipeworks_detector_tube_short.png | Bin 0 -> 1248 bytes tubes.lua | 60 ++++++++++++++++++++- 6 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 textures/pipeworks_detector_tube_end.png create mode 100644 textures/pipeworks_detector_tube_inv.png create mode 100644 textures/pipeworks_detector_tube_noctr.png create mode 100644 textures/pipeworks_detector_tube_plain.png create mode 100644 textures/pipeworks_detector_tube_short.png diff --git a/textures/pipeworks_detector_tube_end.png b/textures/pipeworks_detector_tube_end.png new file mode 100644 index 0000000000000000000000000000000000000000..e5d7be6f245cc526d3b8c332f00ef9c055eaa78e GIT binary patch literal 2577 zcmV+s3hwoZP)<~hT07(d8Mht8Ck!(OnY!Gh&Vh9ij84wDS5DSn%3`yg7YLE3cU)9%1+#|GJ zd^at%yUSJAcR2UlYl0!k-Me==r4*y1qnMtaCWEZ8y1L3geE0wWxO(*}8OA>8uoMsk z0n#*uVHg9ivA(_zLI^nL!`kNX6finEiXaG3tyT-K-??+A>!~cuf}$u$lB9eJXfzto zbse7P6<*ggt?L@9s)BR=M^^NoDL~hCFvgH&S>g4I7cY`~_wIGH0!`CE2!X1qYST93#(jq-k0{1=zNYU%!4K&-1pwiK3{h0@gX!EnPvt({=j*pFvK~>dq;s9OO;kvHe z{F5h7`hs(&Y0CIfN+ifRhoUGTq&tKcL9bPQ{rUw;DF`7L9UU#70u)6-p65^$MMnH* z&z|vi@nWl7xpIZ1X$ndy*4Ea_r+_@qVHn0H|81AfPMtbM9z1x!i;!Sx)1a>F@O>X~ z9L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IMR_S)+oXuuCU7)6E ze0X^18gI2)jx>60ZB5RN4YS*NId894tDQO4Q(L=)DE)?JKA-PBo!wdUg!CRTGcz;v$HU>Ut?&yA z3&J-FXfzr_C98Bg&Bw>bo?0)H@B^2@bUHoIg(Y(cxa|N*p9GD?D~jUE1vE{g5TZkh zqS0taiQC)T{=BpM8lqw-YZx9OjR)wu-suMnN^F-Cj0+2f!VLE>6bf8kUY6GS!iyE- z@i?xot`LjGKoU<+PtPw40Yy@1qiCPJYQ=I7@}^SXL~009C7 d2oS*c_!o;vXEENS@zDSP002ovPDHLkV1o6BT}c1{ literal 0 HcmV?d00001 diff --git a/textures/pipeworks_detector_tube_noctr.png b/textures/pipeworks_detector_tube_noctr.png new file mode 100644 index 0000000000000000000000000000000000000000..a654bba94f10928588216af7ecb530142932ff84 GIT binary patch literal 1979 zcmV;s2SoUZP)$Bvz* ztq?*&`~Y?!B#7ElSb$iA_>C+pu_)?>cY*STMHh6#3bCMVn#Pa#HS?`zzP32e#-hHP zNQpC^Ilgnxy=SfoDzc4@4Mi!%{QNwwU%yVK8Do2UTkY)Z008dazfY=|C#?#AD2kBh zIUL8CdW`-3eGo#Rl&Wf))d4U+KaVJiFgG_>`ume7Pe!iF^E@!dkY!o@0O)i&5JDgb zg3{k@+a5WFWm!;4oyv>;82~~EaL!Q_Md|N%?%W|ypFSPx1-5O25CY4x>IXm=hEPfk zebTK~Yv>qhnnFs6JkRR~fbaX*-Q9(ha^N*dl8gkPC<=I-GNn&UM{m+hmv*ooN8FECZ#(Z?U?% z`d5OZX)lgr^m@Iq7~{+V(C_!Lu&^-IF~$mZszT3lR&Wm)yi1B4Lh^?GLVZ{EC_ zD4la%*Tj!nW`as7FvdX0=oDTDy`#3fy9-Jw2qBoCpRXSPj4?KQi{F3z4`$lrG(=+$M)|aI$K#;AunFMP-U55ZD~*lfiMh_rm6XE*mf9{ z?n)^uO@(0&|9c>9#9koY}+1K44t&Hs*!V!JkO7TSgS-x z2m#;s$GZOR-Mi%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|@7}%JI5eiy zDU30j3!s!*ny{plqYN6e{;mZ1=FOY6#Bt7Trw+)nY-yHlnr4&$Po6v>A3uIv%lN~? z!$11&I&M7_aI5N$2Se61pmuJhLZ^uVzjdinC@RvM}-%T}&wnr5vNg|8z(*LC>vmUMS(ZU56-D;mgHjq>=C5DB zhG9VBoQv0R&S8uJAtbiW8wp^H!NtWzEQs4$e8WZHuBP5JG^I z5{tzGRaK$uIuJsT=Q%iz^wT=P}UQpLHIOo{e z*@1HoT5HsG9mirr?%HP8nMfoOi9{liNF)-8L?V$$Boc}L0{;NR8){r<`bGo*0000< KMNUMnLSTY1#Yd_D literal 0 HcmV?d00001 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}}}) -- 2.30.2