Module IndustryUnit

An industry unit is a machine designed to produce different types of elements.

Element class: IndustryUnit

  • IndustryUnit: Transfer Unit
  • Industry1: Basic Industry Units
  • Industry2: Uncommon Industry Units
  • Industry3: Advanced Industry Units
  • Industry4: Rare Industry Units

Extends: Element

Functions

start () Deprecated: Start the production, and it will run unless it is stopped or the input resources run out.
startRun () Start the production, will run unless it is stopped or the input resources run out.
startAndMaintain (quantity) Deprecated: Start maintaining the specified quantity.
startMaintain (quantity) Start maintaining the specified quantity.
batchStart (numBatches) Deprecated: Start the production of numBatches and then stop.
startFor (numBatches) Start the production of numBatches and then stop.
softStop () Deprecated: End the job and stop.
hardStop (allowIngredientLoss) Deprecated: Stop production immediately.
stop (force, allowLoss) Stop the production of the industry unit.
getStatus () Deprecated: Get the status of the industry.
getState () Returns the current running state of the industry.
getInfo () Returns the complete information of the industry.
getCycleCountSinceStartup () Deprecated: Get the count of completed cycles since the player started the unit.
getCyclesCompleted () Get the count of completed cycles since the player started the unit.
getEfficiency () Get the efficiency of the industry.
getUptime () Returns the time elapsed in seconds since the player started the unit for the latest time.
setCurrentSchematic (id) Deprecated: Set the loaded schematic, based on its id.
setOutput (itemId) Set the item to produce from its ID.
getCurrentSchematic () Deprecated: Get the id of the currently loaded schematic.
getOutputs () Returns the list of IDs of the items currently produced.
getInputs () Returns the list of items required to run the selected output product.
updateBank () Send a request to get an update of the contents of the schematic bank, limited to one call allowed per 30 seconds.
getBank () Returns a table describing the contents of the schematic bank, as a pair itemId and quantity per slot.
EVENT_onStarted (id, quantity) Event: Emitted when the industry unit has started a new production process per product.
EVENT_completed () Deprecated: Event: Emitted when the industry unit has completed a run.
EVENT_onCompleted (id, quantity) Event: Emitted when the industry unit has completed a run per product.
EVENT_statusChanged (status) Deprecated: Event: Emitted when the industry status has changed.
EVENT_onStatusChanged (status) Event: Emitted when the industry status has changed.

Tables

State State labels.


Functions

start ()
Deprecated: Start the production, and it will run unless it is stopped or the input resources run out.

This method is deprecated: startRun should be used instead

See also:

startRun ()
Start the production, will run unless it is stopped or the input resources run out.
startAndMaintain (quantity)
Deprecated: Start maintaining the specified quantity. Resumes production when the quantity in the output container is too low, and pauses production when it is equal or higher.

This method is deprecated: startMaintain should be used instead

Parameters:

  • quantity int Quantity to maintain inside output containers.

See also:

startMaintain (quantity)
Start maintaining the specified quantity. Resumes production when the quantity in the output container is too low, and pauses production when it is equal or higher.

Parameters:

  • quantity int Quantity to maintain inside output containers.
batchStart (numBatches)
Deprecated: Start the production of numBatches and then stop.

This method is deprecated: startFor should be used instead

Parameters:

  • numBatches int Number of batches to run before unit stops.

See also:

startFor (numBatches)
Start the production of numBatches and then stop.

Parameters:

  • numBatches int Number of batches to run before unit stops.
softStop ()
Deprecated: End the job and stop. The production keeps going until it is complete, then it switches to "STOPPED" status. If the output container is full, then it switches to "JAMMED".

This method is deprecated: stop should be used instead

See also:

hardStop (allowIngredientLoss)
Deprecated: Stop production immediately. The resources are given back to the input container. If there is not enough room in the input containers, production stoppage is skipped if `allowIngredientLoss` is set to 0, or ingredients are lost if set to 1.

This method is deprecated: stop should be used instead

Parameters:

  • allowIngredientLoss 0/1 0 = forbid loss, 1 = enable loss.

See also:

stop (force, allowLoss)
Stop the production of the industry unit.

Parameters:

  • force bool True if you want to force the production to stop immediately (optional, defaults to false).
  • allowLoss bool True if you want to allow the industry unit to lose components when recovering in-use components (optional, defaults to false).
getStatus ()
Deprecated: Get the status of the industry.

This event is deprecated: getState should be used instead.

