Compare commits

..

No commits in common. "master" and "v1.0.0" have entirely different histories.

30 changed files with 201 additions and 373 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
*.code-workspace

View File

@ -87,6 +87,7 @@ The entire source code is available on [Github](https://github.com/t-affeldt/reg
- Light Rain sounds: *CC BY 3.0* by Arctura from https://freesound.org/people/Arctura/sounds/34065/
- Wind sound: *CC BY (3.0)* by InspectorJ from https://freesound.org/people/InspectorJ/sounds/376415/
- Hail sound: *CC0* by ikayuka from https://freesound.org/people/ikayuka/sounds/240742/
- Puddle footstep sound: *CC0* by swordofkings128 from https://freesound.org/people/swordofkings128/sounds/398032/
### HUD Overlays
- Frost HUD: *CC BY-SA (3.0)* by Cap

View File

@ -12,11 +12,9 @@ climate_api.register_abm({
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_humidity = 50,
min_biome_humidity = 26,
min_humidity = 55,
max_heat = 85,
daylight = 15,
indoors = false
daylight = 15
},
action = function (pos, node, env)

View File

@ -5,10 +5,7 @@ then return end
local BLOCK_NAME = "regional_weather:ice"
local S = regional_weather.i18n
minetest.register_node(BLOCK_NAME, {
description = S("Thin Ice"),
tiles = {"(default_ice.png^[colorize:#ffffff:50)^[opacity:200"},
paramtype = "light",
groups = {
@ -20,7 +17,7 @@ minetest.register_node(BLOCK_NAME, {
},
freezemelt = "default:river_water_source",
sounds = default.node_sound_glass_defaults(),
use_texture_alpha = "blend",
use_texture_alpha = true,
drop = "",
on_destruct = function(pos)
-- asynchronous to avoid destruction loop
@ -42,9 +39,8 @@ climate_api.register_abm({
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
max_heat = 35,
daylight = 15,
indoors = false
max_heat = 25,
daylight = 15
},
action = function (pos, node, env)
@ -62,9 +58,8 @@ climate_api.register_abm({
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_heat = 35,
daylight = 15,
indoors = false
min_heat = 40,
daylight = 15
},
action = function (pos, node, env)

View File

@ -14,13 +14,12 @@ climate_api.register_abm({
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_heat = 25,
daylight = 15,
indoors = false,
min_light = 15
},
action = function (pos, node, env)
local wetness = minetest.get_item_group(node.name, "wet") or 0
if wetness < 2 and env.humidity > 50 then
if wetness < 2 and env.humidity > 55 then
pedology.wetten(pos)
elseif wetness > 0 and wetness < 3 and env.humidity < 40 then
pedology.dry(pos)

View File

@ -1,7 +1,6 @@
local BLOCK_PREFIX = "regional_weather:puddle_"
local VARIANT_COUNT = 39
local CHECK_DISTANCE = 4
local MAX_AMOUNT = 3
local MIN_DISTANCE = 4
local GROUND_COVERS = {
"group:soil",
@ -13,53 +12,31 @@ local GROUND_COVERS = {
"default:permafrost_with_stones"
}
local S = regional_weather.i18n
-- clean up puddles if disabled
if not regional_weather.settings.puddles then
-- set all puddle nodes to air
minetest.register_alias("regional_weather:puddle", "air")
for i = 1, VARIANT_COUNT do
for flip = 0, 1 do
local name = BLOCK_PREFIX .. i
if flip == 1 then
name = name .. "_flipped"
end
minetest.register_alias(name, "air")
for i=1,VARIANT_COUNT do
for r=0,270,90 do
minetest.register_alias(BLOCK_PREFIX .. i .. "_" .. r, "air")
end
end
-- return air instead of a puddle
function regional_weather.get_random_puddle()
return { name = "air" }
end
-- end puddle execution
return
end
local node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.49, 0.5 }
fixed = {-0.5, -0.5, -0.5, 0.5, -0.49, 0.5}
}
local apply_water_group
if regional_weather.settings.puddles_water then
apply_water_group = 1
end
for i = 1, VARIANT_COUNT do
for flip = 0, 1 do
for i = 1,VARIANT_COUNT do
for flip = 0,1 do
local name = BLOCK_PREFIX .. i
local index = i
if i < 10 then index = "0" .. i end
local texture = "weather_puddle_" .. index .. ".png^[opacity:24"
local texture = "weather_puddle_" .. index .. ".png^[opacity:128"
if flip == 1 then
name = name .. "_flipped"
texture = texture .. "^[transformFX"
end
minetest.register_node(name, {
description = S("Puddle"),
tiles = { texture },
drawtype = "nodebox",
pointable = false,
@ -69,7 +46,7 @@ for i = 1, VARIANT_COUNT do
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "blend",
use_texture_alpha = true,
node_box = node_box,
groups = {
not_in_creative_inventory = 1,
@ -77,17 +54,23 @@ for i = 1, VARIANT_COUNT do
attached_node = 1,
slippery = 1,
flora = 1,
water = apply_water_group,
water = 1,
weather_puddle = 1
},
drop = ""
drop = "",
sounds = {
footstep = {
name = "weather_puddle",
gain = 0.8
}
}
})
end
end
minetest.register_alias("regional_weather:puddle", BLOCK_PREFIX .. "14")
function regional_weather.get_random_puddle()
local function get_random_puddle()
local index = math.random(1, VARIANT_COUNT)
local rotation = math.random(0, 3) * 90
local flip = math.random(0, 1)
@ -109,22 +92,11 @@ climate_api.register_abm({
catch_up = false,
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_heat = 35,
min_humidity = 50,
min_biome_humidity = 26,
daylight = 15,
indoors = false,
not_biome = {
"cold_desert",
"cold_desert_ocean",
"desert",
"desert_ocean",
"sandstone_desert",
"sandstone_desert_ocean",
"tundra"
}
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_humidity = 55,
min_heat = 30,
daylight = 15
},
pos_override = function(pos)
@ -132,28 +104,25 @@ climate_api.register_abm({
end,
action = function (pos, node, env)
-- only override air nodes
if minetest.get_node(pos).name ~= "air" then return end
-- do not place puddle if area is not fully loaded
if minetest.find_node_near(pos, CHECK_DISTANCE, "ignore") then return end
-- do not place puddle if already enpugh puddles
local pos1 = vector.add(pos, { x = -CHECK_DISTANCE, y = -1, z = -CHECK_DISTANCE })
local pos2 = vector.add(pos, { x = CHECK_DISTANCE, y = 1, z = CHECK_DISTANCE })
local preplaced = minetest.find_nodes_in_area(pos1, pos2, "group:weather_puddle")
if preplaced ~= nil and #preplaced >= MAX_AMOUNT then return end
minetest.set_node(pos, regional_weather.get_random_puddle())
if minetest.find_node_near(pos, MIN_DISTANCE, "group:weather_puddle") then return end
minetest.set_node(pos, get_random_puddle())
end
})
-- Makes puddles dry up when not raining
climate_api.register_abm({
label = "remove rain puddles",
nodenames = { "group:weather_puddle" },
interval = 25,
chance = 30,
nodenames = { "group:regional_weather_puddle" },
interval = 10,
chance = 3,
catch_up = true,
action = function (pos, node, env)
minetest.remove_node(pos)
if env.humidity < 55 then
minetest.remove_node(pos)
elseif env.heat < 30 and regional_weather.settings.snow_cover then
minetest.set_node(pos, {name = "regional_weather:snow_cover_1"})
end
end
})

View File

@ -1,8 +1,4 @@
local BLOCK_PREFIX = "regional_weather:snow_cover_"
local CHECK_DISTANCE = 5
local MAX_AMOUNT = 20
local S = regional_weather.i18n
if not minetest.get_modpath("default")
or default.node_sound_snow_defaults == nil
@ -27,7 +23,6 @@ for i = 1,5 do
}
minetest.register_node(BLOCK_PREFIX .. i, {
description = S("Snow Cover"),
tiles = { "default_snow.png" },
drawtype = "nodebox",
buildable_to = i < 3,
@ -40,7 +35,7 @@ for i = 1,5 do
crumbly = 3,
falling_node = 1,
snowy = 1,
weather_snow_cover = i
regional_weather_snow_cover = i
},
sounds = default.node_sound_snow_defaults(),
drop = "default:snow " .. math.ceil(i / 2),
@ -66,25 +61,15 @@ climate_api.register_abm({
},
neighbors = { "air" },
interval = 25,
chance = 80,
chance = 40,
catch_up = false,
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
max_heat = 35,
min_humidity = 50,
min_biome_humidity = 26,
not_biome = {
"cold_desert",
"cold_desert_ocean",
"desert",
"desert_ocean",
"sandstone_desert",
"sandstone_desert_ocean"
},
daylight = 15,
indoors = false
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_humidity = 55,
max_heat = 30,
daylight = 15
},
pos_override = function(pos)
@ -92,88 +77,64 @@ climate_api.register_abm({
end,
action = function (pos, node, env)
-- only override air nodes
if node.name ~= "air" then return end
-- do not place snow if area is not fully loaded
if minetest.find_node_near(pos, CHECK_DISTANCE, "ignore") then return end
-- do not place snow if already enpugh snow
local pos1 = vector.add(pos, { x = -CHECK_DISTANCE, y = -1, z = -CHECK_DISTANCE })
local pos2 = vector.add(pos, { x = CHECK_DISTANCE, y = 1, z = CHECK_DISTANCE })
local preplaced = minetest.find_nodes_in_area(pos1, pos2, "group:weather_snow_cover")
if preplaced ~= nil and #preplaced >= MAX_AMOUNT then return end
minetest.set_node(pos, { name = BLOCK_PREFIX .. "1" })
local base = minetest.get_node(vector.add(pos, {x=0, y=-1, z=0})).name
local is_soil = minetest.get_item_group(base, "soil") or 0
local is_stone = minetest.get_item_group(base, "stone") or 0
if not (is_soil == 0 and is_stone == 0) then
minetest.set_node(pos, { name = BLOCK_PREFIX .. "1" })
end
end
})
if regional_weather.settings.snow_griefing then
climate_api.register_abm({
label = "replace flora with snow covers and stack covers higher",
nodenames = {
"group:flora",
"group:grass",
"group:plant",
"group:weather_snow_cover"
},
neighbors = { "air" },
interval = 25,
chance = 160,
catch_up = false,
climate_api.register_abm({
label = "replace flora with snow covers and stack covers higher",
nodenames = {
"group:flora",
"group:grass",
"group:plant",
"group:regional_weather_snow_cover"
},
neighbors = { "air" },
interval = 25,
chance = 30,
catch_up = false,
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_humidity = 55,
max_heat = 30,
not_biome = {
"cold_desert",
"cold_desert_ocean",
"desert",
"desert_ocean",
"sandstone_desert",
"sandstone_desert_ocean"
},
daylight = 15,
indoors = false
},
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_humidity = 55,
max_heat = 30,
daylight = 15
},
action = function (pos, node, env)
local value = minetest.get_item_group(node.name, "weather_snow_cover") or 0
if value == 0 then
-- do not override plants unless marked as buildable_to
local def = minetest.registered_nodes[node.name]
if def == nil or not def.buildable_to then return end
-- do not override plants of the frost_resistance group
local resistance = minetest.get_item_group(node.name, "frost_resistance") or 0
if resistance > 0 then return end
end
-- do not place snow if area is not fully loaded
if minetest.find_node_near(pos, CHECK_DISTANCE, "ignore") then return end
-- do not place snow if already enpugh snow
local pos1 = vector.add(pos, { x = -CHECK_DISTANCE, y = -1, z = -CHECK_DISTANCE })
local pos2 = vector.add(pos, { x = CHECK_DISTANCE, y = 1, z = CHECK_DISTANCE })
local preplaced = minetest.find_nodes_in_area(pos1, pos2, "group:weather_snow_cover")
if preplaced ~= nil and #preplaced >= MAX_AMOUNT then return end
if value < 5 then
minetest.set_node(pos, { name = BLOCK_PREFIX .. (value + 1) })
end
action = function (pos, node, env)
local value = minetest.get_item_group(node.name, "regional_weather_snow_cover")
if value == nil then value = 0 end
if value < 5 then
minetest.set_node(pos, { name = BLOCK_PREFIX .. (value + 1) })
end
})
end
end
})
climate_api.register_abm({
label = "melt snow covers",
nodenames = { "group:weather_snow_cover" },
nodenames = { "group:regional_weather_snow_cover" },
interval = 25,
chance = 85,
chance = 10,
catch_up = true,
conditions = {
min_heat = 30
},
action = function (pos, node, env)
local value = minetest.get_item_group(node.name, "weather_snow_cover")
local value = minetest.get_item_group(node.name, "regional_weather_snow_cover")
if value == nil then value = 0 end
if value > 1 then
minetest.set_node(pos, { name = BLOCK_PREFIX .. (value - 1) })
elseif regional_weather.settings.puddles then
minetest.set_node(pos, regional_weather.get_random_puddle())
minetest.set_node(pos, { name = "regional_weather:puddle" })
else
minetest.set_node(pos, { name = "air" })
end

View File

@ -12,10 +12,9 @@ if farming ~= nil and farming.mod == "redo" then
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_humidity = 50,
min_heat = 35,
daylight = 15,
indoors = false
min_humidity = 55,
min_heat = 30,
min_light = 15
},
action = function (pos, node, env)
@ -34,10 +33,9 @@ else
conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_humidity = 50,
min_heat = 35,
daylight = 15,
indoors = false
min_humidity = 55,
min_heat = 30,
min_light = 15
},
action = function (pos, node, env)

View File

@ -6,7 +6,6 @@ Expects an integer indicating a chance (between 0 and 1) for lightning to strike
]]
if not minetest.get_modpath("lightning") then return end
if regional_weather.settings.lightning == 0 then return end
local EFFECT_NAME = "regional_weather:lightning"
@ -47,7 +46,7 @@ local function handle_effect(player_data)
chance = chance + value - (chance * value)
end
local random = math.random()
if random <= chance * regional_weather.settings.lightning then
if random <= chance then
local player = minetest.get_player_by_name(playername)
local ppos = player:get_pos()
local position = choose_pos(ppos)

View File

@ -4,8 +4,6 @@ Use this effect to modify a player's movement speed.
Expects a numeric value that will be multiplied with the current speed physics.
]]
if not regional_weather.settings.player_speed then return end
local EFFECT_NAME = "regional_weather:speed_buff"
local function handle_effect(player_data)

View File

@ -12,47 +12,21 @@ local function calc_cloud_height(heat, humidity, dewpoint)
return base + climate_api.utility.rangelim(variation, -scale, scale)
end
-- maps range of 0 to 1 to any other range
local function map_range(val, low, high)
return (val + low) * (high - low)
end
local function generate_effects(params)
local override = {}
local cloud_density = climate_api.utility.rangelim(params.humidity / 100, 0.15, 0.65)
local cloud_thickness = climate_api.utility.rangelim(params.biome_humidity * 0.2, 1, 18)
local cloud_height = calc_cloud_height(params.heat, params.humidity, params.dewpoint)
local wind = climate_api.environment.get_wind({ x = 0, y = cloud_height, z = 0 })
-- diffuse shadows when cloudy
-- zero at density 0.65 and one at 0.15
local cloud_shadows = 1.075 - (cloud_density / 0.5)
-- diffuse shadows at dawn / dusk
-- 15 hours between dawn and dusk accoring to https://wiki.minetest.net/Time_of_day
local daylight_duration = 15 / 24
local daytime = climate_api.utility.rangelim(minetest.get_timeofday(), 0.1875, 0.8125)
-- zero at dawn / dusk and one at midday
local daytime_shadows = 1 - (math.abs(0.5 - daytime) * 2 / daylight_duration)
local shadow_intensity = map_range(cloud_shadows + daytime_shadows, 0.15, 0.4)
local light_saturation = map_range(cloud_shadows + daytime_shadows, 0.9, 1.1)
local skybox = {priority = 10}
skybox.cloud_data = {
density = cloud_density,
density = climate_api.utility.rangelim(params.humidity / 100, 0.15, 0.65),
speed = wind,
thickness = cloud_thickness,
thickness = climate_api.utility.rangelim(params.base_humidity * 0.2, 1, 18),
height = cloud_height,
ambient = "#0f0f1050"
}
skybox.light_data = {
shadow_intensity = shadow_intensity,
saturation = light_saturation
}
if params.height > -100 and params.humidity > 40 then
skybox.cloud_data.color = "#b2a4a4b0"
end
@ -76,19 +50,16 @@ local function generate_effects(params)
override["climate_api:skybox"] = skybox
if params.height > - 50 and not params.indoors then
local movement = params.player:get_velocity()
local movement_direction
if (vector.length(movement) < 0.1) then
movement_direction = vector.new(0, 0, 0)
else
movement_direction = vector.normalize(movement)
end
local vector_product = vector.dot(movement_direction, wind)
local movement_penalty = climate_api.utility.sigmoid(vector_product, 1.5, 0.15, 0.9) + 0.2
override["regional_weather:speed_buff"] = movement_penalty
local movement = params.player:get_player_velocity()
local movement_direction
if (vector.length(movement) < 0.1) then
movement_direction = vector.new(0, 0, 0)
else
movement_direction = vector.normalize(movement)
end
local vector_product = vector.dot(movement_direction, wind)
local movement_penalty = climate_api.utility.sigmoid(vector_product, 1.6, 0.2, 0.8) + 0.2
override["regional_weather:speed_buff"] = movement_penalty
return override
end

View File

@ -18,10 +18,6 @@ effects["climate_api:skybox"] = {
},
moon_data = { visible = false },
star_data = { visible = false },
light_data = {
shadow_intensity = 0,
saturation = 1
},
priority = 100
}

View File

@ -3,35 +3,17 @@ local name = "regional_weather:fog"
local conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_humidity = 25,
min_humidity = 40,
max_humidity = 50,
max_windspeed = 2,
max_heat = 50,
min_time = 4 / 24,
max_time = 8 / 24,
not_biome = {
"cold_desert",
"cold_desert_ocean",
"desert",
"desert_ocean",
"sandstone_desert",
"sandstone_desert_ocean",
"tundra"
}
min_heat = 40,
max_heat = 50
}
local effects = {}
effects["climate_api:hud_overlay"] = {
file = "weather_hud_fog.png^[opacity:100",
z_index = -200,
color_correction = true
}
effects["climate_api:skybox"] = {
sky_data = {
type = "plain",
base_color = "#c0c0c08f",
clouds = true
},
cloud_data = {
@ -40,10 +22,6 @@ effects["climate_api:skybox"] = {
thickness = 40,
speed = {x=0,y=0,z=0}
},
light_data = {
shadow_intensity = 0.1,
saturation = 0.5
},
priority = 50
}

32
ca_weathers/fog_heavy.lua Normal file
View File

@ -0,0 +1,32 @@
local name = "regional_weather:fog_heavy"
local conditions = {
min_height = regional_weather.settings.min_height * 0.9,
max_height = regional_weather.settings.max_height * 0.9,
min_humidity = 43,
max_humidity = 47,
max_windspeed = 1.5,
min_heat = 43,
max_heat = 47
}
local effects = {}
effects["climate_api:hud_overlay"] = {
file = "weather_hud_fog.png^[opacity:100",
z_index = -200,
color_correction = true
}
effects["climate_api:skybox"] = {
sky_data = {
type = "plain",
base_color = "#c0c0c08f"
},
cloud_data = {
color = "#ffffffc0",
},
priority = 51
}
climate_api.register_weather(name, conditions, effects)

View File

@ -1,22 +1,13 @@
local name = "regional_weather:hail"
local conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_heat = 30,
max_heat = 45,
min_humidity = 65,
min_biome_humidity = 26,
min_windspeed = 2.5,
indoors = false,
not_biome = {
"cold_desert",
"cold_desert_ocean",
"desert",
"desert_ocean",
"sandstone_desert",
"sandstone_desert_ocean"
}
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_heat = 30,
max_heat = 45,
min_humidity = 65,
min_windspeed = 2.5,
daylight = 15
}
local effects = {}

View File

@ -7,7 +7,7 @@ local conditions = {
min_humidity = 30,
max_humidity = 40,
max_windspeed = 2,
indoors = false,
daylight = 15,
has_biome = {
"default",
"deciduous_forest",

View File

@ -1,22 +1,12 @@
local name = "regional_weather:rain"
local conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_heat = 35,
min_humidity = 50,
max_humidity = 65,
min_biome_humidity = 26,
indoors = false,
not_biome = {
"cold_desert",
"cold_desert_ocean",
"desert",
"desert_ocean",
"sandstone_desert",
"sandstone_desert_ocean",
"tundra"
}
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_heat = 35,
min_humidity = 50,
max_humidity = 65,
daylight = 15
}
local effects = {}

View File

@ -1,21 +1,11 @@
local name = "regional_weather:rain_heavy"
local conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_heat = 40,
min_humidity = 65,
min_biome_humidity = 26,
indoors = false,
not_biome = {
"cold_desert",
"cold_desert_ocean",
"desert",
"desert_ocean",
"sandstone_desert",
"sandstone_desert_ocean",
"tundra"
}
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_heat = 40,
min_humidity = 65,
daylight = 15
}
local effects = {}

View File

@ -3,11 +3,16 @@ local name = "regional_weather:sandstorm"
local conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_windspeed = 3,
min_heat = 50,
max_humidity = 25,
min_windspeed = 4.5,
has_biome = {
"cold_desert",
"cold_desert_ocean",
"desert",
"sandstone_desert"
"desert_ocean",
"sandstone_desert",
"sandstone_desert_ocean"
}
}

