speed up water flow (WIP)

This commit is contained in:
Nils Dagsson Moskopp 2021-09-04 01:05:19 +02:00
parent b26fb44aeb
commit 4ca70a7af1
Signed by untrusted user who does not match committer: erlehmann
GPG Key ID: A3BC671C35191080
1 changed files with 47 additions and 0 deletions

View File

@ -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,