KeyedSaveOptions
What defineKeyedSave takes.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Schema extends SaveSchema |
SaveSchema |
Parent extends `${KeyedSaveParent}` |
`${KeyedSaveParent}` |
Properties
Section titled “Properties”| Property | Type | Default value | Description |
|---|---|---|---|
deleteAfterIdleSeconds? |
number |
undefined |
How long a record no room holds is kept: one no room opens for this many seconds after its last close is deleted. Off by default, so no record is deleted unasked. |
migrations? |
Readonly<Record<number, (saved) => unknown>> |
undefined |
One step per version, as a save’s. |
name |
string |
undefined |
The declaration’s name, part of every head’s identity: kebab-case, such as plot or guild-bank, and one per game. |
onDepositReceive? |
DepositReceiveHooks<KeyDepositContext> |
undefined |
The deposits the record takes, one hook per kind by its name, as a save’s onDepositReceive: a guild’s bank takes donations. Its hooks receive the key’s entity and key. |
onDepositReturn? |
DepositReturnHooks<KeyDepositContext> |
undefined |
The deposits this record sends, one hook per kind by its name, as a save’s onDepositReturn. |
parent |
Parent |
undefined |
What each record belongs to and goes with. |
schema |
Schema |
undefined |
Checks every record loaded, after its steps. |
version |
number |
undefined |
Counts the shape of the record, as a save’s version does. |
whenUnanswered? |
"refuse" | "close" |
"close" |
What the room does with an ask for a key its game leaves unanswered for 45 seconds. |
Methods
Section titled “Methods”read()
Section titled “read()”read(
context):input<Schema>
What to keep of the key’s entities, as plain JSON.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context |
KeyedSaveContext |
Returns
Section titled “Returns”input<Schema>
restore()
Section titled “restore()”restore(
context,saved):void
Puts a stored record back onto the key’s entity and what it spawns; a key with no record yet opens with no restore.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context |
KeyedRestoreContext |
saved |
output<Schema> |
Returns
Section titled “Returns”void