2024-10-27 16:57:04 -06:00

50 lines
1.2 KiB
Lua

minetest.register_abm({
label = "Water freezing/evaporating",
nodenames = {"group:water"},
interval = 3,
chance = 2.5,
catch_up = true,
action = function (pos)
local def = PyuTest.get_biome_def(pos)
if not def then return end
local heat = def.heat_point or 50
local found = minetest.find_node_near(pos, 2, {"group:emits_heat"}) ~= nil
if heat <= 12 and not found then
minetest.set_node(pos, {name = "pyutest_blocks:ice_block"})
end
end
})
minetest.register_abm({
label = "Water evaporating",
nodenames = {"group:water"},
interval = 0.1,
chance = 1,
action = function (pos)
local def = PyuTest.get_biome_def(pos)
if not def then return end
local heat = def.heat_point or 50
if heat >= 100 then
minetest.remove_node(pos)
end
end
})
minetest.register_abm({
label = "Ice thawing",
nodenames = {"group:thawable"},
neighbors = {"group:emits_heat"},
interval = 3,
chance = 2.5,
catch_up = true,
action = function (pos, node)
local def = minetest.registered_nodes[node.name]
local thaw_into = def.__thaw_into or "pyutest_blocks:water_source"
minetest.set_node(pos, { name = thaw_into })
end
})