|
|
|
@ -6,6 +6,8 @@
|
|
|
|
|
#include <components/debug/debuglog.hpp>
|
|
|
|
|
#include <components/esm3/aisequence.hpp>
|
|
|
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
|
#include "../mwbase/mechanicsmanager.hpp"
|
|
|
|
|
#include "../mwworld/class.hpp"
|
|
|
|
|
#include "actorutil.hpp"
|
|
|
|
|
#include "aiactivate.hpp"
|
|
|
|
@ -17,6 +19,7 @@
|
|
|
|
|
#include "aipursue.hpp"
|
|
|
|
|
#include "aitravel.hpp"
|
|
|
|
|
#include "aiwander.hpp"
|
|
|
|
|
#include "creaturestats.hpp"
|
|
|
|
|
|
|
|
|
|
namespace MWMechanics
|
|
|
|
|
{
|
|
|
|
@ -365,7 +368,20 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
// Stop combat when a non-combat AI package is added
|
|
|
|
|
if (isActualAiPackage(package.getTypeId()))
|
|
|
|
|
{
|
|
|
|
|
if (package.getTypeId() == MWMechanics::AiPackageTypeId::Follow
|
|
|
|
|
|| package.getTypeId() == MWMechanics::AiPackageTypeId::Escort)
|
|
|
|
|
{
|
|
|
|
|
const auto& mechanicsManager = MWBase::Environment::get().getMechanicsManager();
|
|
|
|
|
std::vector<MWWorld::Ptr> newAllies = mechanicsManager->getActorsSidingWith(package.getTarget());
|
|
|
|
|
std::vector<MWWorld::Ptr> allies = mechanicsManager->getActorsSidingWith(actor);
|
|
|
|
|
for (const auto& ally : allies)
|
|
|
|
|
ally.getClass().getCreatureStats(ally).getAiSequence().stopCombat(newAllies);
|
|
|
|
|
for (const auto& ally : newAllies)
|
|
|
|
|
ally.getClass().getCreatureStats(ally).getAiSequence().stopCombat(allies);
|
|
|
|
|
}
|
|
|
|
|
stopCombat();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We should return a wandering actor back after combat, casting or pursuit.
|
|
|
|
|
// The same thing for actors without AI packages.
|
|
|
|
|