summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-04-28 17:45:25 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-04-28 17:45:25 -0400
commit8f12d18b1dc785cd3a3bbbd390554e295aa00738 (patch)
tree562842ba1d57b5074beb1e0b7d8e48491599c040
parent6d348001cd4de3053c01e6477b3363adc2244758 (diff)
downloadpipeworks-8f12d18b1dc785cd3a3bbbd390554e295aa00738.tar
pipeworks-8f12d18b1dc785cd3a3bbbd390554e295aa00738.tar.gz
pipeworks-8f12d18b1dc785cd3a3bbbd390554e295aa00738.tar.bz2
pipeworks-8f12d18b1dc785cd3a3bbbd390554e295aa00738.tar.xz
pipeworks-8f12d18b1dc785cd3a3bbbd390554e295aa00738.zip
fix a bug where spigot pouring would replace the node under it with
water. Also clean up spigot logic slightly.
-rw-r--r--flowing_logic.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/flowing_logic.lua b/flowing_logic.lua
index ea5b09e..e943488 100644
--- a/flowing_logic.lua
+++ b/flowing_logic.lua
@@ -67,7 +67,9 @@ end
local update_outlet = function(pos)
local top = minetest.env:get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
if string.find(top,'_loaded') then
- minetest.env:add_node({x=pos.x,y=pos.y-1,z=pos.z},{name='default:water_source'})
+ if minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == 'air' then
+ minetest.env:add_node({x=pos.x,y=pos.y-1,z=pos.z},{name='default:water_source'})
+ end
elseif minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == 'default:water_source' then
minetest.env:remove_node({x=pos.x,y=pos.y-1,z=pos.z})
end
@@ -81,10 +83,14 @@ local spigot_check = function(pos,node)
dbg('found '..top)
if string.find(top,'_loaded') then
minetest.env:add_node({x=pos.x,y=pos.y,z=pos.z},{name='pipeworks:spigot_pouring', param2 = fdir})
- minetest.env:add_node({x=pos.x,y=pos.y-1,z=pos.z},{name='default:water_source'})
- elseif minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == 'default:water_source' then
+ if minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == 'air' then
+ minetest.env:add_node({x=pos.x,y=pos.y-1,z=pos.z},{name='default:water_source'})
+ end
+ else
minetest.env:add_node({x=pos.x,y=pos.y,z=pos.z},{name='pipeworks:spigot', param2 = fdir})
- minetest.env:remove_node({x=pos.x,y=pos.y-1,z=pos.z})
+ if minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == 'default:water_source' then
+ minetest.env:remove_node({x=pos.x,y=pos.y-1,z=pos.z})
+ end
end
end