mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 09:36:43 +00:00
Merge pull request #1440 from akortunov/guardfix
Allow guards to attack fighting creatures only in fAlarmRadius range
This commit is contained in:
commit
618ec6dcdd
1 changed files with 6 additions and 1 deletions
|
@ -394,10 +394,15 @@ namespace MWMechanics
|
||||||
aggressive = MWBase::Environment::get().getMechanicsManager()->isAggressive(actor1, actor2);
|
aggressive = MWBase::Environment::get().getMechanicsManager()->isAggressive(actor1, actor2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make guards go aggressive with creatures that are in combat, unless the creature is a follower or escorter
|
// Make guards go aggressive with creatures that are in combat, unless the creature is a follower or escorter
|
||||||
if (actor1.getClass().isClass(actor1, "Guard") && !actor2.getClass().isNpc())
|
if (actor1.getClass().isClass(actor1, "Guard") && !actor2.getClass().isNpc())
|
||||||
{
|
{
|
||||||
|
// Check if the creature is too far
|
||||||
|
static const float fAlarmRadius = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fAlarmRadius")->getFloat();
|
||||||
|
if (sqrDist > fAlarmRadius * fAlarmRadius)
|
||||||
|
return;
|
||||||
|
|
||||||
bool followerOrEscorter = false;
|
bool followerOrEscorter = false;
|
||||||
for (std::list<MWMechanics::AiPackage*>::const_iterator it = creatureStats2.getAiSequence().begin(); it != creatureStats2.getAiSequence().end(); ++it)
|
for (std::list<MWMechanics::AiPackage*>::const_iterator it = creatureStats2.getAiSequence().begin(); it != creatureStats2.getAiSequence().end(); ++it)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue