Skip to content

eow_extension_util

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

Notes

Shared parameter interface and ownership helper for the extension points (plugins) of the entity windows.

EowExtensionUtil

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

global record EowExtensionUtil

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

Notes

Shared parts of the entity window extension points.

Functions

useOwnershipStepState(entity : Engine.Entity) : ReactStateT<OwnershipState> base/tealdef/gui/entity_window/eow_extension_util.d.tl:24

Call as eow_extension_util.useOwnershipStepState

Notes

React hook returning the ownership state of an entity, updated every step.

Parameter Type Description
entity Engine.Entity Entity to check.

Returns ReactStateT<OwnershipState>: React state; read it with :old().

Used in the base game: 13 times in 13 files

base/content/gui/gui/entity_window/station_group/station_group.tl:855

ownershipState = eow_extension_util.useOwnershipStepState(stationGroupEntityId):old(),
base/content/gui/gui/entity_window/maintenance_station/maintenance_station.tl:56
ownershipState = eow_extension_util.useOwnershipStepState(params.keyEntity):old(),
base/content/gui/gui/entity_window/warehouse/warehouse.tl:52
ownershipState = eow_extension_util.useOwnershipStepState(params.keyEntity):old(),
base/content/gui/gui/entity_window/sim_person/sim_person.tl:132
ownershipState = eow_extension_util.useOwnershipStepState(personEntityId):old(),
base/content/gui/gui/entity_window/animal/animal.tl:40
ownershipState = eow_extension_util.useOwnershipStepState(entityId):old(),
base/content/gui/gui/entity_window/vehicle/vehicle.tl:238
ownershipState = eow_extension_util.useOwnershipStepState(vehicleEntityId):old(),
… and 7 more files.

EowExtensionUtil.IEowWidgetsExtensionParams

interface base/tealdef/gui/entity_window/eow_extension_util.d.tl:4

interface IEowWidgetsExtensionParams

Notes

Base parameters passed to every plugin of an entity window extension point (e.g. VehicleEow.VehicleEowExtensionPoint).

Details

Plugins are registered by resource files of type "react-plugin ::<ExtensionPointName>" with data = { filePath = "<script>@<PluginRecipe>", condition = "<script>@<function>", order = <number> }. The window calls gui_react_util.usePlugins(extensionPoint, ..., extensionParams); plugins are shown in ascending order, and a plugin whose condition function returns false for the parameters is skipped.

Fields

Name Type Description
entityId Engine.Entity Entity shown by the window.
ownershipState OwnershipState Who owns the entity, see EowExtensionUtil.OwnershipState.
gameCtx GameContext Game context.
showCalloutOnRightSide boolean Whether info callouts of content cards are shown on the right side of the window.
firstWidgetRef ReactRefWrap
lastWidgetRef ReactRefWrap

Functions

setCollapsibleExpanded(string, boolean) base/tealdef/gui/entity_window/eow_extension_util.d.tl:11

Notes

Stores the expanded state of a collapsible content card by key.

getCollapsibleExpanded(string) base/tealdef/gui/entity_window/eow_extension_util.d.tl:12

Notes

Returns the stored expanded state of a collapsible content card by key.

EowExtensionUtil.OwnershipState

enum base/tealdef/gui/entity_window/eow_extension_util.d.tl:18

enum OwnershipState

Notes

Ownership of an entity from the local player's point of view.

Used in the base game: 4 times in 2 files

base/content/gui/gui/entity_window/eow_extension_util.tl:5

eow_extension_util.useOwnershipStepState = function(entity : Engine.Entity) : ReactStateT<EowExtensionUtil.OwnershipState>
base/content/gui/gui/entity_window/industry/industry.tl:37
local useOwnershipStepStateIndustry = function(entity : Engine.Entity) : ReactStateT<EowExtensionUtil.OwnershipState>

Value Description
"None" The entity has no PLAYER_OWNED component.
"Player" Owned by the local player.
"Foreign" Owned by another player.