mirror of
https://github.com/t-affeldt/regional_weather.git
synced 2025-09-14 12:25:19 +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
|
||||
|
@@ -11,9 +11,14 @@ local conditions = {
|
||||
|
||||
local effects = {}
|
||||
|
||||
effects["regional_weather:damage"] = {
|
||||
effects["climate_api:damage"] = {
|
||||
chance = 15,
|
||||
value = 3
|
||||
value = 3,
|
||||
check = {
|
||||
type = "raycast",
|
||||
height = 7,
|
||||
velocity = 20
|
||||
}
|
||||
}
|
||||
|
||||
effects["climate_api:sound"] = {
|
||||
@@ -21,18 +26,19 @@ effects["climate_api:sound"] = {
|
||||
gain = 1
|
||||
}
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-9, y=7, z=-9},
|
||||
max_pos = {x= 9, y=7, z= 9},
|
||||
falling_speed=20,
|
||||
amount=6,
|
||||
exptime=0.7,
|
||||
size=1,
|
||||
textures = {}
|
||||
}
|
||||
|
||||
for i = 1,5,1 do
|
||||
effects["climate_api:particles"].textures[i] = "weather_hail" .. i .. ".png"
|
||||
local textures = {}
|
||||
for i = 1,5 do
|
||||
textures[i] = "weather_hail" .. i .. ".png"
|
||||
end
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
boxsize = { x = 18, y = 0, z = 18},
|
||||
v_offset = 7,
|
||||
velocity = 20,
|
||||
amount = 6,
|
||||
expirationtime = 0.7,
|
||||
texture = textures,
|
||||
glow = 5
|
||||
}
|
||||
|
||||
climate_api.register_weather(name, conditions, effects)
|
||||
|
@@ -34,14 +34,15 @@ local conditions = {
|
||||
local effects = {}
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-12, y=-4, z=-12},
|
||||
max_pos = {x= 12, y= 1, z= 12},
|
||||
falling_speed = -0.1,
|
||||
acceleration = {x=0,y=-0.03,z=0},
|
||||
amount = 1,
|
||||
exptime = 5,
|
||||
boxsize = { x = 24, y = 0, z = 24 },
|
||||
vbox = 5,
|
||||
v_offset = -1,
|
||||
velocity = -0.1,
|
||||
acceleration = -0.03,
|
||||
expirationtime = 5,
|
||||
size = 0.8,
|
||||
texture = "weather_pollen.png"
|
||||
texture = "weather_pollen.png",
|
||||
glow = 2
|
||||
}
|
||||
|
||||
climate_api.register_weather(name, conditions, effects)
|
||||
|
@@ -17,14 +17,15 @@ effects["climate_api:sound"] = {
|
||||
}
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-9, y=8, z=-9},
|
||||
max_pos = {x= 9, y=6, z= 9},
|
||||
exptime = 1.1,
|
||||
boxsize = { x = 18, y = 2, z = 18 },
|
||||
v_offset = 6,
|
||||
expirationtime = 1.6,
|
||||
size = 2,
|
||||
amount = 15,
|
||||
falling_speed = 6,
|
||||
acceleration={x=0, y=-0.05, z=0},
|
||||
texture = "weather_raindrop.png"
|
||||
velocity = 6,
|
||||
acceleration = 0.05,
|
||||
texture = "weather_raindrop.png",
|
||||
glow = 5
|
||||
}
|
||||
|
||||
climate_api.register_weather(name, conditions, effects)
|
||||
|
@@ -10,24 +10,32 @@ local conditions = {
|
||||
|
||||
local effects = {}
|
||||
|
||||
effects["climate_api:skybox"] = {
|
||||
cloud_data = {
|
||||
color = "#5e676eb5"
|
||||
},
|
||||
priority = 11
|
||||
}
|
||||
|
||||
effects["climate_api:sound"] = {
|
||||
name = "weather_rain_heavy",
|
||||
gain = 1
|
||||
}
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-9, y=7, z=-9},
|
||||
max_pos = {x= 9, y=7, z= 9},
|
||||
falling_speed=7,
|
||||
amount=17,
|
||||
exptime=0.8,
|
||||
min_size=25,
|
||||
max_size=35,
|
||||
textures={
|
||||
boxsize = { x = 18, y = 0, z = 18 },
|
||||
v_offset = 7,
|
||||
velocity = 7,
|
||||
amount = 17,
|
||||
expirationtime = 1.2,
|
||||
minsize = 25,
|
||||
maxsize = 35,
|
||||
texture = {
|
||||
"weather_rain.png",
|
||||
"weather_rain.png",
|
||||
"weather_rain_medium.png"
|
||||
}
|
||||
},
|
||||
glow = 5
|
||||
}
|
||||
|
||||
climate_api.register_weather(name, conditions, effects)
|
||||
|
@@ -24,22 +24,28 @@ effects["climate_api:hud_overlay"] = {
|
||||
color_correction = true
|
||||
}
|
||||
|
||||
effects["regional_weather:damage"] = {
|
||||
effects["climate_api:damage"] = {
|
||||
chance = 3,
|
||||
value = 1
|
||||
value = 1,
|
||||
check = {
|
||||
type = "raycast",
|
||||
height = 0,
|
||||
velocity = 0.3
|
||||
}
|
||||
}
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-5, y=-4, z=-5},
|
||||
max_pos = {x= 5, y= 4.5, z= 5},
|
||||
falling_speed=1.2,
|
||||
acceleration={x=0,y=0.8,z=0},
|
||||
amount=40,
|
||||
exptime=1.8,
|
||||
size=20,
|
||||
textures={
|
||||
boxsize = { x = 8, y = 4.5, z = 8 },
|
||||
velocity = 0.6,
|
||||
acceleration = -0.2,
|
||||
amount = 12,
|
||||
expirationtime = 0.7,
|
||||
size = 25,
|
||||
texture = {
|
||||
"weather_sandstorm.png",
|
||||
"weather_sandstorm.png^[transformR180"
|
||||
"weather_sandstorm.png^[transformFY",
|
||||
"weather_sandstorm.png^[transformR180",
|
||||
"weather_sandstorm.png^[transformFYR180"
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,19 +11,20 @@ local conditions = {
|
||||
|
||||
local effects = {}
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-12, y=2, z=-12},
|
||||
max_pos = {x= 12, y=8, z= 12},
|
||||
amount = 4,
|
||||
exptime = 7,
|
||||
size = 1,
|
||||
falling_speed = 0.85,
|
||||
acceleration = {x=0, y=0.06, z=0},
|
||||
textures = {}
|
||||
}
|
||||
|
||||
local textures = {}
|
||||
for i = 1,12,1 do
|
||||
effects["climate_api:particles"].textures[i] = "weather_snowflake" .. i .. ".png"
|
||||
textures[i] = "weather_snowflake" .. i .. ".png"
|
||||
end
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
boxsize = { x = 24, y = 6, z = 24 },
|
||||
v_offset = 2,
|
||||
amount = 4,
|
||||
expirationtime = 7,
|
||||
velocity = 0.85,
|
||||
acceleration = -0.06,
|
||||
texture = textures,
|
||||
glow = 6
|
||||
}
|
||||
|
||||
climate_api.register_weather(name, conditions, effects)
|
||||
|
@@ -10,6 +10,13 @@ local conditions = {
|
||||
|
||||
local effects = {}
|
||||
|
||||
effects["climate_api:skybox"] = {
|
||||
cloud_data = {
|
||||
color = "#5e676eb5"
|
||||
},
|
||||
priority = 11
|
||||
}
|
||||
|
||||
effects["climate_api:hud_overlay"] = {
|
||||
file = "weather_hud_frost.png",
|
||||
z_index = -100,
|
||||
@@ -17,13 +24,14 @@ effects["climate_api:hud_overlay"] = {
|
||||
}
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-7, y=3, z=-7},
|
||||
max_pos = {x= 7, y=6, z= 7},
|
||||
exptime=7.5,
|
||||
size=15,
|
||||
amount=6,
|
||||
falling_speed = 0.75,
|
||||
texture="weather_snow.png"
|
||||
boxsize = { x = 14, y = 3, z = 14 },
|
||||
v_offset = 3,
|
||||
expirationtime = 7.5,
|
||||
size = 15,
|
||||
amount = 6,
|
||||
velocity = 0.75,
|
||||
texture = "weather_snow.png",
|
||||
glow = 6
|
||||
}
|
||||
|
||||
climate_api.register_weather(name, conditions, effects)
|
||||
|
Reference in New Issue
Block a user