Skip to content

ChainMovement ​

Inherits: ProjectileMovement < RefCounted

Chain movement strategy - bounces between multiple targets Updated to support both Entity and InteractableObject targets

Variables ​

intmax_chains3
intcurrent_chain_count0
floatchain_range5.0
Variantcurrent_target
Array[Variant]previous_targets[]
boolallow_repeat_targetsfalse
ChainEffect.ChainTargetTypechain_target_filterChainEffect.ChainTargetType.ENAMY
floatarrival_threshold1.0
boolchain_finishedfalse

Methods ​

voidset_max_chains( max_count: int )
voidset_chain_range( range: float )
voidset_chain_target_filter( filter: ChainEffect.ChainTargetType )
voidset_allow_repeat_targets( allow: bool )
voidset_arrival_threshold( threshold: float )
intget_current_chain_count()
Variantget_current_chain_target()
Array[Variant]get_previous_targets()
boolis_chain_finished()
intget_remaining_chains()
floatget_distance_to_target()
Vector3get_target_position()
boolwants_to_continue()
voidcleanup()

Variable descriptions ​

int max_chains = 3 ​

Maximum number of chain bounces

int current_chain_count = 0 ​

Current chain count

float chain_range = 5.0 ​

Range to find next chain target

Variant current_target ​

Current target in the chain

Array[Variant] previous_targets = [] ​

Previous targets hit (to avoid infinite loops)

bool allow_repeat_targets = false ​

Whether to allow hitting the same target multiple times

ChainEffect.ChainTargetType chain_target_filter = ChainEffect.ChainTargetType.ENAMY ​

Team filter for chain targets

float arrival_threshold = 1.0 ​

Distance threshold to consider target reached

bool chain_finished = false ​

Whether chain movement is finished

Method descriptions ​

void set_max_chains( max_count: int ) ​

Set maximum number of chains

void set_chain_range( range: float ) ​

Set chain range

void set_chain_target_filter( filter: ChainEffect.ChainTargetType ) ​

Set target filter ("Enemy", "Ally", "All")

void set_allow_repeat_targets( allow: bool ) ​

Set whether to allow repeat targets

void set_arrival_threshold( threshold: float ) ​

Set arrival threshold

int get_current_chain_count() ​

Get current chain count

Variant get_current_chain_target() ​

Get current target in chain

Array[Variant] get_previous_targets() ​

Get previous targets hit

bool is_chain_finished() ​

Check if chain is finished

int get_remaining_chains() ​

Get remaining chains

float get_distance_to_target() ​

Override distance calculation to use current chain target

Vector3 get_target_position() ​

Override target position to use current chain target

bool wants_to_continue() ​

Check if chain movement wants to continue

void cleanup() ​

Override cleanup to reset chain state