Skip to content

EntityAnimationPlayer ​

Inherits: AnimationPlayer

EntityAnimationPlayer A specialized AnimationPlayer for game entities with robust animation state management.

Variables ​

boolanimations_blockedfalse
boolanimations_death_blockedfalse
Stringcurrent_stance_tag"" # Animation name from WeaponClassDefinition.stance_tag
boolcurrent_combat_modefalse
Dictionaryfallback_chains{ ... }
ChronoManagerchrono_manager

Methods ​

voidsetup_animations( system_hub: GameHost.SystemHub, entity_data: EntityDefinition )
voidsetup_animation_tree( tree_resource_path: String = DEFAULT_TREE_PATH )
voidset_free_movement_look( air: bool, pose: String = "" )
voidset_free_vertical_motion( fraction: float )
voidplay_movement( movement_data: MovementData )
voidplay_turning_animation( turn_direction: float, is_crouched: bool = false, is_swimming: bool = false )
voidset_turn_direction( turn_direction: float )
voidstop_turning_animation()
voidplay_casting_animation( ability_selection: AnimationSelectionAbility, weapon_type: String = "" )
voidplay_ability_animation( ability_selection: AnimationSelectionAbility, weapon_type: String = "" )
voidstop_casting_animation()
voidstop_ability_animation()
voidcancel_casting_animation()
voidstop_upper_body_animation()
voidplay_social_animation( social_selection: AnimationSelectionSocial, context: String = "" )
voidplay_jump_animation()
voidplay_falling_animation()
voidplay_land_animation( impact_level: int )
voidplay_combat_animation( animation_type: String, weapon_type: String = "" )
boolplay_trigger_animation( slots: PackedStringArray, weapon_tag: String = "" )
boolplay_status_effect_start_animation( status_name: String, speed: float = 1.0 )
boolplay_status_effect_loop_animation( status_name: String, speed: float = 1.0 )
boolplay_status_effect_end_animation( status_name: String, speed: float = 1.0 )
voidstop_status_effect_animation()
boolhas_status_effect_animation( status_name: String, phase: String )
floatget_status_effect_animation_duration( status_name: String, phase: String )
voidplay_block_animation( weapon_type: String = "" )
boolplay_profile_clip( weapon_tag: String, role: String )
voidplay_dodge_animation( weapon_type: String = "" )
voidplay_hit_animation( weapon_type: String = "" )
voidplay_equipment_animation( action: String, weapon_type: String )
voidplay_sheathe_animation( weapon_type: String )
voidplay_unsheathe_animation( weapon_type: String )
voidplay_death_animation()
voidreset_from_death()
voidset_stance_tag( stance_tag: String )
voidenter_combat_mode()
voidexit_combat_mode()
voidplay_interaction_animation( interaction_type: String )
voidcleanup_timers()
boolis_animation_almost_complete()

Signals ​

animation_motion_sound_trigger( message: String ) ​

Signal emitted when an animation should trigger a sound effect

Enumerations ​

enum AnimationName ​

