mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-28 09:33:52 +00:00
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:
parent
dce11a0d3f
commit
dee90d2951
1 changed files with 12 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue