forked from mtcontrib/pipeworks
fix a bug where spigot pouring would replace the node under it with
water. Also clean up spigot logic slightly.
This commit is contained in:
parent
6d348001cd
commit
8f12d18b1d
|
@ -67,7 +67,9 @@ end
|
||||||
local update_outlet = function(pos)
|
local update_outlet = function(pos)
|
||||||
local top = minetest.env:get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
|
local top = minetest.env:get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
|
||||||
if string.find(top,'_loaded') then
|
if string.find(top,'_loaded') 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'})
|
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
|
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})
|
minetest.env:remove_node({x=pos.x,y=pos.y-1,z=pos.z})
|
||||||
end
|
end
|
||||||
|
@ -81,11 +83,15 @@ local spigot_check = function(pos,node)
|
||||||
dbg('found '..top)
|
dbg('found '..top)
|
||||||
if string.find(top,'_loaded') then
|
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,z=pos.z},{name='pipeworks:spigot_pouring', param2 = fdir})
|
||||||
|
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'})
|
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
|
end
|
||||||
|
else
|
||||||
minetest.env:add_node({x=pos.x,y=pos.y,z=pos.z},{name='pipeworks:spigot', param2 = fdir})
|
minetest.env:add_node({x=pos.x,y=pos.y,z=pos.z},{name='pipeworks:spigot', param2 = fdir})
|
||||||
|
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})
|
minetest.env:remove_node({x=pos.x,y=pos.y-1,z=pos.z})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user