Every animation slot the player knows (idle, walk, run, turn, jump, fall, swim, combat, death ...). Each slot is mapped to a real animation of the model by the animation map.

  • NONE = 0
  • IDLE_STANDING = 1
  • IDLE_CROUCH = 2
  • IDLE_SWIM = 3
  • WALK_F = 4
  • WALK_B = 5
  • WALK_L = 6
  • WALK_R = 7
  • WALK_FL = 8
  • WALK_FR = 9
  • WALK_BL = 10
  • WALK_BR = 11
  • CROUCH_WALK_F = 12
  • CROUCH_WALK_B = 13
  • CROUCH_WALK_L = 14
  • CROUCH_WALK_R = 15
  • CROUCH_WALK_FL = 16
  • CROUCH_WALK_FR = 17
  • CROUCH_WALK_BL = 18
  • CROUCH_WALK_BR = 19
  • RUN_F = 20
  • RUN_B = 21
  • RUN_L = 22
  • RUN_R = 23
  • RUN_FL = 24
  • RUN_FR = 25
  • RUN_BL = 26
  • RUN_BR = 27
  • SPRINT_F = 28
  • SPRINT_B = 29
  • SPRINT_L = 30
  • SPRINT_R = 31
  • SPRINT_FL = 32
  • SPRINT_FR = 33
  • SPRINT_BL = 34
  • SPRINT_BR = 35
  • STRAFE_L = 36
  • STRAFE_R = 37
  • STRAFE_LF = 38
  • STRAFE_LB = 39
  • STRAFE_RF = 40
  • STRAFE_RB = 41
  • TURN_STANDING_90_L = 42
  • TURN_STANDING_90_R = 43
  • TURN_STANDING_180_L = 44
  • TURN_STANDING_180_R = 45
  • TURN_CROUCH_90_L = 46
  • TURN_CROUCH_90_R = 47
  • TURN_CROUCH_180_L = 48
  • TURN_CROUCH_180_R = 49
  • JUMP_IDLE = 50
  • JUMP_RUNNING = 51
  • FALL_START = 52
  • FALL_LOOP = 53
  • LAND_SOFT = 54
  • LAND_MEDIUM = 55
  • LAND_HARD = 56
  • SWIM_F = 57
  • SWIM_B = 58
  • SWIM_L = 59
  • SWIM_R = 60
  • SWIM_FL = 61
  • SWIM_FR = 62
  • SWIM_BL = 63
  • SWIM_BR = 64
  • COMBAT_IDLE_UNARMED = 65
  • COMBAT_IDLE_SHIELD = 66
  • COMBAT_IDLE_DUAL_WIELD = 67
  • COMBAT_IDLE_OFF_HAND = 68
  • COMBAT_IDLE_ONE_HAND = 69
  • COMBAT_IDLE_TWO_HAND = 70
  • COMBAT_IDLE_RANGED_WEAPON = 71
  • COMBAT_IDLE_BOW = 72
  • COMBAT_IDLE_POLEARM = 73
  • BLOCK_UNARMED = 74
  • BLOCK_SHIELD = 75
  • BLOCK_DUAL_WIELD = 76
  • BLOCK_OFF_HAND = 77
  • BLOCK_ONE_HAND = 78
  • BLOCK_TWO_HAND = 79
  • BLOCK_RANGED_WEAPON = 80
  • BLOCK_BOW = 81
  • BLOCK_POLEARM = 82
  • BLOCK_CASTING = 83
  • DODGE = 84
  • HIT = 85
  • SHEATHE_ONE_HAND = 86
  • SHEATHE_TWO_HAND = 87
  • SHEATHE_DUAL_WIELD = 88
  • SHEATHE_OFF_HAND = 89
  • SHEATHE_BOW = 90
  • SHEATHE_RANGED_WEAPON = 91
  • SHEATHE_POLEARM = 92
  • UNSHEATHE_ONE_HAND = 93
  • UNSHEATHE_TWO_HAND = 94
  • UNSHEATHE_DUAL_WIELD = 95
  • UNSHEATHE_OFF_HAND = 96
  • UNSHEATHE_BOW = 97
  • UNSHEATHE_RANGED_WEAPON = 98
  • UNSHEATHE_POLEARM = 99
  • DEATH_DEFAULT = 100
  • DEATH_SWIM = 101
  • LOOT = 102
  • SHORT_INTERACT = 103
  • LOOP_INTERACT = 104
  • PUSH = 105
  • PULL = 106
  • CLIMB = 107
  • SWIM_UP = 108
  • SWIM_DOWN = 109
  • IDLE_FLY = 110
  • FLY_F = 111
  • FLY_B = 112
  • FLY_L = 113
  • FLY_R = 114
  • FLY_FL = 115
  • FLY_FR = 116
  • FLY_BL = 117
  • FLY_BR = 118
  • FLY_UP = 119
  • FLY_DOWN = 120

