Skip to content

industry_react_util

Source: base/tealdef/gui/entity_window/industry_react_util.d.tl

Notes

React recipes of the industry and perk windows that show production rules (inputs, outputs, progress and duration) and the workers boost.

RuleDurationInfoParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:3

global record RuleDurationInfoParams

Notes

Result of IndustryReactUtil.GetRuleDurationTextAndBoosted.

Fields

Name Type Description
durationText string Formatted duration of one production cycle (in days, or minutes and seconds when no day length is set), optionally with the change due to delivery time.
boosted boolean True when the industry boost is above 1 (the rule runs faster).
slowdown boolean True when the text includes a duration change due to delivery time.

IndustryWindowRuleDurationParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:9

global record IndustryWindowRuleDurationParams

Notes

Parameters of IndustryReactUtil.IndustryWindowRuleDurationWidget.

Fields

Name Type Description
entity Engine.Entity Entity with the STOCK_LIST component holding the production rules.
ruleNumber integer 1-based index of the production rule.

RuleProgressBarParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:14

global record RuleProgressBarParams

Notes

Parameters of IndustryReactUtil.RuleProgressBar.

Fields

Name Type Description
entity Engine.Entity Entity with the STOCK_LIST component holding the production rules.
ruleNumber integer 1-based index of the production rule; when nil the first running non-booster rule is shown.
durationAsTooltip boolean Shows the cycle duration only as tooltip instead of a text below the bar.
invertProgressBar boolean Shows the remaining instead of the elapsed part of the cycle.

RuleInputOutputWidgetParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:21

global record RuleInputOutputWidgetParams

Notes

Parameters of IndustryReactUtil.IndustryWindowRuleInputOutputWidget.

Fields

