From dee90d29518de6f5ac665873b2214f5a75ea3bdd Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 27 Mar 2026 18:14:29 -0700 Subject: [PATCH] fix: NPC/player attack animation uses weapon-appropriate anim ID NPC and other-player melee swing callback was hardcoded to animation 16 (unarmed attack). Now tries 17 (1H weapon), 18 (2H weapon) first with hasAnimation() check, falling back to 16 if neither exists on the model. --- src/core/application.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/application.cpp b/src/core/application.cpp index 5bf0d034..7c16b552 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -3356,7 +3356,18 @@ void Application::setupUICallbacks() { if (pit != playerInstances_.end()) instanceId = pit->second; } if (instanceId != 0) { - renderer->getCharacterRenderer()->playAnimation(instanceId, 16, false); // Attack + auto* cr = renderer->getCharacterRenderer(); + // Try weapon-appropriate attack anim: 17=1H, 18=2H, 16=unarmed fallback + static const uint32_t attackAnims[] = {17, 18, 16}; + bool played = false; + for (uint32_t anim : attackAnims) { + if (cr->hasAnimation(instanceId, anim)) { + cr->playAnimation(instanceId, anim, false); + played = true; + break; + } + } + if (!played) cr->playAnimation(instanceId, 16, false); } });