Sword animations now sync

This commit is contained in:
Twirpytherobot
2025-11-21 22:59:41 +00:00
parent b1f1016475
commit 2ec7d56511
4 changed files with 26 additions and 9 deletions
+5 -2
View File
@@ -48,9 +48,12 @@ func perform_attack() -> bool:
if owner_character and owner_character.is_multiplayer_authority():
owner_character._attack_timer = weapon_data.attack_cooldown
# Play attack animation on owner
# Play attack animation on owner (use weapon's animation)
if owner_character._body:
owner_character._body.play_attack()
var anim_name = weapon_data.attack_animation if weapon_data.attack_animation else "Attack_OneHand"
owner_character._body.play_attack(anim_name)
# Sync animation to other clients
owner_character._sync_attack_animation.rpc(anim_name)
# Delay damage until animation hits (roughly 70% through the animation)
# This makes the damage apply when the swing actually connects