forked from Minetest/dynamic_liquid
Make springs much more vigorous about replacing missing water above them
parent
3ce11db25a
commit
319ebfd53e
16
init.lua
16
init.lua
|
@ -93,6 +93,7 @@ if springs then
|
||||||
local c_clay = minetest.get_content_id("default:clay")
|
local c_clay = minetest.get_content_id("default:clay")
|
||||||
local c_spring_clay = minetest.get_content_id("dynamic_liquid:clay")
|
local c_spring_clay = minetest.get_content_id("dynamic_liquid:clay")
|
||||||
|
|
||||||
|
-- Turn mapgen clay into spring clay
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
if minp.y >= 0 or maxp.y <= -15 then
|
if minp.y >= 0 or maxp.y <= -15 then
|
||||||
return
|
return
|
||||||
|
@ -111,15 +112,20 @@ if springs then
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"dynamic_liquid:clay"},
|
nodenames = {"dynamic_liquid:clay"},
|
||||||
neighbors = {"air"},
|
neighbors = {"air", "default:water_source", "default:water_flowing"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
catch_up = false,
|
catch_up = false,
|
||||||
action = function(pos,node)
|
action = function(pos,node)
|
||||||
local check_pos = {x=pos.x, y=pos.y+1, z=pos.z}
|
while pos.y <= 0 do -- TODO: find mapgen water level for this check
|
||||||
local check_node = minetest.get_node(check_pos)
|
pos.y = pos.y + 1
|
||||||
if check_node.name == "air" or check_node.name == "default:water_flowing" then
|
local check_node = minetest.get_node(pos)
|
||||||
minetest.set_node(check_pos, {name="default:water_source"})
|
if check_node.name == "air" or check_node.name == "default:water_flowing" then
|
||||||
|
minetest.set_node(pos, {name="default:water_source"})
|
||||||
|
elseif check_node.name ~= "default:water_source" then
|
||||||
|
--Something's been put on top of this clay, don't send water through it
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue