From 2efaa35700401d7b618bb07a3a51036229c37fa5 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Mon, 17 Sep 2012 12:32:47 -0400 Subject: [PATCH] Added test object for pneumatic tube autorouting code, made tubes connect to it and any object that bears groups={tubedevice=1} (connects to any side) --- autoplace.lua | 27 +++++++++++++++++++-------- textures/pipeworks_testobject.png | Bin 0 -> 4781 bytes tubes.lua | 19 ++++++++++++++++++- 3 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 textures/pipeworks_testobject.png diff --git a/autoplace.lua b/autoplace.lua index 492f558..390c66a 100644 --- a/autoplace.lua +++ b/autoplace.lua @@ -43,7 +43,9 @@ end function tube_autoroute(pos) nctr = minetest.env:get_node(pos) - if (string.find(nctr.name, "pipeworks:tube_") == nil) then return end + print ("minetest.get_item_group("..nctr.name..',"tubedevice") == '..minetest.get_item_group(nctr.name, "tubedevice")) + if (string.find(nctr.name, "pipeworks:tube_") == nil) + and minetest.get_item_group(nctr.name, "tubedevice") ~= 1 then return end pxm=0 pxp=0 @@ -59,15 +61,24 @@ function tube_autoroute(pos) nzm = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z-1 }) nzp = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z+1 }) - if (string.find(nxm.name, "pipeworks:tube_") ~= nil) then pxm=1 end - if (string.find(nxp.name, "pipeworks:tube_") ~= nil) then pxp=1 end - if (string.find(nym.name, "pipeworks:tube_") ~= nil) then pym=1 end - if (string.find(nyp.name, "pipeworks:tube_") ~= nil) then pyp=1 end - if (string.find(nzm.name, "pipeworks:tube_") ~= nil) then pzm=1 end - if (string.find(nzp.name, "pipeworks:tube_") ~= nil) then pzp=1 end + if (string.find(nxm.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nxm.name, "tubedevice") == 1 then pxm=1 end + if (string.find(nxp.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nxp.name, "tubedevice") == 1 then pxp=1 end + if (string.find(nym.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nym.name, "tubedevice") == 1 then pym=1 end + if (string.find(nyp.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nyp.name, "tubedevice") == 1 then pyp=1 end + if (string.find(nzm.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nzm.name, "tubedevice") == 1 then pzm=1 end + if (string.find(nzp.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nzp.name, "tubedevice") == 1 then pzp=1 end nsurround = pxm..pxp..pym..pyp..pzm..pzp - minetest.env:add_node(pos, { name = "pipeworks:tube_"..nsurround }) + if minetest.get_item_group(nctr.name, "tubedevice") ~= 1 then + minetest.env:add_node(pos, { name = "pipeworks:tube_"..nsurround }) + end + end -- auto-rotation code for various devices the tubes attach to diff --git a/textures/pipeworks_testobject.png b/textures/pipeworks_testobject.png new file mode 100644 index 0000000000000000000000000000000000000000..38f85b79d6d524ee97131c85289e972a9e4e25f8 GIT binary patch literal 4781 zcmV;e5>oAnP)00009a7bBm000bt z000W`0V-Y$V*mgE2XskIMF-po5fC3BrjMyv000t9Nklku%#0M#5l>@fb5*Rp+%gNeAl`Z%dKp z`rzWC(S06#EG}}B$^?Kd+ z-OM5a_Ylz^zWT#I{OfP6_ONKyh)6_&i9AXvxJN{Yh$6`8xF5gxyU&047e93OVHhHU zh+bb`BjR?ul~R^v`S9U`ySsZSrM0%M>*aE3tz9mch`8VHrIc;k%DS#!fBiK?`S9Vx z?RHbui1_B4Z^m(ScM)OcbzM~z_q5i`thF`_1BCnUufMwAZ@qLPa`K3POb|LEM3jh_ ziJT~6U-xgn{kCtNnTKJRrs;mafBEH?FE204vfy!OA|fKvdta7i9LLt0h`hYK9LGUK z-+c2;DW$kOGrN25-QD30ci;CN54$@NZQE9BH8Ub&W+Ljno0+OYXY(FJ%#63;DO?e5 z;pCwrN&>}dt#}EXj6271{O-H&rfDJ~h@`6SKF{<0ey_C-!?3PvYwdcyj^ijIQfq}# zkK@3T(681C7f;h9BBd1Ea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