View File

@ -3,19 +3,10 @@ local name = "regional_weather:snow"
local conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
max_heat = 35,
min_humidity = 50,
max_humidity = 65,
min_biome_humidity = 26,
indoors = false,
not_biome = {
"cold_desert",
"cold_desert_ocean",
"desert",
"desert_ocean",
"sandstone_desert",
"sandstone_desert_ocean"
}
max_heat = 35,
min_humidity = 50,
max_humidity = 65,
daylight = 15
}
local effects = {}

View File

@ -3,18 +3,9 @@ local name = "regional_weather:snow_heavy"
local conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
max_heat = 30,
min_humidity = 65,
min_biome_humidity = 26,
indoors = false,
not_biome = {
"cold_desert",
"cold_desert_ocean",
"desert",
"desert_ocean",
"sandstone_desert",
"sandstone_desert_ocean"
}
max_heat = 30,
min_humidity = 65,
daylight = 15
}
local effects = {}

View File

@ -4,7 +4,7 @@ local conditions = {
min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height,
min_windspeed = 3,
indoors = false,
daylight = 15
}
local effects = {}
@ -19,7 +19,7 @@ local function generate_effects(params)
local override = {}
override["climate_api:sound"] = {
gain = math.min(intensity, 1)
gain = math.min(intensity, 1.2)
}
return climate_api.utility.merge_tables(effects, override)

