summaryrefslogtreecommitdiff
path: root/flowing_logic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'flowing_logic.lua')
-rw-r--r--flowing_logic.lua23
1 files changed, 18 insertions, 5 deletions
diff --git a/flowing_logic.lua b/flowing_logic.lua
index 5166b15..e1c0bf5 100644
--- a/flowing_logic.lua
+++ b/flowing_logic.lua
@@ -31,19 +31,32 @@ pipeworks.check_for_inflows = function(pos,node)
{x=pos.x-1,y=pos.y,z=pos.z},
{x=pos.x+1,y=pos.y,z=pos.z},
{x=pos.x,y=pos.y,z=pos.z-1},
- {x=pos.x,y=pos.y,z=pos.z+1}, }
+ {x=pos.x,y=pos.y,z=pos.z+1},
+ }
local newnode = false
local source = false
- for i =1,6 do
+ for i = 1, 6 do
if newnode then break end
- local name = minetest.get_node(coords[i]).name
+ local testnode = minetest.get_node(coords[i])
+ local name = testnode.name
if name and (name == "pipeworks:pump_on" and pipeworks.check_for_liquids(coords[i])) or string.find(name,"_loaded") then
if string.find(name,"_loaded") then
source = minetest.get_meta(coords[i]):get_string("source")
if source == minetest.pos_to_string(pos) then break end
end
- newnode = string.gsub(node.name,"empty","loaded")
- source = {x=coords[i].x,y=coords[i].y,z=coords[i].z}
+ if string.find(name, "valve") or string.find(name, "sensor") then
+
+ if ((i == 3 or i == 4) and minetest.facedir_to_dir(testnode.param2).x ~= 0)
+ or ((i == 5 or i == 6) and minetest.facedir_to_dir(testnode.param2).z ~= 0)
+ or ((i == 1 or i == 2) and minetest.facedir_to_dir(testnode.param2).y ~= 0) then
+
+ newnode = string.gsub(node.name,"empty","loaded")
+ source = {x=coords[i].x,y=coords[i].y,z=coords[i].z}
+ end
+ else
+ newnode = string.gsub(node.name,"empty","loaded")
+ source = {x=coords[i].x,y=coords[i].y,z=coords[i].z}
+ end
end
end
if newnode then