Find out if your power reserves have gone negative, indicating that you have one or more tasks stalled due to lack of power... |
var power = queuedPower(player); |
Parameter | Type | Mandatory | Description | Game version |
---|---|---|---|---|
player | Number | ![]() | The player to inspect. | 3.2 |
Value | Type | Description | Game version |
---|---|---|---|
<power> | Number | A number representing the amount of power the player needs before all current production and research tasks can start. | 3.2 |
0 | Number | If the function returns 0, it means that you have a positive power reserve. See notes below for more info. | 3.2 |
<error> | Error | The player specified does not exist. There is no spoon. | 3.2 |
When you produce, build or research something, the cost of it has to be taken from your power reserves. If your power reserves are too low, the task will stall with a green progress bar while it waits for power income.
Power from derricks will be distributed to all tasks that are stalled waiting for power. As such, if you have lots of tasks (eg. several research tasks, a few factories trying to build droids, some trucks trying to build structures, etc) it could take a long time before any of them get the required power to progress to their production, building or construction phase.
For this reason, it's a good idea to check whether you have power in your reserves before starting a task. Ideally wait until there is power in your reserves (queuedPower() will be 0, playerPower() will be a positive number) before starting another task.
var powerRequired = queuedPower(me); if (!powerRequired) { // I have power in my power reserves } else { // My power reserves are empty and tasks are stalling waiting for power } |
Availability Requires:
|
ContentsJump to: |
See alsoRelated API features:
|