Skip to main content

State reference

nexSys.state is the read-only data surface. Each branch returns a fresh, frozen snapshot from its domain model.

if (nexSys.state.affs.asthma?.have) {
// react to the current snapshot
}

Branches

BranchValueContents
state.systemobjectSettings, baseline intent, runtime, character, target, and room state
state.targetobjectCurrent target record
state.classstringCurrent normalized character class
state.affsobjectAffliction records keyed by name
state.defsobjectDefence records keyed by name
state.balancesobjectBalance records keyed by id
state.limbsobjectLimb records keyed by limb id
state.queueobjectQueue-controller snapshot
state.cacheobjectInventory, rift, and desired precache state
state.promptobject or nullPrompt variables, affliction display config, and cure colors
state.serversideobjectBaseline, desired, observed, transient, and pending curing state

Serialization contract

The complete state tree is JSON-serializable and contains no function values:

const report = JSON.parse(JSON.stringify(nexSys.state));

This is the preferred shape for debug captures and bug reports. Snapshot objects are frozen; call a method under nexSys.api to request a change.

Fresh reads

A captured branch does not update in place. Read the branch again after a state transition:

const before = nexSys.state.affs;
// an affliction event occurs
const after = nexSys.state.affs;

Use events when an integration needs to know when to re-read.