getDroidProduction()

(info) 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

Structure object

The structure object associated with the factory to check.

Valid structure types are:

  • FACTORY – capable of producing wheeled, half-tracked, tracked and hover propulsion droids

  • VTOL_FACTORY – capable of producing VTOLs (lift propulsion)

  • CYBORG_FACTORY – capable of producing cyborgs (cyborg legs propulsion)

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 null.

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]; } ); } );