CommandOptions
What defineCommand takes beside the fields.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Reason extends string |
string |
Returns extends ReturnFields | undefined |
ReturnFields | undefined |
ActsThrough extends boolean |
boolean |
Lifetime extends CommandLifetime |
CommandLifetime |
Predicted extends boolean |
boolean |
Properties
Section titled “Properties”| Property | Type | Default value | Description |
|---|---|---|---|
burst? |
number |
defaultCommandBurst, 2 |
How many she may send at once past perSecond, from 1 to 16. |
entity? |
ActsThrough |
false |
Whether it acts through one entity the sender controls, which the reader reads as command.entity and sendCommand names in its entity option, by type. The room runs it only while she controls that entity. |
keys? |
readonly KeyCode[] |
undefined |
Keys that send it, on each first press of one, as ["KeyF"], checked against every other key the game binds as the world is made. Only on a command with no fields: a key sends no payload. One with entity: true goes through the entity her held keys steer. |
lateTicks? |
number |
defaultLateTicks, 17 |
For a predicted command: how many ticks after its own it may reach the room and still run, on the room’s next tick, from 1 to 60. Later, it is refused late. |
lifetime? |
Lifetime |
undefined |
What ends it before it runs, CommandLifetime: Control for one with entity: true, Session for any other. Entity and Control need entity: true. |
perSecond? |
number |
defaultCommandsPerSecond, 4, or defaultPredictedCommandsPerSecond, 20, for a predicted command |
Commands of this handle she may send each second, above 0 and up to 60, such as 0.5 for one every two seconds: a guard against a flood, not a game rule. |
predicted? |
Predicted |
false |
Whether it runs on her page on its tick as a guess, and on the room on the same tick, whose result confirms the guess or corrects it: an action she feels at once, such as a cast, a dash or a walk. Its one reader is a system marked predicted: true, which writes the entity’s predicted traits; it needs entity: true, its lifetime is Control, it waits for no deadline, and it returns no entity, since a re-run may not spawn. |
refusals? |
readonly Reason[] |
[] |
The reasons its reader may refuse it with, kebab-case codes, beside the engine’s own CommandRefusal: ["occupied", "too-poor"]. |
returns? |
Returns |
undefined |
The fields of the value an accepted command carries back, such as { building: entity() }: its reader’s accept then takes the value, by type. Left out, an accepted command carries none. |
timeoutSeconds? |
number |
defaultCommandTimeoutSeconds, 10 |
How long it may wait in its queue for its reader, from its admission, counted in the room’s ticks, before it is refused timed-out; at most 300. |
touch? |
TouchControl |
undefined |
The touch button <InputButtons /> draws for it. Only on a command with no fields, as keys. |