StatusPerk
Inherits:Perk
Section:status
Priority:100
Overview
StatusPerk grants functions related to the unit's status.
Settings
Format - Global
Settings common to all units are written in the “system.status” section of the global settings.
{ "system": { "status": { "options": { "waitForTimeout": Number, } } } }
Format - Unit
Unit-specific settings are written in the “status” section.
{ "status": { "options": { "waitForTimeout": Number, }, "waitFor": { <eventName>: [{ <unit>: (See basic.locate skill for valid values), "status": String, }, ...], ... } } }
<eventName>
Type:String
The event name. In this event, a unit waits for other units to become the specific status. Valid event names are BitsmistJS events or standard Javascript events.
The value is an array of objects, each specifying which unit should become which status. The unit waits for all the units specified in the array.
"status"
default:“ready”
The status to wait for. A unit waits for another unit to be this status. If not specified, it waits for the unit to be “ready” status.
<unit>
The unit to wait for. Valid values are the same as the target argument of the basic.locate skill.
"waitForTimeout"
Type:Number
Default:10000
The time in milliseconds before timeout when using the wait spell.
Event Handlers
doApplySettings
Loads the settings from the “status.waitFor” section and installs event handlers to wait for other units.
Reference Settings
States
status
Type:String
Target:Instance
The current status of this unit. It can be changed using the change skill. Valid statuses are as follows:
- “starting”
- “started”
- “ready”
- “stopping”
- “stopped”
Skills
change
Type:Undefined
Target:Unit
Changes the unit's status.
Parameters
Parameter | Type | Description |
---|---|---|
status | String | The unit's status. See State - status for valid values. |
Return Value
None.
Spells
wait
Type:Undefined
Target:Unit
Waits for other units to be specific status.
Parameters
Parameter | Type | Description |
---|---|---|
waitList Required | Array of Object | The wait info array. Each object in the array is equivalent to the settings set as a value for <eventName>. |
timeout Default:(see desc) | Number | The timeout in milliseconds. If the unit is not in the specified status after the time specified here, an exception is raised. If not specified, waitForTimeout setting value is used. |
Return Value
None.