# Weather by world (design section 3, "Weather and hazards"; read by src/world/terrain/Weather.cpp).
#
# Not generation: weather is worked out from the planet, a position and the world clock. Nothing
# about it is saved or sent, so a value here can change between updates without touching a sample
# hash in generation.txt.
#
# A planet takes the first row, in file order, whose planet fields all hold: pressure (atm),
# water, toxicity and volcanism (0..1), mean temp (the sea-level mean, C) and sea (Water, Acid,
# Lava, Methane, None or any). A row without planet fields is never picked by a planet: it is
# another row's storm or other. Clear is what is left when nothing falls, and its values are the
# clear air's.
#
# At a spot, `spot temp` is the local air temperature the row falls in; outside it the `other`
# row falls instead (rain turns to snow in the cold). Past `storm at` strength, where the spot is
# at least `storm temp` warm, the `storm` row takes over, or the row shows its `storm name`.
#
# The weather field is clouds.glsl's cloudWeather (0..1): weather systems kilometres across, carried
# round the planet by the wind. A row with `clouds = yes` falls from the clouds: it needs them
# overhead, and its field is the one that builds the storms (cloudWeather plus 0.6 of the cover
# above a half, so a cloudier world is stormier). It starts at
# `starts` and reaches full strength at `full`. Effects are at full strength and fade in with it:
# temp (C added to the air), visibility (m), wind (times the planet's steady wind) and gusts (their
# swing, as a share of the wind).
#
# How it looks and sounds. `particles` (streak, flake or speck) fall as chunky pixels in a box
# around the camera, `size` chunky pixels on a side (under 1 for finer pixels than the blocks'), each in a colour from `palette` (sRGB), `count`
# of the particle budget at full strength, falling at `fall` m/s before the wind carries them; a
# streak is `streak` seconds of fall long. `haze` is the fog's colour, and the fog is as thick as the
# visibility says. `splash` is the share of the particles that land: drops thrown up `bounce` m/s off
# the ground and the roofs, or with no bounce, flakes settling there a moment. `darken` is the share of the sun and sky light the weather takes at full strength,
# and `lightning` the strikes per square km per minute. Weather that falls from clouds builds its
# own: a little before it starts, the clouds over it fill in to a thick deck the height of the
# layer, turning `cloud` (sRGB) in the thick of it (the storm row's colour where there is one). `bed`, `storm bed` and `roof bed` are the
# sound beds (assets/audio) in the open, past the storm strength, and under a roof.
#
# Fog: `fog` names the row that rolls in where this one isn't falling. A fog row has no planet
# fields and reads a field of its own, so its banks drift apart from the storms: it starts at
# `starts` and is full at `full` there, where the spot's moisture (0..1) is in `spot moisture` and
# its air in `spot temp`. It lies low: it thins out from half of `lies` m over the ground to none at
# `lies`, and the sun high in the sky burns it off down to `noon` of it.
#
# What it does. `solar` is the share of sunlight solar panels still get at full strength (Clear's:
# under a full cloud deck). `acid` is the damage a second at full strength to anyone under open
# sky without a sealed suit. `waters` waters planters under open sky as a vaporator does, and
# `spoils` ruins their crop. From `rest` strength on, animals bed down until it passes.

[weather Clear]
visibility = 6000
wind = 1
gusts = 0.35
solar = 0.45

# Toxic air rains acid, whatever else it could do.
[weather AcidRain]
name = ACID RAIN
storm name = ACID STORM
pressure = 0.15 .. 100
toxicity = 0.35 .. 1
clouds = yes
starts = 0.55
full = 0.78
storm at = 0.7
temp = -2
visibility = 350
wind = 2.5
gusts = 0.7
particles = streak
palette = #c3d07a, #aebd62, #d6df96
count = 0.8
fall = 10
streak = 0.035
haze = #9a9f6a
darken = 0.45
splash = 0.25
bounce = 1.6
cloud = #8a8758
bed = amb/acid_rain
storm bed = amb/acid_rain
roof bed = amb/rain_roof
solar = 0.55
spoils = yes
acid = 6
rest = 0.5

