Skip to content

$type

14 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types).

get_enum_max

read-only
$type.get_enum_max(enum_name: string) -> int

Get the maximum value of an enum.

ParameterTypeMeaning
enum_namestringThe name of the enum type to check.

Returns int: The maximum value of the enum.

get_enum_min

read-only
$type.get_enum_min(enum_name: string) -> int

Get the minimum value of an enum.

ParameterTypeMeaning
enum_namestringThe name of the enum type to check.

Returns int: The minimum value of the enum.

get_enum_string

read-only
$type.get_enum_string(value: int, type: string, remove_prefix: string) -> string

Get the string representation of an enum value, optionally omitting the enum type prefix 'k_enum_type_'.

ParameterTypeMeaning
valueintThe integer value e.g. k_enum_type_foo
typestringThe enum type e.g. '_vgame_enum_type_t'
remove_prefixstringOptional prefix to remove e.g. specify 'k_enum_type_' if you want 'foo' returned instead of 'k_enum_type_foo'.

Returns string: The enum value as a string e.g. 'k_enum_type_foo'.

get_field_attribute

read-only
$type.get_field_attribute(field: string, attribute: string, default_value: var) -> var

Get the specified field's value for the specified attribute.

ParameterTypeMeaning
fieldstringField name.
attributestringAttribute name.
default_valuevar(Optional) Default value to return if attribute not found. If not specified, will warn of missing attribute.

Returns var: The value of the specified attribute for the field; otherwise NULL in the event of an error.

set_components_per_job

$type.set_components_per_job(value: int)

The maximum number of components of this type can that be batched into a single job. Components that read from other components of the same type, either directly or indirectly, should use 1 component per job.

ParameterTypeMeaning
valueintNumber for components that can be run in a single job.

set_dependency

$type.set_dependency(dependency: string)

Define a component dependency for the current script. A dependency is another component that this component requires in order to function. The editor will automatically add any missing dependencies to an entity when created.

ParameterTypeMeaning
dependencystringFile path

set_deterministic

$type.set_deterministic(value: bool)

Declare whether this component type is deterministic. Components are assumed to be deterministic by default. Disable determinism with extreme care.

ParameterTypeMeaning
valueboolWhether this component is deterministic.

set_field_attribute

$type.set_field_attribute(field: string, attribute: string, value: var)

Set an attribute on a constant field.

ParameterTypeMeaning
fieldstringField name (const in script).
attributestringAttribute name.
valuevarAttribute value.

set_field_edit_visible

$type.set_field_edit_visible(field_name: string, value: bool)

True by default. Set to false if a given field should not appear in editor.

ParameterTypeMeaning
field_namestringField name (const in script).
valueboolTrue if the field should be visible in editor, false otherwise.

set_job_sort_order

$type.set_job_sort_order(locked: bool, value: int)

Determines if job sort order is mostly fixed (exception being waiting on physics). If the order is fixed, sets the order value (lower values sort earlier). By default jobs have a dynamic sort order.

ParameterTypeMeaning
lockedboolIf true, the sort order is largely fixed.
valueintThe sort order value for this type.

set_job_stack_large

$type.set_job_stack_large(enable: bool)

Enable or disable large stack size for jobs that run this component.

ParameterTypeMeaning
enableboolIf true uses large stack, else uses normal stack.

set_priority

$type.set_priority(priority: int)

Set the priority for all components of the current script's type. Scripts with lower priority numbers go first in the event of a dependency cycle.

ParameterTypeMeaning
priorityintScript priority. Lowest breaks cycles.

set_tick_physics

$type.set_tick_physics(value: bool)

Declare whether this component type updates physics.

ParameterTypeMeaning
valueboolWhether this component updates physics.

setup_job_self_sort

$type.setup_job_self_sort(group: string)

Allows components of a specified group to be sorted among themselves. In cases of well defined intra-type dependencies, this can improve performance and reduce waits. See component.set_job_self_sort_order.

ParameterTypeMeaning
groupstringName of the group of which all types in the same group will sort against each other.