mirror of
https://github.com/t-affeldt/climate_api.git
synced 2025-07-14 14:30:24 +02:00
Replace weather types with stackable effects
This commit is contained in:
@ -1,12 +0,0 @@
|
||||
local name = weather_mod.modname .. ":clear"
|
||||
|
||||
local weather = {
|
||||
priority = 0
|
||||
}
|
||||
|
||||
weather.clouds = {
|
||||
density = 0.3,
|
||||
color = "#fff0f0c5"
|
||||
}
|
||||
|
||||
weather_mod.register_weather(name, weather)
|
@ -1,30 +1,48 @@
|
||||
local name = weather_mod.modname .. ":rain"
|
||||
|
||||
local weather = {
|
||||
priority = 10,
|
||||
local config = {}
|
||||
|
||||
config.environment = {
|
||||
spawn_puddles = true,
|
||||
wetten_farmland = true,
|
||||
sound = "weather_rain1"
|
||||
wetten_farmland = true
|
||||
}
|
||||
|
||||
weather.particles = {
|
||||
config.sound = {
|
||||
name = "weather_rain",
|
||||
gain = 1
|
||||
}
|
||||
|
||||
config.particles = {
|
||||
min_pos = {x=-9, y=7, z=-9},
|
||||
max_pos = {x= 9, y=7, z= 9},
|
||||
falling_speed=10,
|
||||
amount=20,
|
||||
amount=40,
|
||||
exptime=0.8,
|
||||
size=25,
|
||||
texture="weather_rain.png"
|
||||
size=1,
|
||||
texture = "weather_raindrop.png"
|
||||
}
|
||||
|
||||
weather.clouds = {
|
||||
density = 0.5,
|
||||
color = "#a4a0b6e5"
|
||||
}
|
||||
|
||||
weather.conditions = {
|
||||
config.conditions = {
|
||||
min_height = weather_mod.settings.min_height,
|
||||
max_height = weather_mod.settings.max_height,
|
||||
min_heat = 30,
|
||||
min_humidity = 40
|
||||
min_humidity = 40,
|
||||
max_humidity = 60
|
||||
}
|
||||
|
||||
weather_mod.register_weather(name, weather)
|
||||
local function override(params)
|
||||
local avg_humidity = 40
|
||||
local intensity = params.humidity / avg_humidity
|
||||
local dynamic_config = {
|
||||
sound = {
|
||||
gain = math.min(intensity, 1.2)
|
||||
},
|
||||
particles = {
|
||||
amount = 20 * math.min(intensity, 1.5),
|
||||
falling_speed = 10 / math.min(intensity, 1.3)
|
||||
}
|
||||
}
|
||||
return dynamic_config
|
||||
end
|
||||
|
||||
weather_mod.register_effect(name, config, override)
|
||||
|
33
weathers/rain_heavy.lua
Normal file
33
weathers/rain_heavy.lua
Normal file
@ -0,0 +1,33 @@
|
||||
local name = weather_mod.modname .. ":rain_heavy"
|
||||
|
||||
local config = {}
|
||||
|
||||
config.environment = {
|
||||
spawn_puddles = true,
|
||||
wetten_farmland = true,
|
||||
lightning = true
|
||||
}
|
||||
|
||||
config.sound = {
|
||||
name = "weather_rain",
|
||||
gain = 1
|
||||
}
|
||||
|
||||
config.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"
|
||||
}
|
||||
|
||||
config.conditions = {
|
||||
min_height = weather_mod.settings.min_height,
|
||||
max_height = weather_mod.settings.max_height,
|
||||
min_heat = 30,
|
||||
min_humidity = 60
|
||||
}
|
||||
|
||||
weather_mod.register_effect(name, config)
|
@ -1,33 +0,0 @@
|
||||
local name = weather_mod.modname .. ":rainstorm"
|
||||
|
||||
local weather = {
|
||||
priority = 30,
|
||||
damage = true,
|
||||
spawn_puddles = true,
|
||||
wetten_farmland = true,
|
||||
lightning = true,
|
||||
sound = "weather_rain2"
|
||||
}
|
||||
|
||||
weather.particles = {
|
||||
min_pos = {x=-9, y=7, z=-9},
|
||||
max_pos = {x= 9, y=7, z= 9},
|
||||
falling_speed=10,
|
||||
amount=25,
|
||||
exptime=0.8,
|
||||
size=25,
|
||||
texture="weather_rain.png"
|
||||
}
|
||||
|
||||
weather.clouds = {
|
||||
density = 0.7,
|
||||
color = "#a4a0b6f5"
|
||||
}
|
||||
|
||||
weather.conditions = {
|
||||
min_heat = 30,
|
||||
min_humidity = 60,
|
||||
min_windspeed = 5
|
||||
}
|
||||
|
||||
weather_mod.register_weather(name, weather)
|
@ -1,12 +1,12 @@
|
||||
local name = weather_mod.modname .. ":sandstorm"
|
||||
|
||||
local weather = {
|
||||
priority = 50,
|
||||
damage = true,
|
||||
sound = "weather_wind"
|
||||
local config = {}
|
||||
|
||||
config.environment = {
|
||||
damage = true
|
||||
}
|
||||
|
||||
weather.particles = {
|
||||
config.particles = {
|
||||
min_pos = {x=-9, y=-5, z=-9},
|
||||
max_pos = {x= 9, y= 5, z= 9},
|
||||
falling_speed=1,
|
||||
@ -16,15 +16,12 @@ weather.particles = {
|
||||
texture="weather_sand.png"
|
||||
}
|
||||
|
||||
weather.clouds = {
|
||||
density = 0.3,
|
||||
color = "#a4a0b685"
|
||||
}
|
||||
|
||||
weather.conditions = {
|
||||
config.conditions = {
|
||||
min_height = weather_mod.settings.min_height,
|
||||
max_height = weather_mod.settings.max_height,
|
||||
min_heat = 50,
|
||||
max_humidity = 25,
|
||||
min_windspeed = 6
|
||||
}
|
||||
|
||||
weather_mod.register_weather(name, weather)
|
||||
weather_mod.register_effect(name, config)
|
||||
|
@ -1,32 +1,46 @@
|
||||
local name = weather_mod.modname .. ":snow"
|
||||
|
||||
local weather = {
|
||||
priority = 20,
|
||||
local config = {}
|
||||
|
||||
config.environment = {
|
||||
spawn_snow = true
|
||||
}
|
||||
|
||||
weather.particles = {
|
||||
config.particles = {
|
||||
min_pos = {x=-20, y= 3, z=-20},
|
||||
max_pos = {x= 20, y=12, z= 20},
|
||||
falling_speed=1,
|
||||
amount=50,
|
||||
exptime=15,
|
||||
amount=40,
|
||||
exptime=8,
|
||||
size=1,
|
||||
textures = {}
|
||||
}
|
||||
|
||||
for i = 1,12,1 do
|
||||
weather.particles.textures[i] = "weather_snowflake" .. i .. ".png"
|
||||
config.particles.textures[i] = "weather_snowflake" .. i .. ".png"
|
||||
end
|
||||
|
||||
weather.clouds = {
|
||||
density = 0.5,
|
||||
color = "#a4a0b6e5"
|
||||
config.conditions = {
|
||||
min_height = weather_mod.settings.min_height,
|
||||
max_height = weather_mod.settings.max_height,
|
||||
max_heat = 40,
|
||||
min_humidity = 40,
|
||||
max_humidity = 55
|
||||
}
|
||||
|
||||
weather.conditions = {
|
||||
max_heat = 30,
|
||||
min_humidity = 40
|
||||
}
|
||||
local function override(params)
|
||||
local avg_humidity = 40
|
||||
local intensity = params.humidity / avg_humidity
|
||||
local dynamic_config = {
|
||||
sound = {
|
||||
gain = math.min(intensity, 1.2)
|
||||
},
|
||||
particles = {
|
||||
amount = 50 * math.min(intensity, 1.5),
|
||||
falling_speed = 1 / math.min(intensity, 1.3)
|
||||
}
|
||||
}
|
||||
return dynamic_config
|
||||
end
|
||||
|
||||
weather_mod.register_weather(name, weather)
|
||||
weather_mod.register_effect(name, config, override)
|
||||
|
41
weathers/snow_heavy.lua
Normal file
41
weathers/snow_heavy.lua
Normal file
@ -0,0 +1,41 @@
|
||||
local name = weather_mod.modname .. ":snow_heavy"
|
||||
|
||||
local config = {}
|
||||
|
||||
config.environment = {
|
||||
spawn_snow = true
|
||||
}
|
||||
|
||||
config.particles = {
|
||||
min_pos = {x=-12, y= 5, z=-12},
|
||||
max_pos = {x= 12, y=9, z= 12},
|
||||
falling_speed=1,
|
||||
amount=1,
|
||||
exptime=8,
|
||||
size=12,
|
||||
texture="weather_snow.png"
|
||||
}
|
||||
|
||||
config.conditions = {
|
||||
min_height = weather_mod.settings.min_height,
|
||||
max_height = weather_mod.settings.max_height,
|
||||
max_heat = 40,
|
||||
min_humidity = 55
|
||||
}
|
||||
|
||||
local function override(params)
|
||||
local avg_humidity = 55
|
||||
local intensity = params.humidity / avg_humidity
|
||||
local dynamic_config = {
|
||||
sound = {
|
||||
gain = math.min(intensity, 1.2)
|
||||
},
|
||||
particles = {
|
||||
amount = 50 * math.min(intensity, 1.5),
|
||||
falling_speed = 1 / math.min(intensity, 1.3)
|
||||
}
|
||||
}
|
||||
return dynamic_config
|
||||
end
|
||||
|
||||
weather_mod.register_effect(name, config, override)
|
@ -1,36 +0,0 @@
|
||||
local name = weather_mod.modname .. ":snowstorm"
|
||||
|
||||
local weather = {
|
||||
priority = 40,
|
||||
damage = true,
|
||||
lightning = true,
|
||||
spawn_snow = true,
|
||||
sound = "weather_wind"
|
||||
}
|
||||
|
||||
weather.particles = {
|
||||
min_pos = {x=-9, y=-5, z=-9},
|
||||
max_pos = {x= 9, y= 5, z= 9},
|
||||
falling_speed=1.5,
|
||||
amount=70,
|
||||
exptime=6,
|
||||
size=1,
|
||||
textures = {}
|
||||
}
|
||||
|
||||
for i = 1,12,1 do
|
||||
weather.particles.textures[i] = "weather_snowflake" .. i .. ".png"
|
||||
end
|
||||
|
||||
weather.clouds = {
|
||||
density = 0.7,
|
||||
color = "#a4a0b6f5"
|
||||
}
|
||||
|
||||
weather.conditions = {
|
||||
max_heat = 30,
|
||||
min_humidity = 60,
|
||||
min_windspeed = 5
|
||||
}
|
||||
|
||||
weather_mod.register_weather(name, weather)
|
27
weathers/storm.lua
Normal file
27
weathers/storm.lua
Normal file
@ -0,0 +1,27 @@
|
||||
local name = weather_mod.modname .. ":storm"
|
||||
|
||||
local config = {}
|
||||
|
||||
config.sound = {
|
||||
name = "weather_wind",
|
||||
gain = 1
|
||||
}
|
||||
|
||||
config.conditions = {
|
||||
min_height = weather_mod.settings.min_height,
|
||||
max_height = weather_mod.settings.max_height,
|
||||
min_windspeed = 5
|
||||
}
|
||||
|
||||
local function override(params)
|
||||
local avg_windspeed = 6
|
||||
local intensity = params.windspeed / avg_windspeed
|
||||
local dynamic_config = {
|
||||
sound = {
|
||||
gain = math.min(intensity, 1.2)
|
||||
}
|
||||
}
|
||||
return dynamic_config
|
||||
end
|
||||
|
||||
weather_mod.register_effect(name, config, override)
|
Reference in New Issue
Block a user