summaryrefslogtreecommitdiff
path: root/autoplace.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-01-01 16:04:05 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-01-01 16:04:05 -0500
commit6cca6f9857084b00ab420bdfbcc2b68b07195675 (patch)
treeddd6fd14934348892a4d1d690a03cf4313202c43 /autoplace.lua
parent2efaa35700401d7b618bb07a3a51036229c37fa5 (diff)
downloadpipeworks-6cca6f9857084b00ab420bdfbcc2b68b07195675.tar
pipeworks-6cca6f9857084b00ab420bdfbcc2b68b07195675.tar.gz
pipeworks-6cca6f9857084b00ab420bdfbcc2b68b07195675.tar.bz2
pipeworks-6cca6f9857084b00ab420bdfbcc2b68b07195675.tar.xz
pipeworks-6cca6f9857084b00ab420bdfbcc2b68b07195675.zip
revamped pumps so that now they should sit in/on liquid and be connected only
from the top, relegated grates to decorational-only, added outlet spigot. Got rid of a few obsolete textures. Got rid of that whole _x and _z naming thing, now all directional devices (pumps, valves, spigots, tanks) use facedir. Valves, spigots no longer auto-rotate to find nearby pipes.
Diffstat (limited to 'autoplace.lua')
-rw-r--r--autoplace.lua97
1 files changed, 45 insertions, 52 deletions
diff --git a/autoplace.lua b/autoplace.lua
index 390c66a..2e5556f 100644
--- a/autoplace.lua
+++ b/autoplace.lua
@@ -83,29 +83,6 @@ end
-- auto-rotation code for various devices the tubes attach to
-function pipe_device_autorotate(pos, state, bname)
-
- if state == nil then
- nname = bname
- else
- nname = bname.."_"..state
- end
-
- local nctr = minetest.env:get_node(pos)
-
- pipes_scansurroundings(pos)
-
- if (pxm+pxp) ~= 0 then
- minetest.env:add_node(pos, { name = nname.."_x" })
- return
- end
-
- if (pzm+pzp) ~= 0 then
- minetest.env:add_node(pos, { name = nname.."_z" })
- end
-
-end
-
function pipes_scansurroundings(pos)
pxm=0
pxp=0
@@ -128,39 +105,55 @@ function pipes_scansurroundings(pos)
if (string.find(nzm.name, "pipeworks:pipe_") ~= nil) then pzm=1 end
if (string.find(nzp.name, "pipeworks:pipe_") ~= nil) then pzp=1 end
- for p in ipairs(pipes_devicelist) do
- pdev = pipes_devicelist[p]
- if (string.find(nxm.name, "pipeworks:"..pdev.."_off_x") ~= nil) or
- (string.find(nxm.name, "pipeworks:"..pdev.."_on_x") ~= nil) or
- (string.find(nxm.name, "pipeworks:"..pdev.."_x") ~= nil) then
- pxm=1
- end
-
- if (string.find(nxp.name, "pipeworks:"..pdev.."_off_x") ~= nil) or
- (string.find(nxp.name, "pipeworks:"..pdev.."_on_x") ~= nil) or
- (string.find(nxp.name, "pipeworks:"..pdev.."_x") ~= nil) then
- pxp=1
- end
-
- if (string.find(nzm.name, "pipeworks:"..pdev.."_off_z") ~= nil) or
- (string.find(nzm.name, "pipeworks:"..pdev.."_on_z") ~= nil) or
- (string.find(nzm.name, "pipeworks:"..pdev.."_z") ~= nil) then
- pzm=1
- end
-
- if (string.find(nzp.name, "pipeworks:"..pdev.."_off_z") ~= nil) or
- (string.find(nzp.name, "pipeworks:"..pdev.."_on_z") ~= nil) or
- (string.find(nzp.name, "pipeworks:"..pdev.."_z") ~= nil) then
- pzp=1
- end
+-- Special handling for valves...
+
+ if (string.find(nxm.name, "pipeworks:valve") ~= nil)
+ and (nxm.param2 == 0 or nxm.param2 == 2) then
+ pxm=1
+ end
+
+ if (string.find(nxp.name, "pipeworks:valve") ~= nil)
+ and (nxp.param2 == 0 or nxp.param2 == 2) then
+ pxp=1
+ end
+
+ if (string.find(nzm.name, "pipeworks:valve") ~= nil)
+ and (nzm.param2 == 1 or nzm.param2 == 3) then
+ pzm=1
+ end
+
+ if (string.find(nzp.name, "pipeworks:valve") ~= nil)
+ and (nzp.param2 == 1 or nzp.param2 == 3) then
+ pzp=1
+ end
+
+-- ...spigots...
+
+ if (string.find(nxm.name, "pipeworks:spigot") ~= nil)
+ and nxm.param2 == 2 then
+ pxm=1
+ end
+
+ if (string.find(nxp.name, "pipeworks:spigot") ~= nil)
+ and nxp.param2 == 0 then
+ pxp=1
+ end
+
+ if (string.find(nzm.name, "pipeworks:spigot") ~= nil)
+ and nzm.param2 == 1 then
+ pzm=1
+ end
+
+ if (string.find(nzp.name, "pipeworks:spigot") ~= nil)
+ and nzp.param2 == 3 then
+ pzp=1
end
- -- storage tanks and intake grates have vertical connections
- -- also, so they require a special case
+-- ...pumps, grates, and storage tanks
if (string.find(nym.name, "pipeworks:storage_tank_") ~= nil) or
- (string.find(nym.name, "pipeworks:intake") ~= nil) or
- (string.find(nym.name, "pipeworks:outlet") ~= nil) then
+ (string.find(nym.name, "pipeworks:grating") ~= nil) or
+ (string.find(nym.name, "pipeworks:pump") ~= nil) then
pym=1
end
end