From 7a30ef5cc1eb6a9b1c16920b219422ce28a315a6 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 11 Jun 2016 17:45:56 +0200 Subject: [PATCH] Do not consider actors following the player as hostiles --- apps/openmw/mwmechanics/actors.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 564805e3f..92f5fc5fd 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1422,12 +1422,15 @@ namespace MWMechanics std::vector neighbors; osg::Vec3f position (actor.getRefData().getPosition().asVec3()); getObjectsInRange(position, aiProcessingDistance, neighbors); + + std::list followers = getActorsFollowing(actor); for(std::vector::const_iterator iter(neighbors.begin());iter != neighbors.end();++iter) { const CreatureStats &stats = iter->getClass().getCreatureStats(*iter); if (stats.isDead() || *iter == actor) continue; - if (stats.getAiSequence().isInCombat(actor) || MWBase::Environment::get().getMechanicsManager()->isAggressive(*iter, actor)) + const bool isFollower = std::find(followers.begin(), followers.end(), *iter) != followers.end(); + if (stats.getAiSequence().isInCombat(actor) || (MWBase::Environment::get().getMechanicsManager()->isAggressive(*iter, actor) && !isFollower)) list.push_back(*iter); } return list;