Production Line

public sealed class ProductionLine

Unlike the other pages in this partition, ProductionLine is not a unit module itself (it does not implement IUnitModule) — it is a plain helper object owned by the Production module.

Every entry of a unit’s Production Categories list gets its own ProductionLine instance, which tracks that category’s build queue and build progress independently from the other lines.

Main members

Category - the ProductionCategoryData this line was created for.

UnitsQueue - the list of UnitData currently queued to be built by this line, in build order.

TimeToBuildCurrentUnit - remaining build time (in seconds) for the unit currently at the front of the queue.

AvailableUnits - shortcut to Category.AvailableUnits, the list of unit types this line is allowed to build.

Main methods

AddUnitToQueue(UnitData, Player) - adds a unit to the queue and spends the owner player’s resources, if they can afford it.

TryCancelUnitProducing(UnitData) / RemoveUnitFromQueue(UnitData) - removes a unit from the queue. Prefer TryCancelUnitProducing, which also refunds the spent resources; RemoveUnitFromQueue is for advanced usage only.

FinishProduce() - finishes production of the unit at the front of the queue.

GetBuildProgressPercents() - returns the current build progress of the front unit in the queue, from 0 to 1.

IsUnitTypeProducingNow(UnitData) / IsUnitTypeInQueue(UnitData) / IsUnitReady() - convenience checks for the current queue state.

You normally don’t create a ProductionLine yourself — the Production module creates one line per production category automatically. You can access existing lines through Production.Lines or Production.TryGetLine(category, out line).