Skip to content

fun_elements

Source: base/tealdef/game_mechanics/fun_elements/fun_elements.d.tl

Notes

State and helpers of the fun elements game script (airships over towns, UFOs abducting cows).

Globals

Types

Name Definition Description
BlimpUtil declared here, defined in BlimpUtil Airship that flies to a town when a marketing campaign starts there, circles it while the campaign runs, and then leaves the map.
UfoUtil declared here, defined in UfoUtil UFO that flies in from the map edge, lifts a cow from a livestock farm field and flies off again.

FunElementsState

record global base/tealdef/game_mechanics/fun_elements/fun_elements.d.tl:6

global record FunElementsState

Notes

Saved state of the game script ::/game_mechanics/fun_elements/fun_elements.gs.

Fields

Name Type Description
blimps {BlimpUtil.BlimpData} Airships in flight.
ufos {UfoUtil.UfoData} UFOs in flight.
spawnNextUfoAtGameTime number Game time (ms) of the next UFO, 2 to 4 game years after the previous one is gone.

FunElementType

enum global base/tealdef/game_mechanics/fun_elements/fun_elements.d.tl:13

global enum FunElementType

Notes

Kind of a fun element entity.

Value Description
"Blimp" Airship.
"Ufo" UFO.
"Cow" Cow spawned for a UFO to abduct.

FunElementsUtil

record global base/tealdef/game_mechanics/fun_elements/fun_elements.d.tl:19

global record FunElementsUtil

Load: local fun_elements_util = ug_require "/game_mechanics/fun_elements/fun_elements_util.tl"

Notes

Access to the fun elements state.

Functions

externalGetFunElementsState() : FunElementsState base/tealdef/game_mechanics/fun_elements/fun_elements.d.tl:20

Call as fun_elements_util.externalGetFunElementsState

Notes

Reads the state of the fun elements game script.

Returns FunElementsState: The state.

Used in the base game: 1 time in 1 file

base/content/gui/gui/entity_window/fun_elements/fun_elements_eow.script.tl:23

local funElementState = fun_elements_util.externalGetFunElementsState()

getFunElementType(entity : Engine.Entity) : FunElementType base/tealdef/game_mechanics/fun_elements/fun_elements.d.tl:21

Call as fun_elements_util.getFunElementType

Notes

Kind of fun element an entity is. The tooltip and the entity window use it.

Parameter Type Description
entity Engine.Entity Entity to check.

Returns FunElementType: The kind, or nil if the entity is no fun element.

Used in the base game: 3 times in 3 files

base/content/gui/gui/main/game_tooltips.tl:75

local funElementType = fun_elements_util.getFunElementType(entity)
base/content/gui/gui/entity_window/make_entity_window.tl:688
local funElementType = fun_elements_util.getFunElementType(entity)
base/content/gui/gui/entity_window/view_manager_util.tl:285
if fun_elements_util.getFunElementType(entity) ~= nil then

funElementTypeToString(elementType : FunElementType) : string base/tealdef/game_mechanics/fun_elements/fun_elements.d.tl:22

Call as fun_elements_util.funElementTypeToString

Notes

Translated name of a fun element kind ("Airship", "UFO", "Cow").

Parameter Type Description
elementType FunElementType Kind.

Returns string: The name, or nil for unknown kinds.

Used in the base game: 2 times in 2 files

base/content/gui/gui/main/game_tooltips.tl:77

local toolTip = fun_elements_util.funElementTypeToString(funElementType)
base/content/gui/gui/entity_window/make_entity_window.tl:704
fallbackTitle = fun_elements_util.funElementTypeToString(funElementType),