emit(evt: string, a: any?, b: any?) → void
| arg | type | description |
|---|
| evt | string | |
| a | any? | |
| b | any? | |
on(evt: string, fn: (any?, any?) → void
Listen to a progress event on this machine: ability(id), key(count), visit(roomId), exit(key), gate(gateId), shrine(id), boss(id), save(record), loaded(). Returns an unsubscribe function.
| arg | type | description |
|---|
| evt | string | |
| fn | (any?, any? | |
load(timeout: number?) → void
Load this player's saved progress through saveKit (waits for the profile, up to `timeout` seconds). Safe to call more than once.
| arg | type | description |
|---|
| timeout | number? | |
isLoaded( ) → boolean
Has the saved progress been read yet?
useSave(on: boolean) → void
Turn saving through saveKit on or off (off: progress lives for this session only, e.g. a gallery).
| arg | type | description |
|---|
| on | boolean | |
data( ) → Data
The raw progress table (read it, do not keep it across a reset).
has(ability: string) → boolean
Does this player have an ability (dash, wallJump, doubleJump, slam, or any id you grant)?
| arg | type | description |
|---|
| ability | string | |
grant(ability: string) → boolean
Give this player an ability. Returns true when it is new.
| arg | type | description |
|---|
| ability | string | |
revoke(ability: string) → void
Take an ability away (testing, or a game where you lose powers).
| arg | type | description |
|---|
| ability | string | |
keys( ) → number
Keys carried.
addKey(n: number?) → void
| arg | type | description |
|---|
| n | number? | |
useKey( ) → boolean
Spend one key; false when there is none.
visited(roomId: string) → boolean
| arg | type | description |
|---|
| roomId | string | |
visit(roomId: string) → void
| arg | type | description |
|---|
| roomId | string | |
exitUsed(key: string) → boolean
| arg | type | description |
|---|
| key | string | |
useExit(key: string) → void
| arg | type | description |
|---|
| key | string | |
gateOpen(id: string) → boolean
| arg | type | description |
|---|
| id | string | |
openGate(id: string) → void
| arg | type | description |
|---|
| id | string | |
shrineTaken(id: string) → boolean
| arg | type | description |
|---|
| id | string | |
takeShrine(id: string) → void
| arg | type | description |
|---|
| id | string | |
bossBeaten(id: string) → boolean
| arg | type | description |
|---|
| id | string | |
beatBoss(id: string) → void
| arg | type | description |
|---|
| id | string | |
device(key: string) → any
Kept state of an interactKit device (a key taken, a lock opened), under its saveId; nil when nothing is kept. Keys taken before 1.4.0 were kept with the gates, so those still count.
| arg | type | description |
|---|
| key | string | |
setDevice(key: string, value: any) → void
Keep the state of an interactKit device for this player (written to their save).
| arg | type | description |
|---|
| key | string | |
| value | any | |
savePoint( ) → void
The save point this player last rested at: { room, x, y } or nil.
rest(roomId: string, x: number, y: number) → void
Rest here: remember the save point and write the whole progress now.
| arg | type | description |
|---|
| roomId | string | |
| x | number | |
| y | number | |
reset( ) → void
Start over: forget every ability, key, room, gate and boss for this player (and in their save).