# Cold worlds with methane seas.
[weather MethaneSleet]
name = METHANE SLEET
storm name = SLEET STORM
pressure = 0.15 .. 100
sea = Methane
clouds = yes
starts = 0.55
full = 0.78
storm at = 0.75
temp = -12
visibility = 220
wind = 2.5
gusts = 0.7
particles = speck
palette = #c9e4ea, #a9cfd8, #e6f4f6
count = 0.9
fall = 7
streak = 0.02
haze = #9fbcc4
darken = 0.4
splash = 0.25
bounce = 2.4
cloud = #8ea4aa
bed = amb/methane_sleet
storm bed = amb/methane_sleet
roof bed = amb/rain_roof
solar = 0.55
rest = 0.6

# Volcanic worlds: ash from the vents, which darkens the sky.
[weather AshFall]
name = ASH FALL
storm name = ASH STORM
pressure = 0.03 .. 100
volcanism = 0.6 .. 1
clouds = no
starts = 0.6
full = 0.8
storm at = 0.8
temp = 3
visibility = 180
wind = 1.6
gusts = 0.5
particles = flake
palette = #8a847e, #a39b94, #6f6964
count = 0.7
fall = 0.9
haze = #5a4436
darken = 0.5
splash = 0.1
bounce = 0
bed = amb/ash_fall
storm bed = amb/ash_fall
roof bed = amb/wind_muffled
size = 2
solar = 0.2
rest = 0.6

# Dry worlds with dusty skies.
[weather DustStorm]
name = DUST
storm name = DUST STORM
pressure = 0.03 .. 100
water = 0 .. 0.25
clouds = no
starts = 0.6
full = 0.82
storm at = 0.6
temp = 2
visibility = 90
wind = 4
gusts = 0.8
particles = speck
size = 0.5
streak = 0.06
palette = #d2aa76, #b98d5a, #e3c08e
count = 1
fall = 0.5
haze = #a9825a
darken = 0.5
splash = 0.15
bounce = 0.4
bed = amb/dust_light
storm bed = amb/dust_storm
roof bed = amb/wind_muffled
solar = 0.12
rest = 0.5

# Cold worlds with water. A strong fall is a blizzard.
[weather Snow]
name = SNOW
storm name = BLIZZARD
pressure = 0.15 .. 100
water = 0.15 .. 1
mean temp = -400 .. -2
spot temp = -400 .. 1.5
other = Rain
fog = Fog
clouds = yes
starts = 0.55
full = 0.8
storm at = 0.72
temp = -8
visibility = 40
wind = 3
gusts = 0.8
particles = flake
palette = #f4f7fb, #dfe7f0, #ffffff
count = 0.8
fall = 1.4
haze = #c8d2dc
darken = 0.25
splash = 0.12
bounce = 0
cloud = #b9c1cb
bed = amb/snow_light
storm bed = amb/blizzard
roof bed = amb/wind_muffled
size = 2
solar = 0.6
rest = 0.75

# Worlds with water and mild air. Under tall clouds on warm ground it is a thunderstorm.
[weather Rain]
name = RAIN
storm name = HEAVY RAIN
pressure = 0.15 .. 100
water = 0.15 .. 1
mean temp = -2 .. 90
spot temp = 0.5 .. 400
other = Snow
storm = Thunderstorm
fog = Fog
storm temp = 12
clouds = yes
starts = 0.55
full = 0.8
storm at = 0.7
temp = -3
visibility = 1500
wind = 1.8
gusts = 0.6
particles = streak
palette = #9fb4c8, #b7c8d8, #8aa0b6
count = 0.7
fall = 11
streak = 0.04
haze = #8d98a4
darken = 0.35
splash = 0.25
bounce = 1.6
cloud = #8f97a1
bed = amb/rain_light
storm bed = amb/rain_heavy
roof bed = amb/rain_roof
solar = 0.7
waters = yes
rest = 0.85

[weather Thunderstorm]
name = THUNDERSTORM
clouds = yes
starts = 0.55
full = 0.8
temp = -5
visibility = 450
wind = 3.5
gusts = 0.9
particles = streak
palette = #8fa3b8, #a6b8ca, #7a8ea4
count = 1
fall = 14
streak = 0.05
haze = #6c7480
darken = 0.65
splash = 0.3
bounce = 2.0
cloud = #343941
lightning = 0.08
bed = amb/rain_heavy
storm bed = amb/rain_heavy
roof bed = amb/rain_roof
solar = 0.4
waters = yes
rest = 0.55

