Other great resources: Official JS API docs, Scripting Forum
queuedPower()
- Aubergine
Â
Syntax
var power = queuedPower(player);
Parameters
Parameter | Type | Mandatory | Description | Game version |
---|---|---|---|---|
player | Number | The player to inspect. | 3.2 |
Return value
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 |
Notes
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.
Example
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 3.1 B1+
Requires:
- Warzone 3.1 Beta 1 or above.
Contents
Jump to:
See also
Related API features:
- playerPower() –
- setPower() – give a player some power
- powerType – determine base power output per minute for an oil derrick
- setPowerModifier() – boost or reduce oil production
- donatePower() – transfer power to another player
Â