mirror of
https://github.com/t-affeldt/regional_weather.git
synced 2025-07-28 13:20:38 +02:00
Separate weathers from engine
This commit is contained in:
36
ca_weathers/hail.lua
Normal file
36
ca_weathers/hail.lua
Normal file
@ -0,0 +1,36 @@
|
||||
local name = "regional_weather:hail"
|
||||
|
||||
local conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
max_heat = 45,
|
||||
min_humidity = 65,
|
||||
min_windspeed = 2.5
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
||||
effects["regional_weather:spawn_puddles"] = true
|
||||
effects["regional_weather:lightning"] = true
|
||||
effects["climate_api:damage"] = 1
|
||||
|
||||
effects["climate_api:sound"] = {
|
||||
name = "weather_hail",
|
||||
gain = 1
|
||||
}
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-9, y=7, z=-9},
|
||||
max_pos = {x= 9, y=7, z= 9},
|
||||
falling_speed=15,
|
||||
amount=5,
|
||||
exptime=0.8,
|
||||
size=1,
|
||||
textures = {}
|
||||
}
|
||||
|
||||
for i = 1,5,1 do
|
||||
effects["climate_api:particles"].textures[i] = "weather_hail" .. i .. ".png"
|
||||
end
|
||||
|
||||
climate_api.register_weather(name, conditions, effects)
|
24
ca_weathers/pollen.lua
Normal file
24
ca_weathers/pollen.lua
Normal file
@ -0,0 +1,24 @@
|
||||
local name = "regional_weather:pollen"
|
||||
|
||||
local conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_heat = 40,
|
||||
min_humidity = 30,
|
||||
max_humidity = 40,
|
||||
max_windspeed = 2
|
||||
}
|
||||
|
||||
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,
|
||||
amount=2,
|
||||
exptime=5,
|
||||
size=1,
|
||||
texture="weather_pollen.png"
|
||||
}
|
||||
|
||||
climate_api.register_weather(name, conditions, effects)
|
44
ca_weathers/rain.lua
Normal file
44
ca_weathers/rain.lua
Normal file
@ -0,0 +1,44 @@
|
||||
local name = "regional_weather:rain"
|
||||
|
||||
local conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_heat = 30,
|
||||
min_humidity = 40,
|
||||
max_humidity = 60
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
effects["regional_weather:spawn_puddles"] = true
|
||||
effects["regional_weather:wetten_farmland"] = true
|
||||
|
||||
effects["climate_api:sound"] = {
|
||||
name = "weather_rain",
|
||||
}
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-9, y=7, z=-9},
|
||||
max_pos = {x= 9, y=7, z= 9},
|
||||
exptime=0.8,
|
||||
size=1,
|
||||
texture = "weather_raindrop.png"
|
||||
}
|
||||
|
||||
local function generate_effects(params)
|
||||
local avg_humidity = 40
|
||||
local intensity = params.humidity / avg_humidity
|
||||
local override = {}
|
||||
|
||||
override["climate_api:sound"] = {
|
||||
gain = math.min(intensity, 1.2)
|
||||
}
|
||||
|
||||
override["climate_api:particles"] = {
|
||||
amount = 20 * math.min(intensity, 1.5),
|
||||
falling_speed = 10 / math.min(intensity, 1.3)
|
||||
}
|
||||
|
||||
return climate_api.utility.merge_tables(effects, override)
|
||||
end
|
||||
|
||||
climate_api.register_weather(name, conditions, generate_effects)
|
31
ca_weathers/rain_heavy.lua
Normal file
31
ca_weathers/rain_heavy.lua
Normal file
@ -0,0 +1,31 @@
|
||||
local name = "regional_weather:rain_heavy"
|
||||
|
||||
local conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_heat = 30,
|
||||
min_humidity = 60
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
||||
effects["regional_weather:spawn_puddles"] = true
|
||||
effects["regional_weather:wetten_farmland"] = true
|
||||
effects["regional_weather:lightning"] = true
|
||||
|
||||
effects["climate_api:sound"] = {
|
||||
name = "weather_rain",
|
||||
gain = 1
|
||||
}
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-9, y=7, z=-9},
|
||||
max_pos = {x= 9, y=7, z= 9},
|
||||
falling_speed=10,
|
||||
amount=20,
|
||||
exptime=0.8,
|
||||
size=25,
|
||||
texture="weather_rain.png"
|
||||
}
|
||||
|
||||
climate_api.register_weather(name, conditions, effects)
|
25
ca_weathers/sandstorm.lua
Normal file
25
ca_weathers/sandstorm.lua
Normal file
@ -0,0 +1,25 @@
|
||||
local name = "regional_weather:sandstorm"
|
||||
|
||||
local conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_heat = 50,
|
||||
max_humidity = 25,
|
||||
min_windspeed = 6
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
||||
effects["regional_weather:damage"] = true
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-9, y=-5, z=-9},
|
||||
max_pos = {x= 9, y= 5, z= 9},
|
||||
falling_speed=1,
|
||||
amount=40,
|
||||
exptime=0.8,
|
||||
size=15,
|
||||
texture="weather_sand.png"
|
||||
}
|
||||
|
||||
climate_api.register_weather(name, conditions, effects)
|
40
ca_weathers/snow.lua
Normal file
40
ca_weathers/snow.lua
Normal file
@ -0,0 +1,40 @@
|
||||
local name = "regional_weather:snow"
|
||||
|
||||
local conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
max_heat = 40,
|
||||
min_humidity = 40,
|
||||
max_humidity = 55
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
||||
effects["regional_weather:spawn_snow"] = true
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-20, y= 3, z=-20},
|
||||
max_pos = {x= 20, y=12, z= 20},
|
||||
exptime=8,
|
||||
size=1,
|
||||
textures = {}
|
||||
}
|
||||
|
||||
for i = 1,12,1 do
|
||||
effects["climate_api:particles"].textures[i] = "weather_snowflake" .. i .. ".png"
|
||||
end
|
||||
|
||||
local function generate_effects(params)
|
||||
local avg_humidity = 40
|
||||
local intensity = params.humidity / avg_humidity
|
||||
local override = {}
|
||||
|
||||
override["climate_api:particles"] = {
|
||||
amount = 50 * math.min(intensity, 1.5),
|
||||
falling_speed = 1 / math.min(intensity, 1.3)
|
||||
}
|
||||
|
||||
return climate_api.utility.merge_tables(effects, override)
|
||||
end
|
||||
|
||||
climate_api.register_weather(name, conditions, generate_effects)
|
39
ca_weathers/snow_heavy.lua
Normal file
39
ca_weathers/snow_heavy.lua
Normal file
@ -0,0 +1,39 @@
|
||||
local name = "regional_weather:snow_heavy"
|
||||
|
||||
local conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
max_heat = 40,
|
||||
min_humidity = 55
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
||||
effects["regional_weather:spawn_snow"] = true
|
||||
|
||||
effects["climate_api:particles"] = {
|
||||
min_pos = {x=-12, y= 5, z=-12},
|
||||
max_pos = {x= 12, y=9, z= 12},
|
||||
exptime=8,
|
||||
size=12,
|
||||
texture="weather_snow.png"
|
||||
}
|
||||
|
||||
local function generate_effects(params)
|
||||
local avg_humidity = 55
|
||||
local intensity = params.humidity / avg_humidity
|
||||
local override = {}
|
||||
|
||||
override["climate_api:sound"] = {
|
||||
gain = math.min(intensity, 1.2)
|
||||
}
|
||||
|
||||
override["climate_api:particles"] = {
|
||||
amount = 50 * math.min(intensity, 1.5),
|
||||
falling_speed = 1 / math.min(intensity, 1.3)
|
||||
}
|
||||
|
||||
return climate_api.utility.merge_tables(effects, override)
|
||||
end
|
||||
|
||||
climate_api.register_weather(name, conditions, generate_effects)
|
27
ca_weathers/storm.lua
Normal file
27
ca_weathers/storm.lua
Normal file
@ -0,0 +1,27 @@
|
||||
local name = "regional_weather:storm"
|
||||
|
||||
local conditions = {
|
||||
min_height = regional_weather.settings.min_height,
|
||||
max_height = regional_weather.settings.max_height,
|
||||
min_windspeed = 3.5
|
||||
}
|
||||
|
||||
local effects = {}
|
||||
|
||||
effects["climate_api:sound"] = {
|
||||
name = "weather_wind"
|
||||
}
|
||||
|
||||
local function generate_effects(params)
|
||||
local avg_windspeed = 5
|
||||
local intensity = params.windspeed / avg_windspeed
|
||||
local override = {}
|
||||
|
||||
override["climate_api:sound"] = {
|
||||
gain = math.min(intensity, 1.2)
|
||||
}
|
||||
|
||||
return climate_api.utility.merge_tables(effects, override)
|
||||
end
|
||||
|
||||
climate_api.register_weather(name, conditions, generate_effects)
|
24
ca_weathers/wind.lua
Normal file
24
ca_weathers/wind.lua
Normal file
@ -0,0 +1,24 @@
|
||||
local name = "regional_weather:wind"
|
||||
|
||||
local CLOUD_SPEED_MULTIPLICATOR = 1.8
|
||||
|
||||
local conditions = {}
|
||||
|
||||
local function generate_effects(params)
|
||||
local override = {}
|
||||
|
||||
override["climate_api:skybox"] = {
|
||||
clouds_data = {
|
||||
speed = params.state.wind * CLOUD_SPEED_MULTIPLICATOR
|
||||
}
|
||||
}
|
||||
|
||||
local movement_direction = vector.normalize(params.player:get_player_velocity())
|
||||
local vector_product = vector.dot(movement_direction, params.state.wind)
|
||||
local movement_penalty = climate_api.utility.logistic_growth(vector_product, 1.6, 0.15, 0.8) + 0.1
|
||||
override["regional_weather:speed_buff"] = movement_penalty
|
||||
|
||||
return override
|
||||
end
|
||||
|
||||
climate_api.register_weather(name, conditions, generate_effects)
|
Reference in New Issue
Block a user