view_manager_util¶
Source: base/tealdef/gui/entity_window/view_manager_util.d.tl
Notes
Helpers that decide whether and for which entity a window is opened when an entity is selected.
ViewManagerUtil¶
record global base/tealdef/gui/entity_window/view_manager_util.d.tl:3
global record ViewManagerUtil
Load: local view_manager_util = ug_require "/gui/entity_window/view_manager_util.tl"
Notes
Helpers that decide whether and for which entity an entity window is opened.
Functions
baseNodeCanToggleDoubleSlipSwitch(Engine.Entity) : boolean base/tealdef/gui/entity_window/view_manager_util.d.tl:4
Call as view_manager_util.baseNodeCanToggleDoubleSlipSwitch
Notes
Returns whether a track node is a double slip switch that can be toggled.
| Parameter | Type | Description |
|---|---|---|
#1 |
Engine.Entity |
Node entity. |
Returns boolean: True if exactly four track segments meet at the node and exactly two pairs of them are nearly straight (angle between about 3 and 22 degrees).
Used in the base game: 4 times in 3 files
base/content/gui/gui/main/selector_react_util.tl:140
base/content/gui/gui/main/game_tooltips.tl:33
base/content/gui/gui/entity_window/make_entity_window.tl:651
baseNodeCanConfigTrafficLight(Engine.Entity) : boolean base/tealdef/gui/entity_window/view_manager_util.d.tl:6
Call as view_manager_util.baseNodeCanConfigTrafficLight
Notes
Returns whether a street node can have traffic lights configured.
| Parameter | Type | Description |
|---|---|---|
#1 |
Engine.Entity |
Node entity. |
Returns boolean: True if more than two street segments meet at the node.
wouldCreateView(entity : Engine.Entity, componentFilter? : {Engine.ComponentType : boolean}, withSoundEffect? : boolean) : Engine.Entity, {string}, boolean, Engine.Entity base/tealdef/gui/entity_window/view_manager_util.d.tl:8
Call as view_manager_util.wouldCreateView
Notes
Resolves which entity's window is opened when an entity is selected.
| Parameter | Type | Description |
|---|---|---|
entity |
Engine.Entity |
Selected entity (e.g. the entity under the mouse). |
componentFilter? |
{Engine.ComponentType : boolean} |
Optional set of component types; only these kinds of windows are considered. |
withSoundEffect? |
boolean |
Also look up the select sound effect of the entity. |
Returns Engine.Entity, {string}, boolean, Engine.Entity: The entity whose window is shown (e.g. the owning vehicle of a carriage, the station group of a station, the construction of a subconstruction) or nil if no window exists; the select sound effect file list; whether the title renames the construction instead of the subconstruction; and, for subconstructions, the original entity.
Details
Used by the view manager to open windows and by the HUD to decide which entities are hoverable.
Used in the base game: 6 times in 3 files
base/content/gui/gui/statistics/statistics.tl:416
base/content/gui/gui/entity_window/entity_window_hud.tl:873
base/content/gui/gui/entity_window/view_manager.tl:464
makeEntityReplaceAndComponentTypeFilter(componentTypes : {Engine.ComponentType}) : function(Engine.Entity) : boolean base/tealdef/gui/entity_window/view_manager_util.d.tl:11
Call as view_manager_util.makeEntityReplaceAndComponentTypeFilter
Notes
Creates a filter that accepts entities for which a window of one of the given component types would be opened.
| Parameter | Type | Description |
|---|---|---|
componentTypes |
{Engine.ComponentType} |
Component types to accept. |
Returns function(Engine.Entity) : boolean: Function returning true when wouldCreateView(entity, componentTypes) finds a window.
Used in the base game: 4 times in 4 files
base/content/gui/gui/layers/layer_react_util.tl:215
base/content/gui/gui/layers/layer_terrain.tl:215
base/content/gui/gui/layers/layer_noise.tl:210
filter = view_manager_util.makeEntityReplaceAndComponentTypeFilter(layer_noise.getHudIconPreFilter()),
base/content/gui/gui/layers/layer_pollution.tl:218