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
+10 -2
View File
@@ -392,7 +392,7 @@ func _perform_attack():
# Fallback to default unarmed attack
# Don't attack if already attacking
if _body and _body.animation_player and _body.animation_player.current_animation == "Attack1":
if _body and _body.animation_player and _body.animation_player.current_animation.begins_with("Attack"):
return
if _attack_timer > 0:
@@ -402,7 +402,9 @@ func _perform_attack():
# Play attack animation once
if _body:
_body.play_attack()
_body.play_attack("Attack_OneHand")
# Sync animation to other clients
_sync_attack_animation.rpc("Attack_OneHand")
# Find nearest enemy in range
var space_state = get_world_3d().direct_space_state
@@ -524,6 +526,12 @@ func _perform_dash():
# Animation is handled by the Body's animate function (Jump animation plays during dash)
## Sync attack animation to all clients
@rpc("any_peer", "call_remote", "unreliable")
func _sync_attack_animation(anim_name: String):
if _body:
_body.play_attack(anim_name)
## Override hurt animation from BaseUnit
func _play_hurt_animation():
if _body and _body.animation_player: