mirror of
https://github.com/t-affeldt/regional_weather.git
synced 2024-09-29 07:50:22 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e161676210 | ||
|
6c150faaaf | ||
|
1a20676883 | ||
|
222f708760 | ||
|
d04daec67d | ||
|
5edea29484 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.code-workspace
|
|
@ -87,7 +87,6 @@ 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/
|
- 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/
|
- 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/
|
- 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
|
### HUD Overlays
|
||||||
- Frost HUD: *CC BY-SA (3.0)* by Cap
|
- Frost HUD: *CC BY-SA (3.0)* by Cap
|
||||||
|
|
|
@ -12,7 +12,8 @@ climate_api.register_abm({
|
||||||
conditions = {
|
conditions = {
|
||||||
min_height = regional_weather.settings.min_height,
|
min_height = regional_weather.settings.min_height,
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
min_humidity = 55,
|
min_humidity = 50,
|
||||||
|
min_biome_humidity = 26,
|
||||||
max_heat = 85,
|
max_heat = 85,
|
||||||
daylight = 15,
|
daylight = 15,
|
||||||
indoors = false
|
indoors = false
|
||||||
|
|
|
@ -42,7 +42,7 @@ climate_api.register_abm({
|
||||||
conditions = {
|
conditions = {
|
||||||
min_height = regional_weather.settings.min_height,
|
min_height = regional_weather.settings.min_height,
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
max_heat = 25,
|
max_heat = 35,
|
||||||
daylight = 15,
|
daylight = 15,
|
||||||
indoors = false
|
indoors = false
|
||||||
},
|
},
|
||||||
|
@ -62,7 +62,7 @@ climate_api.register_abm({
|
||||||
conditions = {
|
conditions = {
|
||||||
min_height = regional_weather.settings.min_height,
|
min_height = regional_weather.settings.min_height,
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
min_heat = 40,
|
min_heat = 35,
|
||||||
daylight = 15,
|
daylight = 15,
|
||||||
indoors = false
|
indoors = false
|
||||||
},
|
},
|
||||||
|
|
|
@ -20,7 +20,7 @@ climate_api.register_abm({
|
||||||
|
|
||||||
action = function (pos, node, env)
|
action = function (pos, node, env)
|
||||||
local wetness = minetest.get_item_group(node.name, "wet") or 0
|
local wetness = minetest.get_item_group(node.name, "wet") or 0
|
||||||
if wetness < 2 and env.humidity > 55 then
|
if wetness < 2 and env.humidity > 50 then
|
||||||
pedology.wetten(pos)
|
pedology.wetten(pos)
|
||||||
elseif wetness > 0 and wetness < 3 and env.humidity < 40 then
|
elseif wetness > 0 and wetness < 3 and env.humidity < 40 then
|
||||||
pedology.dry(pos)
|
pedology.dry(pos)
|
||||||
|
|
|
@ -80,13 +80,7 @@ for i = 1, VARIANT_COUNT do
|
||||||
water = apply_water_group,
|
water = apply_water_group,
|
||||||
weather_puddle = 1
|
weather_puddle = 1
|
||||||
},
|
},
|
||||||
drop = "",
|
drop = ""
|
||||||
sounds = {
|
|
||||||
footstep = {
|
|
||||||
name = "weather_puddle",
|
|
||||||
gain = 0.8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -117,10 +111,20 @@ climate_api.register_abm({
|
||||||
conditions = {
|
conditions = {
|
||||||
min_height = regional_weather.settings.min_height,
|
min_height = regional_weather.settings.min_height,
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
min_humidity = 55,
|
min_heat = 35,
|
||||||
min_heat = 30,
|
min_humidity = 50,
|
||||||
|
min_biome_humidity = 26,
|
||||||
daylight = 15,
|
daylight = 15,
|
||||||
indoors = false
|
indoors = false,
|
||||||
|
not_biome = {
|
||||||
|
"cold_desert",
|
||||||
|
"cold_desert_ocean",
|
||||||
|
"desert",
|
||||||
|
"desert_ocean",
|
||||||
|
"sandstone_desert",
|
||||||
|
"sandstone_desert_ocean",
|
||||||
|
"tundra"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
pos_override = function(pos)
|
pos_override = function(pos)
|
||||||
|
|
|
@ -72,8 +72,9 @@ climate_api.register_abm({
|
||||||
conditions = {
|
conditions = {
|
||||||
min_height = regional_weather.settings.min_height,
|
min_height = regional_weather.settings.min_height,
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
min_humidity = 55,
|
max_heat = 35,
|
||||||
max_heat = 30,
|
min_humidity = 50,
|
||||||
|
min_biome_humidity = 26,
|
||||||
not_biome = {
|
not_biome = {
|
||||||
"cold_desert",
|
"cold_desert",
|
||||||
"cold_desert_ocean",
|
"cold_desert_ocean",
|
||||||
|
|
|
@ -12,8 +12,8 @@ if farming ~= nil and farming.mod == "redo" then
|
||||||
conditions = {
|
conditions = {
|
||||||
min_height = regional_weather.settings.min_height,
|
min_height = regional_weather.settings.min_height,
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
min_humidity = 55,
|
min_humidity = 50,
|
||||||
min_heat = 30,
|
min_heat = 35,
|
||||||
daylight = 15,
|
daylight = 15,
|
||||||
indoors = false
|
indoors = false
|
||||||
},
|
},
|
||||||
|
@ -34,8 +34,8 @@ else
|
||||||
conditions = {
|
conditions = {
|
||||||
min_height = regional_weather.settings.min_height,
|
min_height = regional_weather.settings.min_height,
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
min_humidity = 55,
|
min_humidity = 50,
|
||||||
min_heat = 30,
|
min_heat = 35,
|
||||||
daylight = 15,
|
daylight = 15,
|
||||||
indoors = false
|
indoors = false
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,20 +14,20 @@ end
|
||||||
|
|
||||||
-- maps range of 0 to 1 to any other range
|
-- maps range of 0 to 1 to any other range
|
||||||
local function map_range(val, low, high)
|
local function map_range(val, low, high)
|
||||||
return (val + low) * (high - low)
|
return val * (high - low) + low
|
||||||
end
|
end
|
||||||
|
|
||||||
local function generate_effects(params)
|
local function generate_effects(params)
|
||||||
local override = {}
|
local override = {}
|
||||||
|
|
||||||
local cloud_density = climate_api.utility.rangelim(params.humidity / 100, 0.15, 0.65)
|
local cloud_density = climate_api.utility.rangelim(params.humidity / 100, 0.15, 0.65)
|
||||||
local cloud_thickness = climate_api.utility.rangelim(params.base_humidity * 0.2, 1, 18)
|
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 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 })
|
local wind = climate_api.environment.get_wind({ x = 0, y = cloud_height, z = 0 })
|
||||||
|
|
||||||
-- diffuse shadows when cloudy
|
-- diffuse shadows when cloudy
|
||||||
-- zero at density 0.65 and one at 0.15
|
-- cloud_shadows at zero at cloud density 0.65 and one at 0.15
|
||||||
local cloud_shadows = 1.075 - (cloud_density / 0.5)
|
local cloud_shadows = 1 - ((cloud_density - 0.15) / (0.65 - 0.15))
|
||||||
|
|
||||||
-- diffuse shadows at dawn / dusk
|
-- diffuse shadows at dawn / dusk
|
||||||
-- 15 hours between dawn and dusk accoring to https://wiki.minetest.net/Time_of_day
|
-- 15 hours between dawn and dusk accoring to https://wiki.minetest.net/Time_of_day
|
||||||
|
@ -36,8 +36,8 @@ local function generate_effects(params)
|
||||||
-- zero at dawn / dusk and one at midday
|
-- zero at dawn / dusk and one at midday
|
||||||
local daytime_shadows = 1 - (math.abs(0.5 - daytime) * 2 / daylight_duration)
|
local daytime_shadows = 1 - (math.abs(0.5 - daytime) * 2 / daylight_duration)
|
||||||
|
|
||||||
local shadow_intensity = map_range(cloud_shadows + daytime_shadows, 0.15, 0.5)
|
local shadow_intensity = map_range((cloud_shadows + daytime_shadows) / 2, 0.5, 2)
|
||||||
local light_saturation = map_range(cloud_shadows + daytime_shadows, 0.8, 1.2)
|
local light_saturation = map_range((cloud_shadows + daytime_shadows) / 2, 0.75, 1.25)
|
||||||
|
|
||||||
local skybox = {priority = 10}
|
local skybox = {priority = 10}
|
||||||
skybox.cloud_data = {
|
skybox.cloud_data = {
|
||||||
|
|
|
@ -3,17 +3,35 @@ local name = "regional_weather:fog"
|
||||||
local conditions = {
|
local conditions = {
|
||||||
min_height = regional_weather.settings.min_height,
|
min_height = regional_weather.settings.min_height,
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
min_humidity = 40,
|
min_humidity = 25,
|
||||||
max_humidity = 50,
|
max_humidity = 50,
|
||||||
max_windspeed = 2,
|
max_windspeed = 2,
|
||||||
min_heat = 40,
|
max_heat = 50,
|
||||||
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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local effects = {}
|
local effects = {}
|
||||||
|
|
||||||
|
effects["climate_api:hud_overlay"] = {
|
||||||
|
file = "weather_hud_fog.png^[opacity:100",
|
||||||
|
z_index = -200,
|
||||||
|
color_correction = true
|
||||||
|
}
|
||||||
|
|
||||||
effects["climate_api:skybox"] = {
|
effects["climate_api:skybox"] = {
|
||||||
sky_data = {
|
sky_data = {
|
||||||
|
type = "plain",
|
||||||
|
base_color = "#c0c0c08f",
|
||||||
clouds = true
|
clouds = true
|
||||||
},
|
},
|
||||||
cloud_data = {
|
cloud_data = {
|
||||||
|
@ -22,6 +40,10 @@ effects["climate_api:skybox"] = {
|
||||||
thickness = 40,
|
thickness = 40,
|
||||||
speed = {x=0,y=0,z=0}
|
speed = {x=0,y=0,z=0}
|
||||||
},
|
},
|
||||||
|
light_data = {
|
||||||
|
shadow_intensity = 0.1,
|
||||||
|
saturation = 0.5
|
||||||
|
},
|
||||||
priority = 50
|
priority = 50
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
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)
|
|
|
@ -6,6 +6,7 @@ local conditions = {
|
||||||
min_heat = 30,
|
min_heat = 30,
|
||||||
max_heat = 45,
|
max_heat = 45,
|
||||||
min_humidity = 65,
|
min_humidity = 65,
|
||||||
|
min_biome_humidity = 26,
|
||||||
min_windspeed = 2.5,
|
min_windspeed = 2.5,
|
||||||
indoors = false,
|
indoors = false,
|
||||||
not_biome = {
|
not_biome = {
|
||||||
|
|
|
@ -6,7 +6,17 @@ local conditions = {
|
||||||
min_heat = 35,
|
min_heat = 35,
|
||||||
min_humidity = 50,
|
min_humidity = 50,
|
||||||
max_humidity = 65,
|
max_humidity = 65,
|
||||||
indoors = false
|
min_biome_humidity = 26,
|
||||||
|
indoors = false,
|
||||||
|
not_biome = {
|
||||||
|
"cold_desert",
|
||||||
|
"cold_desert_ocean",
|
||||||
|
"desert",
|
||||||
|
"desert_ocean",
|
||||||
|
"sandstone_desert",
|
||||||
|
"sandstone_desert_ocean",
|
||||||
|
"tundra"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local effects = {}
|
local effects = {}
|
||||||
|
|
|
@ -5,7 +5,17 @@ local conditions = {
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
min_heat = 40,
|
min_heat = 40,
|
||||||
min_humidity = 65,
|
min_humidity = 65,
|
||||||
indoors = false
|
min_biome_humidity = 26,
|
||||||
|
indoors = false,
|
||||||
|
not_biome = {
|
||||||
|
"cold_desert",
|
||||||
|
"cold_desert_ocean",
|
||||||
|
"desert",
|
||||||
|
"desert_ocean",
|
||||||
|
"sandstone_desert",
|
||||||
|
"sandstone_desert_ocean",
|
||||||
|
"tundra"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local effects = {}
|
local effects = {}
|
||||||
|
|
|
@ -3,16 +3,11 @@ local name = "regional_weather:sandstorm"
|
||||||
local conditions = {
|
local conditions = {
|
||||||
min_height = regional_weather.settings.min_height,
|
min_height = regional_weather.settings.min_height,
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
min_heat = 50,
|
min_windspeed = 3,
|
||||||
max_humidity = 25,
|
|
||||||
min_windspeed = 4.5,
|
|
||||||
has_biome = {
|
has_biome = {
|
||||||
"cold_desert",
|
"cold_desert",
|
||||||
"cold_desert_ocean",
|
|
||||||
"desert",
|
"desert",
|
||||||
"desert_ocean",
|
"sandstone_desert"
|
||||||
"sandstone_desert",
|
|
||||||
"sandstone_desert_ocean"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ local conditions = {
|
||||||
max_heat = 35,
|
max_heat = 35,
|
||||||
min_humidity = 50,
|
min_humidity = 50,
|
||||||
max_humidity = 65,
|
max_humidity = 65,
|
||||||
|
min_biome_humidity = 26,
|
||||||
indoors = false,
|
indoors = false,
|
||||||
not_biome = {
|
not_biome = {
|
||||||
"cold_desert",
|
"cold_desert",
|
||||||
|
|
|
@ -5,6 +5,7 @@ local conditions = {
|
||||||
max_height = regional_weather.settings.max_height,
|
max_height = regional_weather.settings.max_height,
|
||||||
max_heat = 30,
|
max_heat = 30,
|
||||||
min_humidity = 65,
|
min_humidity = 65,
|
||||||
|
min_biome_humidity = 26,
|
||||||
indoors = false,
|
indoors = false,
|
||||||
not_biome = {
|
not_biome = {
|
||||||
"cold_desert",
|
"cold_desert",
|
||||||
|
|
|
@ -19,7 +19,7 @@ local function generate_effects(params)
|
||||||
local override = {}
|
local override = {}
|
||||||
|
|
||||||
override["climate_api:sound"] = {
|
override["climate_api:sound"] = {
|
||||||
gain = math.min(intensity, 1.2)
|
gain = math.min(intensity, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return climate_api.utility.merge_tables(effects, override)
|
return climate_api.utility.merge_tables(effects, override)
|
||||||
|
|
8
init.lua
8
init.lua
|
@ -37,18 +37,10 @@ regional_weather.settings.cloud_scale = get_setting_number("cloud_scale", 40)
|
||||||
local S = minetest.get_translator("regional_weather")
|
local S = minetest.get_translator("regional_weather")
|
||||||
regional_weather.i18n = S
|
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, true) then
|
|
||||||
minetest.log("warning", "[Regional Weather] " .. S("Disable MTG weather for the best experience. Check the forum for more information."))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- import individual weather types
|
-- import individual weather types
|
||||||
dofile(modpath.."/ca_weathers/ambient.lua")
|
dofile(modpath.."/ca_weathers/ambient.lua")
|
||||||
dofile(modpath.."/ca_weathers/deep_cave.lua")
|
dofile(modpath.."/ca_weathers/deep_cave.lua")
|
||||||
dofile(modpath.."/ca_weathers/fog.lua")
|
dofile(modpath.."/ca_weathers/fog.lua")
|
||||||
dofile(modpath.."/ca_weathers/fog_heavy.lua")
|
|
||||||
dofile(modpath.."/ca_weathers/hail.lua")
|
dofile(modpath.."/ca_weathers/hail.lua")
|
||||||
dofile(modpath.."/ca_weathers/pollen.lua")
|
dofile(modpath.."/ca_weathers/pollen.lua")
|
||||||
dofile(modpath.."/ca_weathers/rain.lua")
|
dofile(modpath.."/ca_weathers/rain.lua")
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# textdomain:regional_weather
|
# textdomain:regional_weather
|
||||||
Disable MTG weather for the best experience. Check the forum for more information.=Deaktiviere MTG weather für die beste Spielerfahrung. Mehr Informationen im Forum.
|
|
||||||
Thin Ice=Dünnes Eis
|
Thin Ice=Dünnes Eis
|
||||||
Puddle=Pfütze
|
Puddle=Pfütze
|
||||||
Snow Cover=Schnee
|
Snow Cover=Schnee
|
|
@ -1,5 +1,4 @@
|
||||||
# textdomain:regional_weather
|
# textdomain:regional_weather
|
||||||
Disable MTG weather for the best experience=
|
|
||||||
Thin Ice=
|
Thin Ice=
|
||||||
Puddle=
|
Puddle=
|
||||||
Snow Cover=
|
Snow Cover=
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user