Skip to content

app_util

Source: base/tealdef/scripts/app_util.d.tl

Notes

Types of /scripts/app_util.tl (AppUtil) for choosing between mouse and gamepad behaviour.

AppUtil

record global base/tealdef/scripts/app_util.d.tl:3

global record AppUtil

Load: local app_util = ug_require "::/scripts/app_util.tl" as AppUtil

Notes

Input-mode helpers returned by ug_require "/scripts/app_util.tl".

Functions

isGamepadInputMode() : boolean base/tealdef/scripts/app_util.d.tl:4

Call as app_util.isGamepadInputMode(…)

Notes

True if the game is currently in gamepad input mode.

Returns boolean

Used in the base game: 36 times in 13 files

base/content/game_mechanics/game_mechanics/emission/pollution_cleanup_facility_hud.script.tl:105

not app_util.isGamepadInputMode() and builtin.ActionTooltip{
base/content/gui/gui/entity_window/double_slip_switch.tl:16
local isGamepadState = engine_react_util.useStepState(app_util.isGamepadInputMode)
base/content/gui/gui/entity_window/industry/industry.tl:391
not app_util.isGamepadInputMode() and builtin.ActionTooltip{
base/content/gui/gui/entity_window/industry/industry_eow.script.tl:221
if app_util.isGamepadInputMode() then
base/content/gui/gui/entity_window/line/line_eow.script.tl:153
forceFocusable = app_util.isGamepadInputMode(),
base/content/gui/gui/entity_window/maintenance_station/maintenance_station_eow.script.tl:23
forceFocusable = app_util.isGamepadInputMode(),
… and 7 more files.

getMouseOrGamepad<MouseType, GamepadTypeT>(mouse : MouseType, gamepad : GamepadTypeT) : MouseType | GamepadTypeT base/tealdef/scripts/app_util.d.tl:5

Call as app_util.getMouseOrGamepad(…)

Notes

Returns gamepad in gamepad input mode, otherwise mouse.

Returns MouseType | GamepadTypeT

Example

crosshair = app_util.getMouseOrGamepad(false, true),
Used in the base game: 31 times in 16 files

base/content/gui/gui/context_helper/context_helper_react.tl:299

text = app_util.getMouseOrGamepad(_("HELP_CONSTRUCTION_GENERATOR_STREETS"), _("HELP_CONSTRUCTION_GENERATOR_STREETS_CONTROLLER")),
base/content/gui/gui/entity_window/town_building/town_building.tl:481
app_util.getMouseOrGamepad(builtin.ActionTooltip{
base/content/gui/gui/layers/layer_cargo.tl:298
terrainCirclePolicy = app_util.getMouseOrGamepad("Never", "FocusSelection"),
base/content/gui/gui/layers/layer_cargo_flow.tl:331
terrainCirclePolicy = app_util.getMouseOrGamepad("Never", "FocusSelection"),
base/content/gui/gui/layers/layer_civilization.tl:97
terrainCirclePolicy = app_util.getMouseOrGamepad("Never", "FocusSelection"),
base/content/gui/gui/layers/layer_infrastructure.tl:179
terrainCirclePolicy = app_util.getMouseOrGamepad("Never", "FocusSelection"),
… and 10 more files.