BingBong Airlines FLIGHT TFA · TRUE FINAL ASCENT
PEAK

True Final Ascent Mod

For moddersTFA Weather API
APIv1

Use TFA's weathers in your mod

True Final Ascent brings 28 weathers of its own: storms, fogs, a blood moon, an earthquake, a flash flood you can swim in, a tsunami, a volcanic eruption and more. With TfaWeather your mod starts and stops them in any run, Apocalypse mode or not, picks how hard they play and sets single values.

  • Start and stop any of the 28 weathers, for as long as you like.
  • Pick the difficulty. Tier 1-5 plays a weather like TFA's Apocalypse levels Relaxed, Normal, Hard, Brutal or Nightmare. Your players don't need Apocalypse mode for that, and their Apocalypse setting stays untouched.
  • Set single values. Every weather has named values - the storm's push, the flood's water level and air, the blood moon's pack size. You set them with With(name, value). Each one overrides the tier for that one number.
  • Follow the weather on every player through Current, ModWeather and the Changed event, in every mode.
  • The host decides. Make the same call on every player. Only the host's call does something; TFA brings the weather with its tier and values to everyone, late joiners included.
  • Next to TFA's dice. In Apocalypse mode your weather runs alongside TFA's own. Where the two collide, yours takes over.
  • One mod weather at a time. The API slot is shared by all mods: whoever starts a weather owns it; you can only change or stop your own, and another mod gets Busy until yours ends.

Setup

Reference TFA as for the biome API (TrueFinalAscent.dll, Private=false; see the Biomes tab) and declare a soft dependency. Touch TfaWeather only when TFA is installed and new enough: TFA 2.10.0 is the first version with it. On an older TFA the type is missing, and the first touch throws.

<Reference Include="TrueFinalAscent">
  <HintPath>...\BepInEx\plugins\CptPICHU-TrueFinalAscent\TrueFinalAscent.dll</HintPath>
  <Private>false</Private>
</Reference>
using System;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Bootstrap;

[BepInPlugin("you.crystalcaves", "Crystal Caves", "1.0.0")]
[BepInDependency("com.CptPICHU.peak.truefinalascent", BepInDependency.DependencyFlags.SoftDependency)]
public class CrystalCavesPlugin : BaseUnityPlugin
{
    internal static bool TfaWeatherReady;

    private void Awake()
    {
        // Touch TfaWeather only when TFA 2.10.0 or newer is installed: on an older TFA the type is missing, and the first
        // touch throws. Without TFA your mod keeps working as before.
        if (Chainloader.PluginInfos.TryGetValue("com.CptPICHU.peak.truefinalascent", out PluginInfo tfa)
            && tfa.Metadata.Version >= new Version(2, 10, 0))
        {
            TfaWeatherReady = TfaWeatherBridge.ApiLevel() >= 1;
        }
    }
}

internal static class TfaWeatherBridge
{
    // In its own class and never inlined: otherwise .NET may resolve TFA's type when Awake compiles, before your check runs.
    [MethodImpl(MethodImplOptions.NoInlining)]
    internal static int ApiLevel() => TrueFinalAscent.Api.TfaWeather.ApiVersion;
}

Reading ApiVersion in Awake also tells TFA that a mod uses its weather. When that happens on the host's machine, TFA loads the heavy weathers (blood moon creatures, tsunami, avalanche, volcano, the darkness hunt) at the start of every run, so they are ready on all players before you start one.

Quick start

using TrueFinalAscent.Api;

// On every player. On the host it starts 60 s of rain; on guests it returns NotHost, and the host's rain reaches them.
TfaWeather.Start("crystalcaves", "rain", new TfaWeatherParams { Seconds = 60f });

// The same rain on Hard, but nobody slips: the tier sets everything, the value overrides one number.
TfaWeather.Start("crystalcaves", "rain", new TfaWeatherParams { Seconds = 60f, Tier = 3 }.With("slip", 0f));

// Later, also on every player: stops the weather "crystalcaves" started.
TfaWeather.Stop("crystalcaves");

The first argument is your owner id: 2-24 lowercase letters or digits - the same rule as a biome id, so a biome mod uses its biome id. TFA uses it to know whose weather runs.

Start and Stop return what happened (see TfaWeatherResult). Only Started, Updated and Stopped changed anything; every other result leaves the weather as it was and writes one log line that says why (the same case at most once every 10 s).

Rules

Where it runs

RunYour weather
Normal run, Builder, custom runRuns. TFA starts no weather of its own there, so the weather is yours.
Apocalypse modeRuns next to TFA's dice: two weathers can run at once, one of the dice and one of yours. Where the two collide, yours takes over. See Next to TFA's dice.
Airport (lobby)Runs too, just for fun: the hall is the stage. What needs the mountain does its best around the players (see Anywhere, any time). PEAK itself lets no status through in the airport - no injury, cold, heat or drowsiness - so weathers there throw, drop and scare, but don't hurt. A weather started there ends when the run loads.
Daily mapNotAllowed. The daily map is never changed. In a biome, start only when slot.OwnWeatherAllowed is true (see the Biomes tab); it is false there.
Title screen, loading, a lost run, the end screen after a winNotAllowed. A weather that already runs follows the rules under Multiplayer.

Anywhere, any time

Your calls ignore the rules TFA's dice follow. There is no check of place, biome, time of day, mode or run setting: any of the 28 weathers runs in any stage (mod biomes and the Builder included), on PEAK's own maps, in cactus-ball mode and with the Scoutmaster switched off for the run. The result codes WrongTime and Unavailable are never returned any more.

  • Time of day. A night weather (blood, moon) started by day moves the clock to midnight while it runs, a day weather (sun, petrify) started at night moves it to noon. The weather holds the clock and gives it back when it ends. The blizzard (snow) never moves the clock.
  • Scoutmaster. watch and dark: the host brings a Scoutmaster even if the run has none, and the watch no longer sleeps in the Kiln, Gloom, Citadel and Nadir.
  • No mountain to aim at. Without a Kiln the volcano erupts ahead of the group; the avalanche, the flash flood and the tsunami aim at the players when there is no campfire. What each weather does without the mountain - and in the airport - is listed below.