View File

@ -1,46 +1,43 @@
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
local function get_setting_bool(name, default, is_global)
local prefix = ""
if not is_global then prefix = "regional_weather_" end
local value = minetest.settings:get_bool(prefix .. name)
local function get_setting_bool(name, default)
local value = minetest.settings:get_bool("regional_weather_" .. name)
if type(value) == "nil" then value = default end
return minetest.is_yes(value)
end
local function get_setting_number(name, default, is_global)
local prefix = ""
if not is_global then prefix = "regional_weather_" end
local value = minetest.settings:get(prefix .. name)
local function get_setting_number(name, default)
local value = minetest.settings:get("regional_weather_" .. name)
if type(value) == "nil" then value = default end
return tonumber(value)
end
regional_weather = {}
regional_weather.settings = {}
regional_weather.settings.player_speed = get_setting_bool("player_speed", false)
regional_weather.settings.snow = get_setting_bool("snow_layers", true)
regional_weather.settings.snow_griefing = get_setting_bool("snow_griefing", true)
regional_weather.settings.puddles = get_setting_bool("puddles", true)
regional_weather.settings.puddles_water = get_setting_bool("puddles_water", false)
regional_weather.settings.soil = get_setting_bool("soil", true)
regional_weather.settings.fire = get_setting_bool("fire", true)
regional_weather.settings.ice = get_setting_bool("ice", true)
regional_weather.settings.pedology = get_setting_bool("pedology", true)
regional_weather.settings.lightning = get_setting_number("lightning", 1)
regional_weather.settings.max_height = get_setting_number("max_height", 120)
regional_weather.settings.min_height = get_setting_number("min_height", -50)
regional_weather.settings.cloud_height = get_setting_number("cloud_height", 120)
regional_weather.settings.cloud_scale = get_setting_number("cloud_scale", 40)
regional_weather.settings.snow = get_setting_bool("snow_layers", true)
regional_weather.settings.puddles = get_setting_bool("puddles", true)
regional_weather.settings.soil = get_setting_bool("soil", true)
regional_weather.settings.fire = get_setting_bool("fire", true)
regional_weather.settings.ice = get_setting_bool("ice", true)
regional_weather.settings.pedology = get_setting_bool("pedology", true)
regional_weather.settings.max_height = get_setting_number("max_height", 120)
regional_weather.settings.min_height = get_setting_number("min_height", -50)
regional_weather.settings.cloud_height= get_setting_number("cloud_height", 120)
regional_weather.settings.cloud_scale = get_setting_number("cloud_scale", 40)
local S = minetest.get_translator("regional_weather")
regional_weather.i18n = S
-- warn about clouds being overriden by MTG weather
if climate_mod.settings.skybox
and minetest.get_modpath("weather")
and get_setting_bool("enable_weather", true) then
minetest.log("warning", "[Regional Weather] Disable MTG weather for the best experience")
end
-- import individual weather types
dofile(modpath.."/ca_weathers/ambient.lua")
dofile(modpath.."/ca_weathers/deep_cave.lua")
dofile(modpath.."/ca_weathers/fog.lua")
dofile(modpath.."/ca_weathers/fog_heavy.lua")
dofile(modpath.."/ca_weathers/hail.lua")
dofile(modpath.."/ca_weathers/pollen.lua")
dofile(modpath.."/ca_weathers/rain.lua")

