2020-04-22 00:54:27 +02:00
|
|
|
if not regional_weather.settings.ice
|
|
|
|
or not minetest.get_modpath("default")
|
|
|
|
or default.node_sound_glass_defaults == nil
|
|
|
|
then return end
|
|
|
|
|
|
|
|
local BLOCK_NAME = "regional_weather:ice"
|
|
|
|
|
2020-05-29 22:02:12 +02:00
|
|
|
local S = regional_weather.i18n
|
|
|
|
|
2020-04-22 00:54:27 +02:00
|
|
|
minetest.register_node(BLOCK_NAME, {
|
2020-05-29 22:02:12 +02:00
|
|
|
description = S("Thin Ice"),
|
2020-04-22 00:54:27 +02:00
|
|
|
tiles = {"(default_ice.png^[colorize:#ffffff:50)^[opacity:200"},
|
|
|
|
paramtype = "light",
|
2020-04-26 18:10:46 +02:00
|
|
|
groups = {
|
|
|
|
cracky = 3,
|
|
|
|
cools_lava = 1,
|
|
|
|
slippery = 3,
|
|
|
|
dig_immediate = 2,
|
|
|
|
melts = 1
|
|
|
|
},
|
|
|
|
freezemelt = "default:river_water_source",
|
2020-04-22 00:54:27 +02:00
|
|
|
sounds = default.node_sound_glass_defaults(),
|
2023-02-22 03:12:24 +01:00
|
|
|
use_texture_alpha = "blend",
|
2020-04-22 00:54:27 +02:00
|
|
|
drop = "",
|
|
|
|
on_destruct = function(pos)
|
|
|
|
-- asynchronous to avoid destruction loop
|
|
|
|
minetest.after(0, function(pos)
|
|
|
|
if minetest.get_node(pos).name ~= "air" then return end
|
|
|
|
minetest.set_node(pos, { name = "default:river_water_source" })
|
|
|
|
end, pos)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
climate_api.register_abm({
|
|
|
|
label = "freeze river water",
|
|
|
|
nodenames = { "default:river_water_source" },
|
|
|
|
neighbors = { "air" },
|
2020-04-25 15:50:45 +02:00
|
|
|
interval = 25,
|
|
|
|
chance = 3,
|
2020-04-24 01:36:58 +02:00
|
|
|
catch_up = false,
|
2020-04-22 00:54:27 +02:00
|
|
|
|
|
|
|
conditions = {
|
|
|
|
min_height = regional_weather.settings.min_height,
|
|
|
|
max_height = regional_weather.settings.max_height,
|
2023-02-24 09:51:14 +01:00
|
|
|
max_heat = 35,
|
2020-10-08 22:03:00 +02:00
|
|
|
daylight = 15,
|
|
|
|
indoors = false
|
2020-04-22 00:54:27 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
action = function (pos, node, env)
|
|
|
|
minetest.set_node(pos, { name = BLOCK_NAME })
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
climate_api.register_abm({
|
|
|
|
label = "unfreeze river water",
|
|
|
|
nodenames = { BLOCK_NAME },
|
2020-04-25 15:50:45 +02:00
|
|
|
interval = 25,
|
2020-04-22 00:54:27 +02:00
|
|
|
chance = 4,
|
2020-04-24 01:36:58 +02:00
|
|
|
catch_up = true,
|
2020-04-22 00:54:27 +02:00
|
|
|
|
|
|
|
conditions = {
|
|
|
|
min_height = regional_weather.settings.min_height,
|
|
|
|
max_height = regional_weather.settings.max_height,
|
2023-02-24 09:51:14 +01:00
|
|
|
min_heat = 35,
|
2020-10-08 22:03:00 +02:00
|
|
|
daylight = 15,
|
|
|
|
indoors = false
|
2020-04-22 00:54:27 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
action = function (pos, node, env)
|
|
|
|
minetest.set_node(pos, { name = "default:river_water_source" })
|
|
|
|
end
|
|
|
|
})
|