30 lines
799 B
Lua
30 lines
799 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)
|
|
local found = minetest.find_node_near(pos, 2, {"group:emits_heat"}) ~= nil
|
|
|
|
if heat and 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
|
|
})
|