View File

@ -1,4 +0,0 @@
# textdomain:regional_weather
Thin Ice=Dünnes Eis
Puddle=Pfütze
Snow Cover=Schnee

View File

@ -1,4 +0,0 @@
# textdomain:regional_weather
Thin Ice=
Puddle=
Snow Cover=

View File

@ -1,6 +1,7 @@
name = regional_weather
title = Regional Weather
author = TestificateMods
release = 100000
depends = climate_api
optional_depends = default, lightning, farming, fire, pedology
description = """

View File

@ -1,14 +1,8 @@
[Features]
# If set to true, wind will boost or penalize player movements based on direction.
regional_weather_player_speed (Change movement speed based on wind) bool false
# If set to true, snow layers will stack up during snowy weather.
regional_weather_snow_layers (Place snow layers) bool true
# If set to true, snow layers will destroy crops
regional_weather_snow_griefing (Destructive snow layers) bool true
# If set to true, river water sources will freeze at low temperatures and melt when it gets warmer again.
# This process does not affect regular ice blocks because it adds its own temporary ones.
regional_weather_ice (Freeze river water) bool true
@ -16,12 +10,8 @@ regional_weather_ice (Freeze river water) bool true
# If set to true, water puddles will form during rain or when snow layers have melted.
regional_weather_puddles (Place rain puddles) bool true
# If set to true, puddles will be marked as water and hydrate farmland.
# Not compatible with some ambient sound or mob mods
regional_weather_puddles_water (Hydrate farmland near puddles) bool false
# If set to true, rain will cause dry farmland to turn wet.
regional_weather_soil (Hydrate farmland during rain) bool true
regional_weather_soil (Hydrate farmland) bool true
# If set to true, fires will be extinguished during rain showers.
regional_weather_fire (Extinguish fire) bool true
@ -29,10 +19,6 @@ regional_weather_fire (Extinguish fire) bool true
# If set to true, rain will wetten or dry nodes from pedology mod.
regional_weather_pedology (Wetten pedology nodes) bool true
# Multiplier for lightning strike chances
# Requires lightning mod to be installed
regional_weather_lightning (Lightning chance modifier) float 1 0 20
[World Configuration]
# No visual effects will be applied below this height.

BIN
sounds/weather_puddle.ogg Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 510 KiB