2013-03-24 14:40:18 +01:00
|
|
|
-- Snow
|
2018-04-29 17:22:05 +02:00
|
|
|
weather_mod.register_downfall("weather:snow",{
|
2020-04-13 07:32:04 +02:00
|
|
|
min_pos = {x=-15, y=7, z=-15},
|
|
|
|
max_pos = {x= 15, y=7, z= 15},
|
2018-04-29 17:22:05 +02:00
|
|
|
falling_speed=5,
|
2020-04-13 07:32:04 +02:00
|
|
|
amount=15,
|
2018-04-29 17:22:05 +02:00
|
|
|
exptime=5,
|
|
|
|
size=25,
|
2020-04-13 07:32:04 +02:00
|
|
|
texture="weather_snow.png",
|
|
|
|
})
|
|
|
|
|
|
|
|
weather_mod.register_downfall("weather:hail",{
|
|
|
|
min_pos = {x=-15, y=7, z=-15},
|
|
|
|
max_pos = {x= 15, y=7, z= 15},
|
|
|
|
falling_speed=25,
|
|
|
|
amount=15,
|
|
|
|
exptime=0.8,
|
|
|
|
size=25,
|
|
|
|
texture="weather_hail.png",
|
|
|
|
enable_lightning = true,
|
2018-04-29 17:22:05 +02:00
|
|
|
})
|
2013-03-24 14:40:18 +01:00
|
|
|
|
2018-05-12 15:16:26 +02:00
|
|
|
local snow_box =
|
2013-03-24 14:40:18 +01:00
|
|
|
{
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Snow cover
|
|
|
|
minetest.register_node("weather:snow_cover", {
|
|
|
|
tiles = {"weather_snow_cover.png"},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
node_box = snow_box,
|
|
|
|
selection_box = snow_box,
|
|
|
|
groups = {not_in_creative_inventory = 1, crumbly = 3, attached_node = 1},
|
|
|
|
drop = {}
|
|
|
|
})
|
|
|
|
|
2019-05-29 16:02:33 +02:00
|
|
|
-- Snow cover ABM when snow_covers_abm setting is set to `true`
|
|
|
|
if minetest.is_yes(minetest.settings:get_bool('snow_covers_abm')) then
|
2018-05-17 17:00:58 +02:00
|
|
|
minetest.log('action', '[weather] Loaded fast computer ABM (snow covers when weather:snow is set)')
|
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"group:crumbly", "group:snappy", "group:cracky", "group:choppy"},
|
|
|
|
neighbors = {"default:air"},
|
|
|
|
interval = 10.0,
|
|
|
|
chance = 80,
|
|
|
|
action = function (pos, node)
|
|
|
|
if weather.type == "weather:snow" then
|
|
|
|
if minetest.registered_nodes[node.name].drawtype == "normal"
|
|
|
|
or minetest.registered_nodes[node.name].drawtype == "allfaces_optional" then
|
|
|
|
local np = vector.add(pos, {x=0, y=1, z=0})
|
|
|
|
if minetest.env:get_node_light(np, 0.5) == 15
|
|
|
|
and minetest.env:get_node(np).name == "air" then
|
|
|
|
minetest.env:add_node(np, {name="weather:snow_cover"})
|
|
|
|
end
|
2018-05-12 15:16:26 +02:00
|
|
|
end
|
2013-03-24 14:40:18 +01:00
|
|
|
end
|
|
|
|
end
|
2018-05-17 17:00:58 +02:00
|
|
|
})
|
|
|
|
end
|