Log inGet started
Package

state.module

Newest version

README.md

frostline.state

Shared game-state and rules module for Frostline, a third-person ice-fishing derby. This module is the single source of truth: both the 3D simulation component (FrostlineGame) and the UI component (FrostlineUI) require it, read its tables, and call its functions. No entities or rendering live here — only data, rules, and persistence, so the whole game loop is testable without a scene.

State buckets

  • progress — persisted across reloads: cash, owned/equipped gear, the Fishdex (species + records), medals, best score, legendary access, and settings.
  • run — the live derby; nil between runs. Holds the clock, the angler, drilled holes, the dropped line, sonar contacts, the active bite/reel, and the haul.

Surface

  • Catalog: SPECIES, GEAR, DERBIES, LAKE_RADIUS.
  • Run lifecycle: newRun, tick, endRun, abortRun, getRun.
  • Fishing loop: drill, dropLine, raiseLine, setDepth, setBait, populateSonar, hook, setReeling, reelPulse, landFish, loseFish.
  • Economy + catalog: buyGear, canBuy, gearStats, gearTier, sellKept, fishdexComplete, fishdexCount, medalFor.
  • Settings + events: getSettings, setSetting, subscribe, signal.
  • Persistence: save, load, resetProgress (JSON to the world VFS).

Persistence is resilient — load merges a saved profile onto defaults, so a fresh world (no save.json) starts at the default profile and old saves survive new fields.