mirror of
https://github.com/t-affeldt/regional_weather.git
synced 2025-07-23 02:40:25 +02:00
Update to new particle API, improve night visibility, move damage effect, improve cloud height calculation
This commit is contained in:
@ -3,17 +3,33 @@ local CLOUD_SPEED = 1.8
|
||||
|
||||
local conditions = {}
|
||||
|
||||
-- see https://en.wikipedia.org/wiki/Cloud_base
|
||||
local function calc_cloud_height(heat, humidity, dewpoint)
|
||||
local base = regional_weather.settings.cloud_height
|
||||
-- much lower scale like 20 instead of 1000 fitting for Minetest
|
||||
local scale = regional_weather.settings.cloud_scale
|
||||
local spread = heat - dewpoint
|
||||
local variation = spread / 4.4 * scale * 0.3
|
||||
return base + climate_api.utility.rangelim(variation, -scale, scale)
|
||||
end
|
||||
|
||||
local function generate_effects(params)
|
||||
local override = {}
|
||||
local wind = climate_api.environment.get_wind()
|
||||
|
||||
local skybox = {priority = 10}
|
||||
skybox.cloud_data = {
|
||||
density = climate_api.utility.rangelim(params.humidity / 100, 0.25, 0.75),
|
||||
density = climate_api.utility.rangelim(params.humidity / 100, 0.15, 0.65),
|
||||
speed = vector.multiply(wind, CLOUD_SPEED),
|
||||
thickness = climate_api.utility.rangelim(params.base_humidity * 0.2, 1, 18)
|
||||
thickness = climate_api.utility.rangelim(params.base_humidity * 0.2, 1, 18),
|
||||
height = calc_cloud_height(params.heat, params.humidity, params.dewpoint),
|
||||
ambient = "#0f0f1050"
|
||||
}
|
||||
|
||||
if params.height > -100 and params.humidity > 40 then
|
||||
skybox.cloud_data.color = "#b2a4a4b0"
|
||||
end
|
||||
|
||||
if params.height > -100 and params.humidity > 65 then
|
||||
skybox.sky_data = {
|
||||
type = "regular",
|
||||
@ -27,6 +43,8 @@ local function generate_effects(params)
|
||||
night_horizon = "#315d9b"
|
||||
}
|
||||
}
|
||||
skybox.cloud_data.color = "#828e97b5"
|
||||
skybox.cloud_data.ambient = "#20212250"
|
||||
end
|
||||
|
||||
override["climate_api:skybox"] = skybox
|
||||
|
Reference in New Issue
Block a user