2024-10-25 23:04:36 -06:00

30 lines
796 B
Lua

minetest.register_abm({
label = "Water freezing",
nodenames = {"group:water"},
interval = 3,
chance = 2.5,
catch_up = true,
action = function (pos)
local heat = minetest.get_heat(pos) 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 = "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
})