======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": {
: [{
: (See basic.locate skill for valid values),
"status": String,
}, ...],
...
}
}
}
========
''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 [[#status1|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.
========
The unit to wait for. Valid values are the same as the target argument of the [[en:bitsmist-js-core:reference:perk:basic-perk#locate|basic.locate]] skill.
===="waitForTimeout"====
''Type:Number'' ''Default:10000''
The time in milliseconds before timeout when using the [[#wait|wait]] spell.
=====Event Handlers=====
====doApplySettings====
Loads the settings from the "status.waitFor" section and installs event handlers to wait for other units.
===Reference Settings===
* [[#format_-_unit|status.waitFor]]
=====States=====
====status====
''Type:String'' ''Target:Instance''
The current status of this unit. It can be changed using the [[#change|change]] skill. Valid statuses are as follows:
* "starting"
* "started"
* "ready"
* "stopping"
* "stopped"
=====Skills=====
====change====
''Type:Undefined'' ''Target:Unit''
Changes the unit's status.
===Parameters===
|< 100% 180px 130px - >|
^Parameter^Type^Description^
|status|String|The unit's status. See [[#status|State - status]] for valid values.|
===Return Value===
None.
=====Spells=====
====wait====
''Type:Undefined'' ''Target:Unit''
Waits for other units to be specific status.
===Parameters===
|< 100% 180px 130px - >|
^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|waitForTimeout]] setting value is used.|
===Return Value===
None.
===Reference Settings===
* [[#waitfortimeout|status.options.waitForTimeout]]/[[#waitfortimeout|system.status.options.waitForTimeout]]