body.component
README.md
firstlight.body
The survivor's body, and the record of the run. Attached to GameDirector
by the scene build.
What it runs, every play frame
- Where the local player stands:
Rules.state.body.indoorsis true inside the living hut's footprint;nearFire(0..1) is the stove's warmth reaching the body, full within a metre of the firebox and gone atfireReachM. coreC: loseslossPerDegreeper second per degree the felt temperature sits belowcomfortC— the hut'sinsideCindoors, the weather'schillCoutdoors — multiplied by1 + 2.5 * wet; gainsfireGain * nearFire. At -40 C in still air a warm body dies in about 15 real minutes (1.5 in-game days); by a high stove it is back to normal in three.kcal:Rules.KCAL_PER_DAY_RESTper day at rest indoors, towardRules.KCAL_PER_DAY_WORKmoving outdoors.wet: snow and storm soak clothes outdoors; the fire dries them.frostbitebelowRules.CORE_C_FROSTBITE: the avatar'sCharacterController.moveSpeedis scaled byfrostbiteSpeeduntil the core recovers.- Death at
Rules.CORE_C_DEATHorRules.KCAL_DEATH, throughfirstlight.legacy: the run ends, the last journal line is written, the cache is stashed, the save is written anddeath { cause, day }is emitted. Adeathanother slice emits (the bear) is handled the same way. - Sleep (
sleepevent): eight hours of rest at the hut's warmth. - The journal: a line for the day that ended on every
dayevent. - The save:
firstlight.persistwritesrun,body,hut,storesandjournalon every day, sleep, death, patch and (throttled) store change, and on leaving play; it reads them back at awake so a reload resumes the same morning. The forecast seed is chosen once per world at the first load.
Methods (call with a colon on entity.find("GameDirector").component.get("body"))
| Method | Does | Returns |
|---|---|---|
body:eat(kcal) | Adds calories (a tin is about 800). | calories held (number) |
body:warm(degrees) | Warms the core directly (a hot meal). | core C (number) |
body:newRun() | Starts the next run from the death screen: body, clock and stores reset to the start values plus the cache; journal, seed, deaths, patched gaps and drilled hole stay. Emits newRun { deaths, cache }. | — |
body:save() | Writes the save now. | — |
body:state() | { coreC, kcal, wet, frostbite, indoors, nearFire, alive, day } | table |