1
0
mirror of https://github.com/t-affeldt/regional_weather.git synced 2025-07-16 23:40:30 +02:00

Add new textures, tweak effects, add fog and freezing of river water

This commit is contained in:
Till Affeldt
2020-04-22 00:54:27 +02:00
parent e0b8d6d835
commit 32ab2c4d23
27 changed files with 223 additions and 65 deletions

60
abms/ice.lua Normal file
View File

@ -0,0 +1,60 @@
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"
minetest.register_node(BLOCK_NAME, {
tiles = {"(default_ice.png^[colorize:#ffffff:50)^[opacity:200"},
paramtype = "light",
groups = {cracky = 3, cools_lava = 1, slippery = 3, dig_immediate = 2},
sounds = default.node_sound_glass_defaults(),
use_texture_alpha = true,
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" },
interval = 10,
chance = 2,
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
max_heat = 25,
daylight = 15
},
action = function (pos, node, env)
minetest.set_node(pos, { name = BLOCK_NAME })
end
})
climate_api.register_abm({
label = "unfreeze river water",
nodenames = { BLOCK_NAME },
neighbors = { "air" },
interval = 15,
chance = 4,
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_heat = 40,
daylight = 15
},
action = function (pos, node, env)
minetest.set_node(pos, { name = "default:river_water_source" })
end
})

View File

@ -11,14 +11,9 @@ if not regional_weather.settings.puddles then
return
end
--Puddle node
local node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.375, 0.125, -0.4875, 0.3125},
{-0.25, -0.5, -0.3125, 0.3125, -0.4925, 0.25},
{-0.3125, -0.5, -0.1875, 0.375, -0.4975, 0.1875},
}
fixed = {-0.5, -0.5, -0.5, 0.5, -0.49, 0.5}
}
minetest.register_node(BLOCK_NAME, {
@ -30,14 +25,15 @@ minetest.register_node(BLOCK_NAME, {
walkable = false,
sunlight_propagates = true,
paramtype = "light",
alpha = 50,
use_texture_alpha = true,
node_box = node_box,
groups = {
not_in_creative_inventory = 1,
crumbly = 3,
attached_node = 1,
slippery = 1,
flora = 1
flora = 1,
water = 1
},
drop = "",
})

View File

@ -14,6 +14,13 @@ or not regional_weather.settings.snow then
return
end
local destruction_handler = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_snow" then
minetest.set_node(pos, {name = "default:dirt_with_grass"})
end
end
for i = 1,5 do
local node_box = {
type = "fixed",
@ -43,12 +50,8 @@ for i = 1,5 do
minetest.set_node(pos, {name = "default:dirt_with_snow"})
end
end,
on_destruct = function(pos)
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_snow" then
minetest.set_node(pos, {name = "default:dirt_with_grass"})
end
end
on_destruct = destruction_handler,
on_flood = destruction_handler
})
end