Constants ​

  • String DEFAULT_TREE_PATH = "res://addons/chroniclenode/runtime_classes/entity/components/rig/animation_m... - Constants
  • float MOVEMENT_BLEND_DURATION = 0.5 - How many seconds a movement animation takes to blend into the next.
  • float BLEND_FADE_IN_TIME = 0.5 - How many seconds an action animation takes to fade in.
  • float BLEND_FADE_OUT_TIME = 0.5 - How many seconds an action animation takes to fade out.
  • String MOVING_STATE_MACHINE = "MovingStateMachine" - Animation Tree Node Names
  • String MOVING_STATE_TIME_SCALE = "MovingStateTimeScale" - The name of the speed parameter of the moving state in the animation tree.
  • String TURNING_BLEND = "TurningBlend" - The name of the blend parameter of the turn in the animation tree.
  • String TURN_BLEND_SPACE = "TurnBlendSpace" - The name of the blend space of the turn in the animation tree.
  • String FULL_BODY_CASTING = "FullBodyCasting" - The name of the full body casting node in the animation tree.
  • String FULL_BODY_ACTION = "FullBodyAction" - The name of the full body action node in the animation tree.
  • String FULL_BODY_ONE_SHOT = "FullBodyOneshot" - The name of the full body one shot node in the animation tree.
  • String FULL_BODY_TIME_SCALE = "FullBodyTimeScale" - The name of the full body speed parameter in the animation tree.
  • String FULL_BODY_BLEND = "FullBodyBlend" - The name of the full body blend parameter in the animation tree.
  • String UPPER_BODY_CASTING = "UpperBodyCasting" - The name of the upper body casting node in the animation tree.
  • String UPPER_BODY_ACTION = "UpperBodyAction" - The name of the upper body action node in the animation tree.
  • String UPPER_BODY_ONE_SHOT = "UpperBodyOneshot" - The name of the upper body one shot node in the animation tree.
  • String UPPER_BODY_TIME_SCALE = "UpperBodyTimeScale" - The name of the upper body speed parameter in the animation tree.
  • String UPPER_BODY_BLEND = "UpperBodyBlend" - The name of the upper body blend parameter in the animation tree.
  • String STANDING_LOCOMOTION = "StandingLocomotion" - The name of the standing locomotion blend space in the animation tree.
  • String SWIMMING_LOCOMOTION = "SwimmingLocomotion" - The name of the swimming locomotion blend space in the animation tree.
  • String CROUCHING_LOCOMOTION = "CrouchingLocomotion" - The name of the crouching locomotion blend space in the animation tree.
  • String DEATH_ANIMATION = "DeathAnimation" - The name of the death animation node in the animation tree.
  • String DEATH_BLEND = "DeathBlend" - The name of the death blend parameter in the animation tree.
  • String JUMP = "Jump" - Movement State Machine States
  • String FALL_START = "FallStart" - The name of the fall start node in the animation tree.
  • String FALL_LOOP = "FallLoop" - The name of the fall loop node in the animation tree.
  • String LAND_SOFT = "LandSoft" - The name of the soft landing node in the animation tree.
  • String LAND_MEDIUM = "LandMedium" - The name of the medium landing node in the animation tree.
  • String LAND_HARD = "LandHard" - The name of the hard landing node in the animation tree.
  • float VERTICAL_BLEND = 2.0 - How far up and down the swimming blend space reaches: the swim up and swim down animations sit at (0, VERTICAL_BLEND) and (0, -VERTICAL_BLEND), beyond the ring of the swim animations, so swimming or flying up and sideways blends the two and the usual positions (inside the ring) are not changed.
  • String DEFAULT_UNARMED_STANCE = "combat_idle" - Default stance animation when unarmed
  • Array[float] TURN_POSITIONS = [-1.0, -0.5, 0.0, 0.5, 1.0] - Turn blend space layout, by blend POSITION (not point index - the order of points inside the tree resource is not guaranteed, and it did not match the order assumed here before): -1.0 = turn 180 left, -0.5 = turn 90 left, 0.0 = idle (center), 0.5 = turn 90 right, 1.0 = turn 180 right

Variable descriptions ​

bool animations_blocked = false ​

State Management

bool animations_death_blocked = false ​

True once the entity died: no animation but the death one plays.

String current_stance_tag = "" # Animation name from WeaponClassDefinition.stance_tag ​

The stance of the weapon in hand (the stance tag of its weapon class), which picks the animations.

bool current_combat_mode = false ​

True while the entity is in its combat stance.

Dictionary fallback_chains ​

Smart fallback mapping for missing animations

ChronoManager chrono_manager ​

ChronoManager ref

Method descriptions ​

void setup_animations( system_hub: GameHost.SystemHub, entity_data: EntityDefinition ) ​

Builds the player for an entity: reads the animation map of its definition.

void setup_animation_tree( tree_resource_path: String = DEFAULT_TREE_PATH ) ​

Sets up the animation tree from a tree resource (the default one if none is given). Needs setup_animations first.

void set_free_movement_look( air: bool, pose: String = "" ) ​

What the entity does in a free movement mode: air plays the flying animations (they fall back to the swimming ones), pose is the name of one animation that plays instead of all of them (empty = none). The claim on the movement of the entity says it (see MovementClaim).

void set_free_vertical_motion( fraction: float ) ​

How fast the entity moves up (1) or down (-1) in a free movement mode, as a share of its vertical speed. The swimming blend moves towards the swim up or swim down animation with it.

void play_movement( movement_data: MovementData ) ​

Plays the movement animation for the movement data (direction, speed, stance).