# Every other world with air: only the wind, which rises to a gale under the strongest weather.
[weather Wind]
name = WINDY
storm name = GALE
pressure = 0.03 .. 1000
clouds = no
starts = 0.62
full = 0.85
storm at = 0.6
temp = -2
visibility = 3000
wind = 4
gusts = 0.9
particles = speck
palette = #8a8070, #9a9080, #776e60
count = 0.12
fall = 0.3
haze = #a0a0a0
darken = 0.15
bed = amb/wind_gusts
storm bed = amb/gale
roof bed = amb/wind_muffled
solar = 0.9
rest = 0.8

# Thick fog on wet worlds, in the calm between their rains and snows: banks of it in damp
# lowlands, thickest by night and at dawn, thinning as the sun climbs and as you climb out of it.
[weather Fog]
name = FOG
spot temp = -10 .. 32
clouds = no
starts = 0.6
full = 0.72
spot moisture = 0.3 .. 0.6
lies = 90
noon = 0.4
temp = -1
visibility = 30
wind = 0.25
gusts = 0.15
particles = speck
size = 0.5
palette = #dfe5ea, #cdd5dc, #eef2f5
count = 0.06
fall = 0.12
haze = #b4bcc3
darken = 0.25
solar = 0.55

# The most particles a storm draws, and the box they fall in around the camera (m on a side).
[particles Budget]
count = 12000
box = 40

# What a lightning strike does: `block` damage to the block it hits (30 is a second of bare-hand
# mining, so it breaks soil, wood and most rock but only marks a hull), and `hurt` to anyone under
# open sky within `reach` m of it.
[lightning Strike]
block = 60
hurt = 35
reach = 2.5

# Light shafts (step 32b): sunlight seen as smooth beams in the air below the clouds, where the sun
# breaks through their gaps. `strength` is how bright they are under a broken sky; haze and dust
# add up to `haze` times as much (at no visibility), wet air after rain up to `wet` times; `g`
# (0 to 0.95) is how tight the sun's glow they carry is. Only a broken sky shows them: none under
# a clear sky or a full deck.
[shafts Light]
strength = 0.9
haze = 1.5
wet = 0.75
g = 0.85

# Day and night: the whole swing between noon and midnight, airless, halved by every `half
# pressure` atm of air; a coast (within `sea reach` m of sea level on a world with a sea) loses
# `sea` of it, and wet air up to `moisture` of it. The temperature has swung all the way out once
# the sun is `dawn` (the sine of its height) above or below the horizon, and the swing fades out
# underground between `cave depth` and `cave full` m down.
[daynight Swing]
airless = 150
half pressure = 0.12
sea = 0.5
sea reach = 40
moisture = 0.3
dawn = 0.3
cave depth = 4
cave full = 24

# Auroras (sky.frag: auroraGlow): curtains of light round both poles, high above the clouds, seen
# at night. A world with air has one at `chance` ([auroras Planets]) unless its living theme says
# otherwise (planets.txt `aurora`). Its colours are an [aurora] row picked by weight, in file
# order: `low` at the curtains' foot and `high` at their top (sRGB), and a `shifting` one drifts
# slowly through the hues. Most are the usual green with a red fringe; the rest are rare.
[auroras Planets]
chance = 0.12

[aurora Green]
weight = 60
low = #3dff7a
high = #ff3b5c

[aurora Emerald]
weight = 20
low = #45ff9a
high = #2bd9b0

[aurora Crimson]
weight = 6
low = #ff3046
high = #ff7aa8

[aurora Violet]
weight = 5
low = #b45bff
high = #ff5ad2

[aurora Blue]
weight = 4
low = #4a7dff
high = #9a6bff

[aurora TealGold]
weight = 3
low = #33ffd6
high = #ffd24a

[aurora Shifting]
weight = 2
low = #3dff7a
high = #b45bff
shifting = yes
