forked from Mineclonia/Mineclonia
speed up water flow (WIP)
This commit is contained in:
parent
b26fb44aeb
commit
4ca70a7af1
|
@ -108,6 +108,53 @@ S("• When water is directly below lava, the water turns into stone."),
|
|||
_mcl_hardness = -1,
|
||||
})
|
||||
|
||||
function flow_water_downwards(pos, node, limit)
|
||||
if limit == 0 then
|
||||
return
|
||||
end
|
||||
if node.name ~= "air" then
|
||||
minetest.debug("node not air")
|
||||
return
|
||||
end
|
||||
minetest.debug(dump(node.name), dump(limit))
|
||||
minetest.set_node(
|
||||
pos,
|
||||
{
|
||||
name="mcl_core:water_flowing",
|
||||
param2 = 15,
|
||||
}
|
||||
)
|
||||
local below_pos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local below_node = minetest.get_node(below_pos)
|
||||
minetest.after(
|
||||
0,
|
||||
function()
|
||||
flow_water_downwards(
|
||||
below_pos,
|
||||
below_node,
|
||||
limit - 1
|
||||
)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
label="speed up water flow",
|
||||
nodenames = {"mcl_core:water_flowing"},
|
||||
neighbors = {"air"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
local below_pos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local below_node = minetest.get_node(below_pos)
|
||||
flow_water_downwards(
|
||||
below_pos,
|
||||
below_node,
|
||||
20
|
||||
)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:lava_flowing", {
|
||||
description = S("Flowing Lava"),
|
||||
_doc_items_create_entry = false,
|
||||
|
|
Loading…
Reference in New Issue