1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:29:55 +00:00

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
This commit is contained in:
Alexei Kotov 2024-05-19 20:40:09 +00:00
commit e96ebec2cf

View file

@ -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";