WeatherWithout the mountain, in the airport
stormWorks everywhere. In the airport without flying wind streaks (haze, sky, push and sound only).
rainWorks everywhere. The wet-ground sheen needs PEAK's rain rig on the map (not in the airport).
snowAny biome, any time of day; never moves the clock. In the airport shelter is decided by sky rays.
thunderWorks everywhere. In the airport strikes land on any solid ground, and the roof and rock checks only see Terrain/Map, so bolts may hit players indoors. The lightning-rod badge counts only in runs.
sunMoves the clock to noon. In the airport it only shows: PEAK blocks heat there.
petrifyMoves the clock to noon. In the airport it only shows: PEAK blocks the stone there.
moonMoves the clock to midnight. In the airport there is no roof protection.
bloodMoves the clock to midnight. The creatures come from the map's templates; in the airport only Shroom Zombies come (if they can be loaded), the red sky always runs.
sleepfogWorks everywhere. In the airport there is no Gloom lighting, only the tint and the fog layer; Early Worms land on visible floor near the players.
icefogWhere PEAK's fog sphere is missing (airport, runs with fog off) the bubble works without its fog; the particle wall marks the edge.
sporesZombies rise wherever the cloud ends (airport included), but not if a scene change ended it.
poisonThe blast shrooms need the mountain's templates; in the airport they only grow if a poison fog ran in a run earlier this session.
wispsCount, gifts and lights work everywhere; in the airport the wisps spawn near the players, in their line of sight.
shroomrainWorks everywhere. In the airport: berry rain, final burst and size phase, but no bounce mushrooms.
cactusrainWorks in cactus-ball mode (no extra ball phase afterwards). In the airport: balls only, no cacti and no scorpion.
foodfrenzyWorks everywhere. In the airport: hunger and food rain, no garden.
floorlavaWorks everywhere. In the airport the hall floor, the tarmac and the airstrip glow; furniture is safe ground.
darkWorks anywhere; the host brings a Scoutmaster even if the run has none. In the airport the hunt ends with the throw or the lamp, and the music is muted.
watchWorks anywhere and ignores the place; the host brings a Scoutmaster even if the run has none. In the airport he leaps to floor spots near the players; the Nightmare sky needs a Nadir.
antigravWorks anywhere; indoors (airport hall) players rise to the roof. On Nightmare touching a ceiling hurts, but not in the airport, where PEAK blocks all status.
quakeWorks anywhere, airport included; airborne players (3 m and more above the ground) are spared.
floodWithout Level and without a campfire to aim at (airport), the host fixes the level at the start: 3 units above the lowest living player.
tsunamiThe wave crosses along the world X axis past the group. Without a campfire the water behind it stands 2 units above the lowest player.
avalancheStarts behind the next campfire; without one it starts ahead of the group (airport: along the hall). Snow or dust follows the biome, or snow.
volcanoWithout a Kiln it erupts about 250 m ahead of the group; rocks, bang, ash and tiers work as usual. In the airport rocks only knock players down.
shockfrostWorks everywhere, in normal runs and the airport too. Lava and water turn to ice where the stage has them; the ice look, slipping, cold, frozen items and traps work anywhere. The thaw takes 3 s after Stop, and lava and water stay solid until then.

What wins