Returns:

    string The status of the industry can be: STOPPED, RUNNING, JAMMED_MISSING_INGREDIENT, JAMMED_OUTPUT_FULL, JAMMED_NO_OUTPUT_CONTAINER.

See also:

getState ()
Returns the current running state of the industry.

Returns:

    int The current running state of the industry. See State for possible values.

See also:

getInfo ()
Returns the complete information of the industry.

Returns:

    table The complete state of the industry, a table with fields {[integer] state, [bool] stopRequested, [integer] schematicsRemaining, [integer] unitsProduced, [integer] remainingTime, [integer] batchesRequested, [integer] batchesRemaining, [number] maintainProductAmount, [integer] currentProductAmmount, [table] currentProducts:{{[integer] id, [number] quantity},...}}
getCycleCountSinceStartup ()
Deprecated: Get the count of completed cycles since the player started the unit.

This method is deprecated: getCyclesCompleted should be used instead

Returns:

    int The count of completed cycles since startup.

See also:

getCyclesCompleted ()
Get the count of completed cycles since the player started the unit.

Returns:

    int The count of completed cycles since startup.
getEfficiency ()
Get the efficiency of the industry.

Returns:

    float The efficiency rate between 0 and 1.
getUptime ()
Returns the time elapsed in seconds since the player started the unit for the latest time.

Returns:

    float The time elapsed in seconds.
setCurrentSchematic (id)
Deprecated: Set the loaded schematic, based on its id. Use getCurrentSchematic to learn about your schematic id. Does not work while the industry unit is running.

This method is deprecated: setOutput should be used instead

Parameters:

  • id int The schematic id to be loaded.

See also:

setOutput (itemId)
Set the item to produce from its ID.

Parameters:

  • itemId int The item ID of the item to produce.

Returns:

    int The result of the operation: 0 for a success, -1 if the industry is running.
getCurrentSchematic ()
Deprecated: Get the id of the currently loaded schematic.

This method is deprecated: getOutputs should be used instead

Returns:

    int The schematic id or 0 if no valid schematic is loaded.

See also:

getOutputs ()
Returns the list of IDs of the items currently produced.

Returns:

    table The first entry in the table is always the main product produced.
getInputs ()
Returns the list of items required to run the selected output product.

Returns:

    table Returns the list of inputs.
updateBank ()
Send a request to get an update of the contents of the schematic bank, limited to one call allowed per 30 seconds.

Returns:

    float If the request is not yet possible, returns the remaining time to wait for.
getBank ()
Returns a table describing the contents of the schematic bank, as a pair itemId and quantity per slot.

Returns:

    table The content of the schematic bank as a table with fields {[integer] id, [number] quantity} per slot.
EVENT_onStarted (id, quantity)
Event: Emitted when the industry unit has started a new production process per product.

Note: This is documentation on an event handler, not a callable method.

Parameters:

  • id int The item ID of the product.
  • quantity float The quantity to be produced.
EVENT_completed ()
Deprecated: Event: Emitted when the industry unit has completed a run.

Note: This is documentation on an event handler, not a callable method.

This event is deprecated: EVENT_onCompleted should be used instead.

See also:

EVENT_onCompleted (id, quantity)
Event: Emitted when the industry unit has completed a run per product.

Note: This is documentation on an event handler, not a callable method.

Parameters:

  • id int The item ID of the product.
  • quantity float The quantity produced.
EVENT_statusChanged (status)
Deprecated: Event: Emitted when the industry status has changed.

Note: This is documentation on an event handler, not a callable method.

This event is deprecated: EVENT_onStatusChanged should be used instead.

Parameters:

  • status string The status of the industry can be: STOPPED, RUNNING, JAMMED_MISSING_INGREDIENT, JAMMED_OUTPUT_FULL, JAMMED_NO_OUTPUT_CONTAINER.

See also:

EVENT_onStatusChanged (status)
Event: Emitted when the industry status has changed.

Note: This is documentation on an event handler, not a callable method.

Parameters:

  • status int The state of the industry. See State for possible values.

See also:

Tables

State
State labels.

Note: These are grouped in a table for documentation purposes only, this table doesn't exist in-game.

Fields:

  • [1] Stopped
  • [2] Running
  • [3] Jammed missing ingredient
  • [4] Jammed output full
  • [5] Jammed no output container
  • [6] Pending
  • [7] Jammed missing schematics
generated by LDoc 1.4.6 Last updated 2022-12-01 00:36:00