LINE1 10 20 30 40 50 60 70 80 90 1001import { WARMTH } from'./config.js';23// Body warmth for maps with `warmth` set. It drains outside the shack and comes back by the stove.4// At zero the run ends (main.js handles that).5exportclass Warmth {6constructor() {7this.reset();8 }910reset() {11this.value = WARMTH.max;12this.armed = true;13 }1415getdead() {16returnthis.value <= 0;17 }1819// Moves the warmth toward the stove, or away from it. Returns 'cold' on the frame it drops under the20// warning line. It warns again only after the player has warmed back up.21update(dt, inShack) {22const rate = inShack ? WARMTH.gainPerSec : -WARMTH.lossPerSec;23this.value = Math.max(0, Math.min(WARMTH.max, this.value + rate * dt));24if (this.value >= WARMTH.warnAt + 20) this.armed = true;25if (this.armed && this.value < WARMTH.warnAt) {26this.armed = false;27return'cold';28 }29returnnull;30 }31}3233// Whether a point is inside a box of the form {x0, x1, z0, z1}.34exportfunctionwithin(box, x, z) {35return x > box.x0 && x < box.x1 && z > box.z0 && z < box.z1;36}