|
|
|
@ -1234,8 +1234,8 @@ namespace MWMechanics
|
|
|
|
|
const float maxTimeToCheck = 2.0f;
|
|
|
|
|
static const bool giveWayWhenIdle = Settings::Manager::getBool("NPCs give way", "Game");
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr player = getPlayer();
|
|
|
|
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
|
|
|
|
const MWWorld::Ptr player = getPlayer();
|
|
|
|
|
const MWBase::World* world = MWBase::Environment::get().getWorld();
|
|
|
|
|
for(PtrActorMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
|
|
|
|
|
{
|
|
|
|
|
const MWWorld::Ptr& ptr = iter->first;
|
|
|
|
@ -1260,23 +1260,26 @@ namespace MWMechanics
|
|
|
|
|
bool shouldTurnToApproachingActor = !isMoving;
|
|
|
|
|
MWWorld::Ptr currentTarget; // Combat or pursue target (NPCs should not avoid collision with their targets).
|
|
|
|
|
const auto& aiSequence = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
|
|
|
|
for (const auto& package : aiSequence)
|
|
|
|
|
if (!aiSequence.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
if (package->getTypeId() == AiPackageTypeId::Follow)
|
|
|
|
|
const auto& package = aiSequence.getActivePackage();
|
|
|
|
|
if (package.getTypeId() == AiPackageTypeId::Follow)
|
|
|
|
|
{
|
|
|
|
|
shouldAvoidCollision = true;
|
|
|
|
|
else if (package->getTypeId() == AiPackageTypeId::Wander && giveWayWhenIdle)
|
|
|
|
|
}
|
|
|
|
|
else if (package.getTypeId() == AiPackageTypeId::Wander && giveWayWhenIdle)
|
|
|
|
|
{
|
|
|
|
|
if (!static_cast<const AiWander*>(package.get())->isStationary())
|
|
|
|
|
if (!static_cast<const AiWander&>(package).isStationary())
|
|
|
|
|
shouldGiveWay = true;
|
|
|
|
|
}
|
|
|
|
|
else if (package->getTypeId() == AiPackageTypeId::Combat || package->getTypeId() == AiPackageTypeId::Pursue)
|
|
|
|
|
else if (package.getTypeId() == AiPackageTypeId::Combat || package.getTypeId() == AiPackageTypeId::Pursue)
|
|
|
|
|
{
|
|
|
|
|
currentTarget = package->getTarget();
|
|
|
|
|
currentTarget = package.getTarget();
|
|
|
|
|
shouldAvoidCollision = isMoving;
|
|
|
|
|
shouldTurnToApproachingActor = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!shouldAvoidCollision && !shouldGiveWay)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|