For every number a weather uses, TFA looks in this order:

  1. Harm = false - the weather hurts nobody, whatever else you set.
  2. Your value, if you set one with With(name, value).
  3. Your Tier.
  4. No Tier set: in Apocalypse mode the level of the run (without the ghosts' vote), everywhere else Normal.

Tier and values only touch your weather. A dice weather next to yours keeps the run's level; the players' Apocalypse level and TFA's statistics stay as they are.

Live or start. Call Start again with the same owner and weather to change it while it runs. Values marked live in the catalogue apply at once (Updated); the host has them immediately, guests within a second. Values marked start and Seconds and Warn only apply to a fresh start; if only those changed, you get Unchanged and a log line - stop and start again. Tier, Sound, Harm and Level are live; a few things a weather decides once at its start (how many wisps appear, the flashlight battery) keep their start value. A call sets your tier, Sound, Harm and live values as a whole: one you leave out falls back to its default.

Aftermath counts. What a weather leaves behind when it ends (spore zombies, blast shrooms, the shroom finale, the rolling cactus balls, the food that keeps falling, the draining water) plays with your tier and values too, for up to 90 s after the end (the flash flood: as long as it needs to drain, plus 10 s).

Wrong values don't break anything. Unknown names and values of the wrong type are ignored. Values outside the range are clamped; where the range reads "0 or 5-600", a value under 5 becomes 5 and 0 or less becomes 0. A tier outside 1-5 is clamped. Each case writes one log line.

Units. Heights and distances are world units (PEAK's altimeter shows about 1.6 m per unit). Times are seconds. Status amounts are shares of a full bar: 0.025 = 2.5 points, in steps of 0.025. Factors multiply TFA's own value.

Next to TFA's dice (Apocalypse mode)

In Apocalypse mode TFA's dice roll a weather every few minutes. Start is allowed there: your weather runs next to them, so two weathers can run at once, one of the dice and one of yours. Outside Apocalypse mode only yours runs. Two weathers that share a part of the game can't run together, so the following rules decide who gives way.

  • Yours takes over. Your Start collides with a dice weather that runs or is announced when it is the same weather or one from the same group (table below). Then the dice weather ends at once, an announcement is cancelled, your weather starts and you get Started. A Start that fails (NotAllowed, Busy, ...) never touches the dice weather.
  • The dice keep rolling. They roll everything else, but never your weather or anything in its group while it runs and for 90 s after it ends - its aftermath is yours. In the host's F9 menu your weather shows as "Mod: yourid", switched on and locked; the colliding rows are locked too.
  • Perma weather (the host's setting) pauses while a colliding weather of yours runs. It comes back when yours and its aftermath are over. Asking for the perma weather itself works the same way: yours takes over and the perma weather resumes afterwards.
  • No collision, both run. Your earthquake next to the dice's rain, each by its own tier: yours by Tier (left out: the run's level), the dice's by the run's level and the ghosts' vote. Your tier and values never reach a dice weather.
  • Busy. The API holds one weather at a time. If another mod's weather runs or is announced, your Start answers Busy. It does too for shroomrain and cactusrain while the dice run one of them, or while a Mini/Mega phase or a cactus-ball phase is still on, whoever started it: they end in such a phase and can't be taken over. Ask again a little later; calls are cheap and merged.
// Apocalypse mode, and the dice are rolling rain right now. Rain and sandstorm both belong to the Wind group, so yours
// takes over: the rain ends at once, the sandstorm starts, and for as long as it runs (and 90 s after) the dice roll
// no weather of the Wind group.
TfaWeatherResult r = TfaWeather.Start("crystalcaves", "sand", new TfaWeatherParams { Seconds = 60f });
// r == TfaWeatherResult.Started

// Another mod's weather holds the slot? Then you get Busy - ask again in a few seconds.
if (TfaWeather.Start("crystalcaves", "quake", new TfaWeatherParams { Seconds = 24f }) == TfaWeatherResult.Busy)
{
    // try again later
}

Who collides with whom

Weathers collide when they are the same or share a group. A weather can sit in several groups.

GroupWeathersWhy they don't run together
Windstorm, rain, snow, sand, thunder, cactusrain, volcano, avalanche, shockfrostOne wind system, one weather-fog block and shared sound banks. Rain and thunderstorm share the rain.
Waterflood, tsunami, antigrav, shockfrostOne body of water. Antigravity and the flood hook into the same gravity, stamina and fall rules.
Cloudsspores, poisonOne cloud above the head and one fog setting to put back.
Sunsun, petrify, dark, shockfrostSunlight and the clock. The darkness dims the sun the other two need.
Moonblood, moon, darkMoonlight and the night clock. The darkness dims the moon the other two need.
Mixerdark, antigrav, icefog, shockfrostAll three turn music and sound volume down and would put back the wrong value.
Scoutmasterdark, watchThere is one Scoutmaster.
Fog bandsleepfog, icefog, darkThe voices in the fog and the fog's light profile.
Frostfloorlava, shockfrostBoth rewrite the ground: glowing floor and ice, lava and hot rock.
Sizeshroomrain, cactusrainThe Mini/Mega phase and the cactus-ball phase exclude each other - also in the aftermath, whoever started them.
Freequake, foodfrenzy, wisps, hayfeverThey run next to anything.

A few pairs overlap only in looks - several sky tints stacking, the low-pass filters of the flood and the freezing fog, frost against frost. They are allowed.

Under water you are immune to every other weather

Whoever is under TFA water - a flash flood or a tsunami, whoever started it - is untouched by every other weather. That includes the good: no healing from the Blue Moon, no wisp gift. Nothing reaches the character: no status, no push, no fall, no blindness, no change of speed, no lost item. The look and the sound stay: the storm still roars above the lake. The flash flood and the tsunami themselves work on swimmers as always. TfaWeather.IsUnderWater(point) asks exactly this.

Statistics

Weather you start never counts in TFA's weather statistics: not its starts, its run time, the statuses, deeds, faints or deaths, in the weather report, in uploads or on the website. What your weather does is never booked on a dice weather either; where TFA can't tell whose weather did it, it books nothing. While a weather of yours runs or lingers and can hurt (Harm left on), faints and deaths aren't booked at all. TFA's weather badges are not locked for your weather: deed badges keep counting in Apocalypse mode like TFA's own, outside it they never count.

Difficulty - Tier

Tier is an int? from 1 to 5. Leave it out and the weather plays on the level of the run in Apocalypse mode (without the ghosts' vote), on Normal everywhere else.

TierNameIn short
1RelaxedMild. Some hazards are off: no air bar under water, no Scoutmaster hunt, no throw in a quake.
2NormalAs built.
3HardFaster ticks, harder hits, shorter warnings.
4BrutalHard plus extra rules: no banners (the tsunami and the Watch keep theirs), worse aftermath.
5NightmareBrutal plus its own rules: Nightmare is not meant to be fair. Weathers last 25 % longer.

These are exactly the levels of TFA's Apocalypse mode, with the same numbers. What each tier changes:

Weather1 Relaxed2 Normal3 Hard4 Brutal5 Nightmare
stormpush x0.6, sight 140push x1, sight 80push x2, sight 50push x3, sight 32push x4, sight 32
rainno slips2.5 %/s slip when sprinting in the open; wet rock pulls climbers down15 %/s slip, rock pulls harderas Hard, a slip costs 10 % injury, 10 %/s to let go of wet rockevery sprint in the open slips, climbing up at 15 % pace
snow2.5 cold every 1.5 severy 0.75 s0.4 s0.25 s0.125 s
sandblind after 18 s into the wind12 s6 s6 s, blindness doesn't fade while it blows4 s, thorns bleed after, you stay down until they're gone
sunheat every 3 s2 s1.5 s1.5 s, double heat0.75 s, double heat
sleepfogdrowsy every 3 s, an Early Worm every 20 severy 3 s, worm every 40 s2 s1.5 s, 30 s longer1.5 s, 30 s longer, no worms
sporesevery 2.5 s up to 40 %, 1-2 zombies after2.5 s, 1-3 zombies2 s, 3 zombies1.25 s, 3 zombies that stay until the next campfireas Brutal, zombies run 1.5x faster
poisonevery 2.5 s up to 40 %, 60 blast shrooms after2.5 s, 802 s, 1201.25 s, 1601 s, 160
shroomrainbounce mushroom every 0.67-1.67 s1-2.5 s2-5 s, final pops add spores (up to 25 %)2-5 s, pops add more spores (up to 50 %)no bounce mushrooms, pops add spores and throw you
cactusrainballs x0.6, more cactiballs x1balls x1.3, fewer cactias Hard, 5 % of the balls are dynamiteballs x2.6, 5 % dynamite, cacti 1.5x denser
foodfrenzyhunger 0.025/s, a bite 0.1, 1.3x foodhunger 0.025/s, a bite 0.075hunger 0.05/sas Hard, poisonous food poisonsas Brutal, dynamite instead of Cure-All in the food
floorlavaheat x0.5x1x1.5x2, lying food charsx3, fainting in the glow kills
darkendless flashlight, no huntbattery 70 % of the weather, the Scoutmaster hunts after 20 s without lightbattery 60 %, hunts after 10 s and comes backas Hard, no glow around you, drowsy every 2 s without lightas Brutal, drowsy every 1 s, torches half as bright
wisps10 wisps866, all look white, red and pink twice as likely6, only bad gifts, wisps follow players
antigrav10 s half fall damage afteras builtstamina use x2 while liftedstamina held at 0 while liftedas Brutal, falls after it x1.5, touching the ceiling hurts
quake7 s warning, you only fall7 s, thrown x14 s, x24 s, x3, crouching doesn't stop the fall, drops a second itemno warning, x4, drops everything
blood2-4 creatures per player3-5, at most 205-77-9, at most 40, frogs too10, at most 50
moonheals everything, hunger tooheals curse, injury, spores, poison, heat, cold, drowsiness, stoneall but the curseonly spores, poison, heat, cold; no bonus stamina; 10 % drowsy sipsheals nothing; 25 % chance of stone per sip
petrifystone every 3 s2 s1.33 s, no banner2 s, double stone, no banner1 s, double stone, no banner
thunderstrikes half as often, 10 % injury3-17 s apart, 35 % aimed at players, 20 % injury, 5 % mega bolts10 % mega bolts40 % injury, mega bolts hurt instead of heal70 % aimed, every third bolt is mega
icefogbubble 15.6 units, cold every 3 s outsidebubble 9.4 units, 3 s2 s1 s, voices vanish deep in the fog0.5 s, darker
watchalone at 40 apart, hunted after 8 s30 apart, 5 s25, 4 s, thrown players safe for 45 s20, 3 s, safe 20 s, campfires don't shelter, no giftas Brutal, he hunts at once whenever nobody looks at him, no salute
floodno air bar75 s of air60 s, swimming costs x1.2545 s, x1.545 s, x1.5, out of air = fully drowsy at once
tsunamiswept 3 s, no injury3.5 s, 20 %4 s, 30 %5 s, 40 %, banner stays10 s, 40 %, wave twice as fast, no banner
avalancheno injury15 % injury, buried: 30 % coldthrown x1.5, cold 40 %as Hard, dust lasts twice as long, cold 60 %snow freezes you solid, rubble kills
volcano5 % injury per rock15 % injury, 10 % heatrocks x1.25, warning fields 1 s later, ash heat x1.5rocks x1.5, 25 % heat, ash x2rocks x3, no warning fields, ash x3
shockfrostclimbing rock: 0.025 cold every 2 s, sprint slip 10 %/s, sprint fall 0.05 cold, wall slip 10 %/severy 1 s, 10 %/s, 0.1, 10 %/s1 s, 30 %/s, 0.15, 15 %/s0.5 s, 50 %/s, 0.2, 20 %/s0.05 cold every 0.5 s, every sprint slips, 0.3, 30 %/s, items shatter on touch
hayfeversneeze 5 m high9 m13 m, tears you off walls17 m, flings the held item, knocks you over unless it throws you upward17 m, flings the held item, always knocks you over, never upward

For every weather: Nightmare lasts 25 % longer. From Brutal there are no banners (the tsunami keeps its banner on Brutal, The Floor Is Lava always warns, the Scoutmaster's Watch always shows its own banner); the Petrifying Sun has none from Hard. Warn = true brings a banner back where the weather has one.

Values - With(name, value)

new TfaWeatherParams { Tier = 2 }.With("push", 1.5f).With("direction", "right")

Numbers can be float or int, switches bool, choices string. Names that several weathers share mean the same everywhere: every = seconds per status tick, amount = status per tick, injury, cold, direction. heat is the exception: a factor for floorlava, an amount per rock for volcano. Names are matched without regard to case.

Default shows TFA's value per tier: Relaxed / Normal / Hard / Brutal / Nightmare. One number = the same on every tier. Live values change while the weather runs, start values on the next start, end values are read when the weather ends (a change while it runs counts as Updated). Rows in italics are planned and not in API level 1. Where a row says that 0 means none or never, it means that literally: no zombies, no worms, never blind.

WeatherNameWhat it setsUnit, rangeDefault 1 / 2 / 3 / 4 / 5When
stormpushSideways push, factor on PEAK's wind forcex, 0-60.6 / 1 / 2 / 3 / 4live
sightHow far you see at full strengthunits, 10-1000140 / 80 / 50 / 32 / 32live
gloomDaylight that gets through the storm0-10.8 / 0.62 / 0.48 / 0.38 / 0.38live
directionstorm, snow and sand: where the wind comes from, along the mountain"left", "right"the last direction (first: left)live
rainslipChance per second to slip when sprinting under open sky; 1 = every sprint slips0-10 / 0.025 / 0.15 / 0.15 / 1live
slideHow hard wet rock pulls a climber down (PEAK's own: -0.5); also replaces Nightmare's slowdown uphill-2 to 0-0.5 / -0.5 / -0.75 / -0.75 / -0.75live
letgoChance per second to let go of wet rock under open sky0-10 / 0 / 0 / 0.1 / 0.1live
densityHow much rain you see (look only)0-1.61live
snoweverySeconds per 2.5 cold at full strength (half as often while it builds up)s, 0.1-301.5 / 0.75 / 0.4 / 0.25 / 0.125live
sightHow far you see in the blizzardfactor1live
directionWhere the blizzard comes from, along the mountain; same as storm"left", "right"the last direction (first: left)live
sandblindSeconds of looking into the wind until you're blind; 0 = nevers, 0-12018 / 12 / 6 / 6 / 4live
slowHow much slower you move when fully exposed0-0.90.5live
directionWhere the sandstorm comes from, along the mountain; same as storm"left", "right"the last direction (first: left)live
suneverySeconds per heat sips, 0.25-303 / 2 / 1.5 / 1.5 / 0.75live
amountHeat per sip0-0.50.025 / 0.025 / 0.025 / 0.05 / 0.05live
sleepfogeverySeconds per drowsiness sips, 0.25-303 / 3 / 2 / 1.5 / 1.5live
amountDrowsiness per sip0-0.50.025live
wormsSeconds between Early Worms per player; 0 = nones, 0 or 5-60020 / 40 / 40 / 40 / 0live
LevelFog line at this world heightunitsabove the highest playerlive
sporeseverySeconds per spore sip (crouching and looking down slow it)s, 0.25-302.5 / 2.5 / 2 / 1.25 / 1.25live
amountSpores per sip0-0.50.025live
zombiesMushroom zombies that rise when it ends; 0 = none0-61-2 / 1-3 / 3 / 3 / 3end
poisoneverySeconds per poison sips, 0.25-302.5 / 2.5 / 2 / 1.25 / 1live
amountPoison per sip0-0.50.025live
mushroomsBlast shrooms sown when it ends; 0 = none0-30060 / 80 / 120 / 160 / 160end
shroomrainsizeWhat the final burst does to everyone"mini", "mega", "none"50:50 mini or megastart
sproutSeconds between bounce mushrooms (TFA picks 1-2.5x this); 0 = nones, 0 or 0.25-300.67 / 1 / 2 / 2 / 0live
cactusrainballsCactus balls per second per group of players0-81.8 / 3 / 3.9 / 3.9 / 7.8live
cactiSeconds between new cacti (TFA picks 1-2.5x this); 0 = nones, 0 or 0.2-300.34 / 0.5 / 1 / 1 / 0.67live
balltimeSeconds of rolling cactus balls after it ends; 0 = nones, 0 or 10-30060-90end
foodfrenzyhungerHunger per second0-0.20.025 / 0.025 / 0.05 / 0.05 / 0.05live
biteHunger one bite takes away0-10.1 / 0.075 / 0.075 / 0.075 / 0.075live
foodFood falling per second per player0-63.25 / 2.5 / 2.5 / 2.5 / 2.5live
floorlavaheatHeat factor on and near hot groundx, 0-50.5 / 1 / 1.5 / 2 / 3live
holdSeconds of full glow; the weather gets longer with its, 1-12010start
darkbatteryFlashlight battery in seconds; 0 = endless. With Seconds = 0 TFA's own battery is 90 s (77 s from Hard)s, 0 or 5-3600endless / 70 % of the weather / 60 % / 60 % / 60 %start
gazeSeconds without light until the Scoutmaster hunts you; 0 = never. Above 0 it also hunts on Relaxeds, 0 or 3-3000 / 20 / 10 / 10 / 10live
wispscountWisps, plus one per player beyond two. Read 7 s after the start; 0 ends the weather after about 10 s0-3010 / 8 / 6 / 6 / 6start
giftsOdds of each giftweightsby tierstart
antigravriseHow fast players, items and creatures riseunits/s, 0.2-51.2live
quakewarnSeconds of warning rumble before each quakes, 0-207 / 7 / 4 / 4 / 0live
shoveThrow strength; 0 = players only fallx, 0-60 / 1 / 2 / 3 / 4live
calmSeconds between quakes when Seconds is above 12 (TFA picks 1-2x this)s, 5-30020live
bloodpackCreatures per standing player and wave0-102-4 / 3-5 / 5-7 / 7-9 / 10live
capMost creatures at once0-5020 / 20 / 20 / 40 / 50live
mooneverySeconds per healing sips, 0.25-302live
amountHealing (or bonus stamina) per sip0-0.50.025live
petrifyeverySeconds per stone sips, 0.25-303 / 2 / 1.33 / 2 / 1live
amountStone per sip0-0.50.05 / 0.05 / 0.05 / 0.1 / 0.1live
thunderrain0 dry, 1 light, 2 normal, 3 heavy0-3TFA rolls one at the startlive
spacingFactor on the 3-17 s between strikesx, 0.25-102 / 1 / 1 / 1 / 1live
aimChance a strike targets a player0-10.35 +0.05 per player beyond one, at most 0.7; Nightmare 0.7 +0.025 per player beyond two, at most 1live
injuryInjury from a bolt (not from the mega bolt)0-10.1 / 0.2 / 0.2 / 0.4 / 0.4live
megaChance of a mega bolt0-10.05 / 0.05 / 0.1 / 0.1 / every thirdlive
icefogradiusRadius of the safe bubble around its carrier; 0 = no bubbleunits, 0-6015.6 / 9.4 / 9.4 / 9.4 / 9.4live
everySeconds per 2.5 cold outside the bubbles, 0.25-303 / 3 / 2 / 1 / 0.5live
watchapartDistance to the nearest teammate that counts as aloneunits, 5-20040 / 30 / 25 / 20 / 20live
graceSeconds alone before he comes for yous, 0-608 / 5 / 4 / 3 / 3live
giftfalse: no salute and no gift at the end; true forces nothingboolas TFA decidesend
floodLevelWater surface, world height (the typed property Level)units, ±30000see flood belowlive
riseSeconds to reach Level; 0 = there at once, also without the 4 s leads, 0-12015live
drainSeconds the water takes to drain after it endss, 0-12020live
douseCampfires and lanterns under water go out after 3 sbooltruestart
airSeconds of air under water; 0 = no air bars, 0 or 5-6000 / 75 / 60 / 45 / 45live
areaWater only inside a box of your stage - a lake with a shoreboxeverywherestart
tsunamidirectionSide the first wave comes from (the wind vane stays as it is)"left", "right"the last directionstart
carrySeconds the wave carries yous, 0-153 / 3.5 / 4 / 5 / 10live
injuryInjury when the wave hits0-10 / 0.2 / 0.3 / 0.4 / 0.4live
Level, speedWater level after the wave, wave speedunits, units/s40 below the next camp, 32start
avalanchesnowtrue: a snow slide that buries; false: dust and rubbleboolTFA decides per slide, by placestart
injuryInjury when it hits you0-10 / 0.15 / 0.15 / 0.15 / 0.15live
coldCold when the snow buries you0-10.3 / 0.3 / 0.4 / 0.6 / 0.6live
speedHow fast the slide runsunits/s9-13start
volcanorocksFactor on how many rocks fallx, 0-51 / 1 / 1.25 / 1.5 / 3live
injuryInjury from a rock0-10.05 / 0.15 / 0.15 / 0.15 / 0.15live
heatHeat from a rock0-10.1 / 0.1 / 0.1 / 0.25 / 0.25live
ashAsh fog in the second halfbooltruestart
hayfeverheightApex of a straight-up sneeze in metres; the push scales with it, x1.5 in mid-air, with a small hop on flat ground. On Nightmare a sneeze never lifts youm, 0-205 / 9 / 13 / 17 / 17live
leastShortest time between two sneezess, 1-604 / 4 / 4 / 4 / 4live
mostLongest time between two sneezes (each player rolls their own)s, 1-12020 / 20 / 20 / 20 / 20live
shockfrosteverySeconds per cold bite while climbing rocks, 0.1-102 / 1 / 1 / 0.5 / 0.5live
coldCold per bite (steps of 0.025)0-10.025 / 0.025 / 0.025 / 0.025 / 0.05live
slipChance per second to slip when sprinting; 1 = every sprint slips0-10.1 / 0.1 / 0.3 / 0.5 / 1live
fallCold from a fall after a slip (steps of 0.025); breaking into water costs half0-10.05 / 0.1 / 0.15 / 0.2 / 0.3live
slideConstant downward pull on iced rock, like rain; runs only when you set it (wall slips replace it by default)-2 to 0offlive
wallslipChance per second of climbing iced rock to slip down the wall (one roll per second)0-10.1 / 0.1 / 0.15 / 0.2 / 0.3live
slipforLength of one wall slips, 0.05-20.25live
slipspeedPeak speed of a wall slip; 3 = the speed of climbing down0-103live

Every weather also takes Seconds, Warn and Tier, and Sound and Harm where the weathers list them.

Example: a lake to swim in

TFA's flash flood is real water. Players swim with Space, dive and climb out, see and hear the world under water. With your own values it becomes a calm, silent lake that stays until you stop it.

The idea: your stage begins at the shore of a lake. The start campfire sits on a rock just above the water, and the way up starts with a swim across.

private static bool _lake;
private static float _level;

private static void OnPlayersHere(TfaBiomeSlot slot, bool here)
{
    if (!CrystalCavesPlugin.TfaWeatherReady || !slot.OwnWeatherAllowed)
    {
        return;
    }
    _lake = here;
    _level = slot.StartPoint.y - 2f;   // world height of the surface: 2 units below the start campfire
    if (here)
    {
        KeepLake();
    }
    else
    {
        TfaWeather.Stop("crystalcaves");   // the lake drains in 8 s (see "drain")
    }
}

// Call it from OnPlayersHere and again about once a second from your Update while _lake is set. The same call answers
// Unchanged and writes nothing; if another mod's weather was in the way (Busy), the lake gets in as soon as it ends.
private static void KeepLake()
{
    TfaWeather.Start("crystalcaves", "flood", new TfaWeatherParams
    {
        Level = _level,
        Seconds = 0f,                  // until stopped
        Sound = false,                 // no roar of rising water, no surge
        Harm = false,                  // no air bar, no drowning
    }
    .With("rise", 0f)                  // already full when the players arrive
    .With("drain", 8f)
    .With("douse", false));            // the water may later rise over the start campfire without putting it out
}

What happens, on every player:

  1. The host writes the weather together with your values into the room. Guests take it over within about a second; a player who joins later gets it too.
  2. The water stands at Level right away. Everything below that height is under water.
  3. Under water players swim, sink slowly and take no fall damage. Climbing goes at half speed, the view turns blue-green and other sounds are muffled. Loose items drift and sink slowly. With Harm = false nobody runs out of air.
  4. When the group lights the campfire at the end of your stage, PlayersHere(slot, false) stops the lake and the water sinks away in 8 s.

Keep in mind:

  • The water has no shore yet. It is a sea level: everything in the world below Level is under water - your stage, the stages below and the beach. Put your lake at the foot of your stage, where that is what you want. area (a lake bounded to a box of your stage) is planned.
  • If Level lies above the start campfire, players arrive under water, and the campfire goes out after 3 s unless you add .With("douse", false) to the first call - douse is a start value, a later update can't change it.
  • Want diving to matter? Leave Harm on and set the air: .With("air", 40f) gives 40 s under water on any tier.
  • In Apocalypse mode the dice keep rolling beside your lake. The Water group (flash flood, tsunami, antigravity) stays away while the lake stands; everything else runs, and swimmers are immune to it.
  • Is the lake a route the group must swim? If another mod's weather holds the slot, your start answers Busy until it ends - the repeated call above gets the lake in as soon as that is over.

More examples

Tier and values together. A short, nasty thunderstorm for the final push: Brutal, heavy rain, but no mega bolts, and a bolt costs 30 % instead of Brutal's 40 %:

TfaWeather.Start("crystalcaves", "thunder", new TfaWeatherParams { Seconds = 60f, Tier = 4 }
    .With("rain", 3)
    .With("mega", 0f)
    .With("injury", 0.3f));

A gentle first blizzard. Relaxed, and the cold bites only every 3 s:

TfaWeather.Start("crystalcaves", "snow", new TfaWeatherParams { Seconds = 40f, Tier = 1 }.With("every", 3f));

Raise the water while it stands - same owner, same weather, new live values. The result is Updated:

_level = slot.StartPoint.y + 10f;   // so the repeated KeepLake keeps the new height
TfaWeather.Start("crystalcaves", "flood", new TfaWeatherParams
{
    Level = _level, Seconds = 0f, Sound = false, Harm = false,
}.With("rise", 20f).With("drain", 8f));   // up 12 units within 20 s; douse stays as the lake started it

douse is a start value, so the lake sets it in its first call. drain is repeated because a live value you leave out in an update falls back to its default.

A blood moon that only brings a few creatures - at any time of day:

// Day or night, it doesn't matter: the clock moves to midnight while the blood moon runs and goes back afterwards.
TfaWeather.Start("crystalcaves", "blood", new TfaWeatherParams { Seconds = 90f }
    .With("pack", 1).With("cap", 6));

React to TFA's weather. In every mode, Apocalypse included, on every player:

TfaWeather.Changed += change =>
{
    // Dice and mod weather can run at once, so ask for the state instead of reading change.To.
    CrystalGlow.Dimmed = TfaWeather.IsRunning("dark");   // your crystals dim while darkness runs, whoever started it
};

Your own torches go out under TFA water:

if (TfaWeather.IsUnderWater(torch.position)) torch.Snuff();

Reference

TfaWeather

int ApiVersionAPI level; 1 for this page. Read it at runtime. Reading it also tells TFA that a mod uses its weather.
string CurrentKey of TFA's own running weather (the dice, the F9 menu, the ghosts' vote), "" if none. The same on every player, give or take a second.
string ModWeatherKey of the weather started through this API, "" if none.
string ModOwnerThe owner id of that weather, "" if none.
bool IsRunning(string key)Does this weather run, in either slot?
bool IsUnderWater(Vector3 point)Is this point under TFA water right now (flash flood, tsunami)?
event Action<TfaWeatherChange> ChangedOn every player, right after a weather switched there - for any weather, TFA's own included. One event per slot; a value update without a change of weather fires none.
TfaWeatherResult Start(string owner, string key, TfaWeatherParams values = null)Starts a weather, or gives your running one a new tier or new live values. Only the host acts. Another key replaces your running weather (its aftermath plays) and drops an announcement of yours that is still counting down; the answer is Started.
TfaWeatherResult Stop(string owner)Stops the weather owner started. Some weathers leave something behind when they end (see the weathers). After a win it still works.

Current, ModWeather, ModOwner and IsRunning tell what is applied on this machine. Start and Stop are safe to call on every player and as often as your logic wants. On guests nothing happens. If the same weather already runs with the same tier and values, nothing is written; calls in quick succession are merged, the last one wins within a second. Your Changed handler runs inside TFA's weather step, so keep it short; an exception in it is caught and logged once per handler.

TfaWeatherParams

Everything is optional. Whatever you leave out, TFA decides as it always does.

PropertyTypeDefaultMeaning
Secondsfloat?TFA's own duration for that weather and tier0 = until you stop it. Max 3600.
Tierint?Apocalypse mode: the run's level; else NormalDifficulty 1-5: Relaxed, Normal, Hard, Brutal, Nightmare. See Difficulty.
Warnbool?as TFA would on that tierThe banner or sound 3 s before it starts. false: none, and it starts at once (watch keeps its 10 s lead). true brings the warning back (the banner, for foodfrenzy the growl) for blood, petrify, tsunami, floorlava, foodfrenzy and watch; on any other weather it is ignored and logged.
Soundbooltruefalse: no hazard sounds. Works for sun, quake, flood, tsunami, avalanche, volcano, shockfrost and hayfever, elsewhere it is ignored and logged. Feedback such as splashes and swim strokes stays.
Harmbooltruefalse: the weather hurts nobody, on any tier. Works for 26 of the 28 weathers; blood and cactusrain ignore it and log (use pack = 0 or balls = 0). What it means per weather: the weathers.
Levelfloat?TFA's ruleWorld height in units. API level 1: the flash flood's water surface; ignored elsewhere.
ValuesDictionary<string, object>emptyNamed values, see Values. With(name, value) adds one and returns the object.

TfaWeatherResult

ValueMeaning
StartedWritten for everyone. With a warning, the weather begins 3 s later. Also the answer when yours took over a colliding dice weather.
UpdatedYour weather got a new tier or new live values - the water moves to the new level, for example.
UnchangedThe same weather already runs with this tier and these values, or only start values changed. Stop it and start it again.
StoppedYour weather ends for everyone; its aftermath plays.
NothingToStopYou run nothing. A weather of TFA or of another mod is not yours to stop.
NotHostYou're a guest. The host's call reaches you anyway.
NotAllowedNot in a run or the airport (title screen, loading), the daily map, or the run is over (lost, or the end screen). The log line says which.
UnknownWeatherNo weather with this key in this TFA.
WrongTimeReserved. TFA 2.10.0 never returns it: a night or day weather moves the clock instead. The value stays so that mods built for API level 1 still compile.
UnavailableReserved. TFA 2.10.0 never returns it: every weather can be made to work anywhere. The value stays so that mods built for API level 1 still compile.
BusyAnother mod's weather runs or is announced; or a dice Shroom Rain or Cactus Rain, a Mini/Mega phase or a cactus-ball phase is in the way of shroomrain or cactusrain. Try again later.
BadOwnerThe owner id isn't 2-24 lowercase letters or digits.

TfaWeatherChange

From, ToThe weather keys before and after, "" = none.
Owner"" = TFA itself (dice, menu, ghosts' vote), otherwise the owner id of a mod.
ByModOwner.Length > 0.

The weathers

Keys never change; they are the same as in TfaBiome.Weathers (see the Biomes tab). Values per weather: see Values.

KeyNameClockSound offHarm offWhen it ends
stormWindstormany-no push, no grip penalty (scenery)-
rainRainany-no slipping, no letting go, wet rock doesn't pull-
snowBlizzardany; never moves the clock; started at night outside an Alpine stage it holds the night-no cold-
sandSandstormany-no blindness, no fainting, no braking-
sunBurning Sunany; moves the clock to noon and holds itroarno heat-
sleepfogSleeping Fogany-no drowsiness-
sporesSpore Cloudany-no spores, no zombies afterwardsmushroom zombies rise (zombies)
poisonPoison Fogany-no poison, no blast shrooms afterwardsa field of blast shrooms (mushrooms)
shroomrainShroom Rainany-no stings and throws (the size change stays)final burst, everyone turns Mini or Mega (size)
cactusrainCactus Rainany-not offered (use balls = 0)rolling cactus balls (balltime)
foodfrenzyFood Fiestaany-no hunger; food without poison or dynamite damagefood keeps falling 3 s, then lies 10 s more
floorlavaThe Floor Is Lavaany-no heat, no death, no charringown timeline, about 20 s (hold)
darkDarknessany-no dozing, no hunt-
wispsWill-o'-Wispsany-no bad giftsends by itself when the last wisp is taken
antigravAntigravityany-the lift stays; no stamina drain, no ceiling hit, soft landing-
quakeEarthquakeanyrumble and bangnobody falls, flies or loses anythingown timeline: 12 s = one quake
bloodBlood Moonany; moves the clock to midnight and holds it-not offered (use pack = 0)creatures turn to skeletons or vanish
moonBlue Moonany; moves the clock to midnight and holds it-no drowsiness and no stone (healing stays)-
petrifyPetrifying Sunany; moves the clock to noon and holds it-no stone-
thunderThunderstormany-nobody is hit, no mega healing-
icefogFreezing Fogany-no cold-
watchScoutmaster's Watchany; the host brings the Scoutmaster even if the run has none-he hunts nobodysalute and a gift (gift)
floodFlash Floodanyroar and surgeno air bar, no drowning, no extra drowsinessthe water drains (drain)
tsunamiTsunamianywave soundsthe wave carries nobodyown timeline: wave, then the water drains
avalancheAvalancheanyrumble and boomhits nobodyown timeline, 90 s
volcanoVolcanic Eruptionany; without a Kiln it erupts ahead of the grouperuption, rocksrocks and ash have no effect-
shockfrostFlash Freezeanychimes, cracking, the burstno cold, no slipping, no falls (the ice, frozen traps and shattering stay)4 s of cracking, then the ice bursts and thaws for 3 s
hayfeverPollen Seasonanysniffs, gasps and sneezesno sneeze push (the pollen haze and the sounds stay)sneezing stops at once

Own timeline: these weathers play a fixed course. Seconds only decides when the weather counts as over and the next one may start; a wave or slide that has begun still finishes.

Holds the clock: day or night stand still while the weather runs. A night weather with Seconds = 0 keeps the night until you stop it. If the time of day doesn't fit, the clock first moves to midnight (blood, moon) or noon (sun, petrify) and goes back to where it was when the weather ends.

Warnings: blood, petrify, tsunami and floorlava have a banner, foodfrenzy has a growl, and watch starts with a 10 s lead and a banner of its own. Whether they show depends on the tier (see Difficulty), except watch, whose banner shows on every tier; Warn decides it for you. Warn = false means no banner and, for blood, petrify, tsunami, floorlava and foodfrenzy, no lead (the lava glows after 0.5 s instead of 3 s); watch keeps its 10 s lead and only loses the banner.

Harm off: what Harm = false does is in the table. It works for 25 weathers. Under water the same gate keeps the character out of other weathers (see above).

Flash Freeze (shockfrost): it has no banner; its 6 s fade-in is the warning, and Seconds includes it. When it ends (cracking for 4 s first) or after Stop, the ice bursts and thaws for 3 s; lava and water stay solid until then, so a weather that follows may start only after the thaw. Harm = false switches off everything that touches the players (cold, slipping, falls); the ice look, the frozen traps, the frozen lava and water and the shattering items stay.

flood - Flash Flood

ValueTypeDefaultRangeWhenMeaning
Levelfloat15 units below the end campfire of the current stage (Gloom/Caldera: 50 above it, Kiln/Citadel: 15 below the summit)±30000liveWater surface, world height in units.
risefloat150-120liveSeconds to reach Level. 0 = there at once, also without the 4 s lead.
drainfloat200-120liveSeconds the water takes to drain after it ends.
airfloatby tier: none / 75 / 60 / 45 / 450, 5-600liveSeconds of air under water. 0 = no air bar.
dousebooltruestartCampfires and lanterns under water go out after 3 s.
Sound = falseliveNo roar while the water rises or drains, no surge. The hum under water, splashes, swim strokes and bubbles stay.
Harm = falseliveNo air bar, no drowning, no extra drowsiness under water.

TFA's own flood ends when someone lights a campfire. A flood you start doesn't: it runs until Stop or Seconds ends it. To change it while it runs, call Start again with new live values: the water moves to the new Level within rise seconds. Lowering the water does not bring back vanilla water that TFA hid. Without Level, TFA's rule applies, on every machine for itself; where there is no campfire to aim at (the airport), the host fixes the level at the start: 3 units above the lowest living player.

Multiplayer

  • Call it everywhere. PlayersHere and your own triggers run on every player. Make the same call on all of them; only the host's call counts. Weather started from code that only runs on one guest does nothing. Calling Start on every player also lets TFA know your owner id on every machine - see "Host leaves".
  • Tier and values come from the host. TFA sends them with the weather. Don't compute a value from things that differ between players, such as player positions or physics hits. Your stage's geometry, its campfires and the slot are the same everywhere.
  • Late joiners get the weather in its current state, with its tier and values: the lake already full, the storm halfway through. They get a weather that is in its aftermath too. They don't see banners or hear starts that already happened.
  • While the mountain builds, or before a player's character exists, Start still answers Started. The weather begins on each machine as soon as TFA is ready there.
  • Host leaves: the next host takes over; duration, owner, tier and values stay in the room. A warning still counting down is lost; your next call starts the weather again. If the new host has never seen a call with your owner id - the mod is missing there - the weather ends after 15 s and TFA logs it.
  • Continue (quicksave): a running weather is not saved. After loading, PlayersHere reports your stage again and your call starts it again.
  • Run over: a lost run ends your weather. After a win it stays as harmless scenery on the end screen, like TFA's own; Stop still works then, Start answers NotAllowed.
  • Scene change: a weather started in the airport ends when the run loads; nothing carries over from one scene to the next.
  • Versions: all players need the same TFA version (TFA checks that). Guests don't need your mod to see TFA's weather; your biome itself is another story.

Good to know

  • Statistics and badges: see "Statistics" under Next to TFA's dice: your weather never counts.
  • PEAK's own weather of a stage keeps going. TFA's storm, rain, blizzard and sandstorm hold PEAK's wind zones still while they blow. Your sun replaces the Mesa's own hot sun while it runs, so only your values apply. Apart from that, TFA does not switch PEAK's weather off outside Apocalypse mode; a biome drops its frame's weather with DropFromFrame. In Apocalypse mode TFA's permanent Mesa sun rests while your sun, petrify or dark runs, and for 90 s after.
  • Oxygen tanks in suitcases only appear in Apocalypse mode. The air bubbles from suitcases under water work in every run.
  • Sky: several weathers tint the whole sky and the sun, starting from your stage's sky (slot.Sky).
  • Under water TFA puts a low-pass filter on every sound source in the scene, yours included; voices, music and the HUD stay clear. Water surfaces whose shader name contains "Water" and that lie entirely below Level are hidden while the water stands.
  • Loose physics objects near the camera float and sink slowly in TFA water. Make props kinematic if they should stay put.

Versions

  • ApiVersion goes up whenever something is added. Existing members, weather keys and value names never change their meaning.
  • Values are named, not typed, so a mod written for a newer TFA still runs on an older one: the older TFA ignores names it doesn't know and logs them. New values join the catalogue without a new API level.

Planned

  • The rows in italics above: area for the flood (a lake with a shore), Level for the tsunami and the sleeping fog, speed, ash, density, sight, gifts.
  • Sound and Harm for more weathers.
  • One-off events without the weather slot: a lightning strike, a lava rock or a supply crate at a point.

Questions or ideas for the API? Write to CptPICHU on the PEAK Modding Discord.

All time
1607times submitted
41906deaths
5841Apocalypse runs
395Builder runs