diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2012-09-17 12:32:47 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2012-09-17 12:32:47 -0400 |
commit | 2efaa35700401d7b618bb07a3a51036229c37fa5 (patch) | |
tree | b81f5712ea001f1a2258ae3f60a4e27b63c368f2 | |
parent | 70284b1088084b85ca0a8d3772e98b9fc4fddb71 (diff) | |
download | pipeworks-2efaa35700401d7b618bb07a3a51036229c37fa5.tar pipeworks-2efaa35700401d7b618bb07a3a51036229c37fa5.tar.gz pipeworks-2efaa35700401d7b618bb07a3a51036229c37fa5.tar.bz2 pipeworks-2efaa35700401d7b618bb07a3a51036229c37fa5.tar.xz pipeworks-2efaa35700401d7b618bb07a3a51036229c37fa5.zip |
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)
-rw-r--r-- | autoplace.lua | 27 | ||||
-rw-r--r-- | textures/pipeworks_testobject.png | bin | 0 -> 4781 bytes | |||
-rw-r--r-- | tubes.lua | 19 |
3 files changed, 37 insertions, 9 deletions
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 Binary files differnew file mode 100644 index 0000000..38f85b7 --- /dev/null +++ b/textures/pipeworks_testobject.png @@ -1,4 +1,21 @@ --- This file supplies pneumatic tubes. +-- This file supplies pneumatic tubes and a 'test' device + +minetest.register_node("pipeworks:testobject", { + description = "Pneumatic tube test ojbect", + tiles = { + "pipeworks_testobject.png", + }, + paramtype = "light", + groups = {snappy=3, tubedevice=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + after_place_node = function(pos) + tube_scanforobjects(pos) + end, + after_dig_node = function(pos) + tube_scanforobjects(pos) + end, +}) -- tables |