void play_turning_animation( turn_direction: float, is_crouched: bool = false, is_swimming: bool = false ) ​

Plays a turn in place, to the left or right (a negative direction is left).

void set_turn_direction( turn_direction: float ) ​

Updates only the turn direction of a turn that is already playing. Does not touch the clips, the loop setup or the fade, so it is safe to call while turning.

void stop_turning_animation() ​

Stops the turn animation.

void play_casting_animation( ability_selection: AnimationSelectionAbility, weapon_type: String = "" ) ​

Plays the casting animation of an ability (for the weapon type in hand).

void play_ability_animation( ability_selection: AnimationSelectionAbility, weapon_type: String = "" ) ​

Plays the animation of an ability (for the weapon type in hand).

void stop_casting_animation() ​

Ends the casting animation.

void stop_ability_animation() ​

Ends the ability animation.

void cancel_casting_animation() ​

Cuts the casting animation short (the cast was interrupted).

void stop_upper_body_animation() ​

Stops what the upper body plays.

void play_social_animation( social_selection: AnimationSelectionSocial, context: String = "" ) ​

Play a social animation using AnimationSelectionSocial

void play_jump_animation() ​

Plays the jump.

void play_falling_animation() ​

Plays the fall.

void play_land_animation( impact_level: int ) ​

Plays the landing, softer or harder by the impact level.

void play_combat_animation( animation_type: String, weapon_type: String = "" ) ​

Plays a combat animation by its type (attack, hit, dodge ...) for the weapon type in hand.

bool play_trigger_animation( slots: PackedStringArray, weapon_tag: String = "" ) ​

Plays the animation of a trigger (a dodge, a parry ...): the clip of its slot in the animation map for the weapon in hand, or of the next slot of slots (the ones it falls back to). False when the creature has none

bool play_status_effect_start_animation( status_name: String, speed: float = 1.0 ) ​

Play status effect start animation using AnimationTree

bool play_status_effect_loop_animation( status_name: String, speed: float = 1.0 ) ​

Play status effect loop animation (continuous until effect ends)

bool play_status_effect_end_animation( status_name: String, speed: float = 1.0 ) ​

Play status effect end animation

void stop_status_effect_animation() ​

Stop status effect animations and return to normal state

bool has_status_effect_animation( status_name: String, phase: String ) ​

Check if a status effect animation phase exists

float get_status_effect_animation_duration( status_name: String, phase: String ) ​

Get the duration of a status effect animation phase

void play_block_animation( weapon_type: String = "" ) ​

Simple wrapper functions for backwards compatibility Plays a block. weapon_type is the animation tag of the weapon in hand: when it is a Weapon Profile with block clips, one of them is played; otherwise the block of the animation map for the weapon type

bool play_profile_clip( weapon_tag: String, role: String ) ​

Plays one of the clips (picked at random) of a role of a Weapon Profile as a combat one-shot. False when the tag is not a profile or the role has no clip this creature has

void play_dodge_animation( weapon_type: String = "" ) ​

Plays the dodge. weapon_type is the animation tag of the weapon in hand: a Weapon Profile with dodge clips plays one of them; with none (or no weapon given) the dodge of the animation map plays

void play_hit_animation( weapon_type: String = "" ) ​

Plays the animation of being hit. weapon_type as for the dodge: the profile's hit clips first, else the hit of the animation map

void play_equipment_animation( action: String, weapon_type: String ) ​

For sheathe/unsheathe (simpler since they're single animations, not arrays) weapon_type is the animation tag of the weapon: a Weapon Profile with sheathe or unsheathe clips plays one of them, otherwise the fixed lists of the animation map for the weapon type

void play_sheathe_animation( weapon_type: String ) ​

Plays putting the weapon away.

void play_unsheathe_animation( weapon_type: String ) ​

Plays drawing the weapon.

void play_death_animation() ​

Plays the death animation and blocks the others.

void reset_from_death() ​

Lets the animations play again after a resurrection.

void set_stance_tag( stance_tag: String ) ​

Set the combat stance animation tag from WeaponClassDefinition.stance_tag Called by Entity when equipment changes

void enter_combat_mode() ​

Switches the idle and movement animations to the combat ones.

void exit_combat_mode() ​

Switches back to the normal idle and movement animations.

void play_interaction_animation( interaction_type: String ) ​

Plays the animation of an interaction (open, use, pick up ...).

void cleanup_timers() ​

Stops the tweens and timers of the player.

bool is_animation_almost_complete() ​

Is the animation playing now almost at its end?