Dev » Lua API » state
← Back to all classes

state

Definitions & Systems 3 Properties 1 Methods

state

The state class represents an active status effect instance (buff or debuff) currently attached to an entity.

Overview

Properties (3)

Property Type Summary
definition string State definition ID string.
duration number Duration of the state in seconds.
value number Magnitude or intensity value of the status effect.

Methods (1)

Method Signature Returns Summary
state.new(definition, value, duration) state Creates a new state instance.

Detailed Reference

# definition PROPERTY
state.definition
State definition ID string.
Parameters
None
Returns
string

State definition ID string.

Description

Returns the definition ID of the state (e.g. "poison").

# duration PROPERTY
state.duration
Duration of the state in seconds.
Parameters
None
Returns
number

Remaining or total duration in seconds.

Description

Duration of the status effect.

# value PROPERTY
state.value
Magnitude or intensity value of the status effect.
Parameters
None
Returns
number

Intensity value.

Description

Returns the strength or intensity of the active state.

# new METHOD
state.new(definition, value, duration)
Creates a new state instance.
Parameters
ParameterTypeDefaultDescription
definitionstatedef

State definition descriptor.

valuenumber

Intensity value.

durationnumber

Duration in seconds.

Returns
state

Newly constructed state instance.

Description

Constructs an unattached state instance.