mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 12:40:25 +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:
commit
e96ebec2cf
1 changed files with 6 additions and 0 deletions
|
@ -1646,6 +1646,10 @@ namespace MWMechanics
|
||||||
std::string startKey = "start";
|
std::string startKey = "start";
|
||||||
std::string stopKey = "stop";
|
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 (mWeaponType != ESM::Weapon::PickProbe && !isRandomAttackAnimation(mCurrentWeapon))
|
||||||
{
|
{
|
||||||
if (weapclass == ESM::WeaponType::Ranged || weapclass == ESM::WeaponType::Thrown)
|
if (weapclass == ESM::WeaponType::Ranged || weapclass == ESM::WeaponType::Thrown)
|
||||||
|
@ -1669,6 +1673,8 @@ namespace MWMechanics
|
||||||
mAttackType = getMovementBasedAttackType();
|
mAttackType = getMovementBasedAttackType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (aiInactive)
|
||||||
|
mAttackType = getRandomAttackType();
|
||||||
// else if (mPtr != getPlayer()) use mAttackType set by AiCombat
|
// else if (mPtr != getPlayer()) use mAttackType set by AiCombat
|
||||||
startKey = mAttackType + ' ' + startKey;
|
startKey = mAttackType + ' ' + startKey;
|
||||||
stopKey = mAttackType + " max attack";
|
stopKey = mAttackType + " max attack";
|
||||||
|
|
Loading…
Reference in a new issue