Name Type Description
entity Engine.Entity Entity with the production rules.
ruleNumber integer 1-based index of the production rule.
isInput boolean Shows the rule's inputs (true) or outputs (false).
recipe Recipe<IndustryUtil.RuleInputOutputCargoParams> Recipe created once per cargo of the rule (with index set to the cargo's position).
isIndustry boolean Passed on to recipe; true for industries.
onlyOneProductionLine boolean Passed on to recipe; the base game sets it when the rule has no input cargo.

RuleWidgetParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:30

global record RuleWidgetParams

Notes

Parameters of IndustryReactUtil.ProductionRuleWidget.

Fields

Name Type Description
entity Engine.Entity Entity with the production rules.
ruleNumber integer 1-based index of the production rule.
durationAsTooltip boolean Not read by the widget, which always shows the duration as tooltip.
invertProgressBar boolean Not read by the widget, which always shows the elapsed part.
isBoosted boolean Adds the boosted style class.
isIndustry boolean True for industries; adds the "Max." label when the rule has input cargo.

RuleProgressBarParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:39

global record RuleProgressBarParams

Notes

Parameters of IndustryReactUtil.RuleProgressBar.

Fields

Name Type Description
entity Engine.Entity Entity with the STOCK_LIST component holding the production rules.
ruleNumber integer 1-based index of the production rule; when nil the first running non-booster rule is shown.
durationAsTooltip boolean Shows the cycle duration only as tooltip instead of a text below the bar.
invertProgressBar boolean Shows the remaining instead of the elapsed part of the cycle.

ProductionRulesWidgetParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:46

global record ProductionRulesWidgetParams

Notes

Parameters of IndustryReactUtil.ProductionRulesWidget.

Fields

Name Type Description
entity Engine.Entity Entity with the production rules.
isIndustry boolean True for industries.
maxLevel boolean Adds the note "Industry is expanded to it's full potential.".
failedToExpand boolean Adds the note "Industry is blocked from further expansion." (when maxLevel is false).

IconAndLabelParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:53

global record IconAndLabelParams

Notes

Parameters of IndustryReactUtil.IconAndLabelWidget.

Fields

Name Type Description
icon string Image path of the icon.
iconTooltip string Tooltip of the icon.
count string Text next to the icon.
countTooltip string Tooltip of the text.
annualCount string optional
annualCountTooltip string optional

ProductionIconWithBubbleParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:62

global record ProductionIconWithBubbleParams

Notes

Parameters of IndustryReactUtil.ProductionIconWithBubble.

Fields

Name Type Description
icon string Image path of the icon (e.g. a cargo icon).
iconTooltip string Tooltip of the icon.
count string Text in the bubble over the icon.
countTooltip string Tooltip of the bubble.

WorkplacesBoosterParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:69

global record WorkplacesBoosterParams

Notes

Parameters of IndustryReactUtil.WorkplacesBoosterRow.

Fields

Name Type Description
entity Engine.Entity Entity with a PERSON_CAPACITY component (workplaces).
boosted boolean Adds the boosted style class to the cells.

WorkplacesBoosterMinimumIconParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:74

global record WorkplacesBoosterMinimumIconParams

Notes

Parameters of the workers count icon in the workplaces booster row.

Fields

Name Type Description
entity Engine.Entity Entity with a PERSON_CAPACITY component.

WorkplacesBoosterProgressBarParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:78

global record WorkplacesBoosterProgressBarParams

Notes

Parameters of the workers progress bar in the workplaces booster row.

Fields

Name Type Description
entity Engine.Entity Entity with a PERSON_CAPACITY component.

WorkplacesBoostFactorIconParams

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:82

global record WorkplacesBoostFactorIconParams

Notes

Parameters of the boost factor icon in the workplaces booster row.

Fields

Name Type Description
entity Engine.Entity Entity with a PERSON_CAPACITY component.

IndustryReactUtil

record global base/tealdef/gui/entity_window/industry_react_util.d.tl:86

global record IndustryReactUtil

Load: local industry_react_util = ug_require "/gui/entity_window/industry_react_util.tl"

Notes

React recipes and helpers for production rules and the workers boost in the industry and perk windows.

Fields

Name Type Description
IndustryWindowRuleDurationWidget Recipe<IndustryWindowRuleDurationParams> Text with the cycle duration of a production rule, styled success when boosted.
RuleProgressBar Recipe<RuleProgressBarParams> Progress bar of the running cycle of a production rule, with the duration as tooltip or text; styled slowdown when delivery time slows it down. used 1× in the base game
IndustryWindowRuleInputOutputWidget Recipe<RuleInputOutputWidgetParams> Row with one recipe widget per input or output cargo of a production rule. used 2× in the base game
ProductionRuleWidget Recipe<RuleWidgetParams> One production rule as a bar split into inputs and outputs (cargo icons with amounts, current and maximum production) and a progress bar.
ProductionRulesWidget Recipe<ProductionRulesWidgetParams> All non-booster production rules of an entity, plus a note when the industry is fully expanded or blocked from expansion. used 3× in the base game
ProductionIconWithBubble Recipe<ProductionIconWithBubbleParams> Icon with a small text bubble on top, e.g. a cargo icon with its amount.
IconAndLabelWidget Recipe<IconAndLabelParams> Icon with a text next to it and an optional annual count below. used 1× in the base game
WorkplacesBoosterRow Recipe<WorkplacesBoosterParams> Table row showing the workers boost of an entity: current/required workers, a progress bar towards the required number (capacity times industry_productivity_util.RequiredWorkersFractionForBoost), the potential boost in percent and a tick icon. used 2× in the base game

Functions

makeIconAndLabel(icon : string, iconTooltip : string, count : string, countTooltip : string) : {TreeNodeId} base/tealdef/gui/entity_window/industry_react_util.d.tl:87

Call as industry_react_util.makeIconAndLabel

No description in the game files yet.

Returns {TreeNodeId}

isPersonCapacityBoosted(entity : Engine.Entity) : boolean base/tealdef/gui/entity_window/industry_react_util.d.tl:88

Call as industry_react_util.isPersonCapacityBoosted

Notes

Returns whether an entity with workplaces is currently boosted.

Parameter Type Description
entity Engine.Entity Entity with a PERSON_CAPACITY component.

Returns boolean: True if its industry boost is above 1; nil if it has no workplaces.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/perk/perk.tl:81

result.boosted = industry_react_util.isPersonCapacityBoosted(subconEntity)

GetRuleDurationTextAndBoosted(entity : Engine.Entity, ruleNumber : integer, showDecayFactor? : boolean) : RuleDurationInfoParams base/tealdef/gui/entity_window/industry_react_util.d.tl:90

Call as industry_react_util.GetRuleDurationTextAndBoosted

Notes

Calculates the cycle duration of a production rule as text.

Parameter Type Description
entity Engine.Entity Entity with the STOCK_LIST component.
ruleNumber integer 1-based index of the rule.
showDecayFactor? boolean Adds the change of the duration caused by the delivery time of the inputs.

Returns RuleDurationInfoParams: Duration text and boost/slowdown flags.

Details

While the rule is running, the interval of its last application is used; otherwise one game year divided by the rule's capacity, divided by the industry boost for non-booster rules.