Other great resources: Official JS API docs, Scripting Forum
getDroidProduction()
- Aubergine
Owned by Aubergine
Determine what droid, if any, a factory is currently producing...
Syntax
var fakeDroid = getDroidProduction(factory);
Parameters
Parameter | Type | Mandatory | Notes | Game Version |
---|---|---|---|---|
factory | Structure object | The structure object associated with the factory to check. Valid structure types are:
| 3.2 |
Return values
Value | Type | Notes | Game Version |
---|---|---|---|
<fakeDroid> | Fake Droid object | If the factory is producing a droid, an fake droid object will be returned describing the properties of that droid. You cannot use this droid object with any other functions, it's for information purposes only. Listen to eventDroidBuilt() to get the real droid object once production is complete. | 3.2 |
null | Null | If the factory isn't producing anything, the function returns Note: You can also use structureIdle() to determine if a factory is idle (not producing anything) | 3.2 |
<error> | Error | Invalid parameters, or the factory was destroyed. | 3.2 |
Example
Build a list of all current factory production activities....
var production = []; // will contain list of droids being built var factoryTypes = [FACTORY, VTOL_FACTORY, CYBORG_FACTORY]; var fakeDroid; factoryTypes.forEach( function getListOf(factories) { enumStruct(me, factories).forEach( function inspect(factory) { fakeDroid = getDroidProduction(factory); if (fakeDroid) production.push[fakeDroid]; } ); } );
Availability 3.2+
Requires:
- Warzone 3.2 and above.
Contents
Jump to:
See also
Related articles:
- buildDroid() – tell a factory to build a droid
- eventDroidBuilt() – triggered when a factory finishes building a droid
- getDroidLimit() – determine droid production limits
- Droid object – the object type associated with droids
- Droids – a quick reference for API stuff relating to droids