/tg/ Station 13 - Modules - TypesVar Details - Proc Details

element

A holder for simple behaviour that can be attached to many different types

Only one element of each type is instanced during game init. Otherwise acts basically like a lightweight component.

Vars

argument_hash_end_idxThe index of the last attach argument to consider for duplicate elements Only used when element_flags contains ELEMENT_BESPOKE. If not set, it'll copy every argument from argument_hash_start_idx onwards as normal
argument_hash_start_idxThe index of the first attach argument to consider for duplicate elements
element_flagsOption flags for element behaviour

Procs

AttachActivates the functionality defined by the element on the given target datum
DetachDeactivates the functionality defines by the element on the given datum
_detach_on_trait_removed3 is the length of fixed args of this proc, any further one is passed down to AddElement. We actually pass down a copy of the arguments since it's manipulated by the end of the proc.

Var Details

argument_hash_end_idx

The index of the last attach argument to consider for duplicate elements Only used when element_flags contains ELEMENT_BESPOKE. If not set, it'll copy every argument from argument_hash_start_idx onwards as normal

argument_hash_start_idx

The index of the first attach argument to consider for duplicate elements

All arguments from this index onwards (1 based, until argument_hash_end_idx is reached, if set) are hashed into the key to determine if this is a new unique element or one already exists

Is only used when flags contains ELEMENT_BESPOKE

This is infinity so you must explicitly set this

element_flags

Option flags for element behaviour

Proc Details

Attach

Activates the functionality defined by the element on the given target datum

Detach

Deactivates the functionality defines by the element on the given datum

_detach_on_trait_removed

3 is the length of fixed args of this proc, any further one is passed down to AddElement. We actually pass down a copy of the arguments since it's manipulated by the end of the proc.