Other great resources: Official JS API docs, Scripting Forum
getDroidProduction()
Determine what droid, if any, a factory is currently producing...
Syntax
var fakeDroid = getDroidProduction(factory);Parameters
Parameter | Type | Mandatory | Notes | Game Version |
|---|---|---|---|---|
factory | 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 | 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];
} );
} );