Merge branch 'fix_lua_attack' into 'master'

Allow Actors to pick an attack type/animation when no AI applies (fix #7583)

Closes #7583

See merge request OpenMW/openmw!4102
esm4-texture
Alexei Kotov 7 months ago
commit e96ebec2cf

@ -1646,6 +1646,10 @@ namespace MWMechanics
std::string startKey = "start";
std::string stopKey = "stop";
MWBase::LuaManager::ActorControls* actorControls
= MWBase::Environment::get().getLuaManager()->getActorControls(mPtr);
const bool aiInactive
= actorControls->mDisableAI || !MWBase::Environment::get().getMechanicsManager()->isAIActive();
if (mWeaponType != ESM::Weapon::PickProbe && !isRandomAttackAnimation(mCurrentWeapon))
{
if (weapclass == ESM::WeaponType::Ranged || weapclass == ESM::WeaponType::Thrown)
@ -1669,6 +1673,8 @@ namespace MWMechanics
mAttackType = getMovementBasedAttackType();
}
}
else if (aiInactive)
mAttackType = getRandomAttackType();
// else if (mPtr != getPlayer()) use mAttackType set by AiCombat
startKey = mAttackType + ' ' + startKey;
stopKey = mAttackType + " max attack";

Loading…
Cancel
Save