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.
This commit is contained in:
Kelsi 2026-03-27 18:14:29 -07:00
parent dce11a0d3f
commit dee90d2951

View file

@ -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);
}
});