|
|
|
@ -24,7 +24,7 @@ namespace MWWorld
|
|
|
|
|
{
|
|
|
|
|
// Find any NPCs that are following the actor and teleport them with him
|
|
|
|
|
std::set<MWWorld::Ptr> followers;
|
|
|
|
|
getFollowersToTeleport(actor, followers);
|
|
|
|
|
getFollowers(actor, followers, true);
|
|
|
|
|
|
|
|
|
|
for (std::set<MWWorld::Ptr>::iterator it = followers.begin(); it != followers.end(); ++it)
|
|
|
|
|
teleport(*it);
|
|
|
|
@ -47,7 +47,9 @@ namespace MWWorld
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (mCellName.empty())
|
|
|
|
|
if (actor.getClass().getCreatureStats(actor).getAiSequence().isInCombat(world->getPlayerPtr()))
|
|
|
|
|
actor.getClass().getCreatureStats(actor).getAiSequence().stopCombat();
|
|
|
|
|
else if (mCellName.empty())
|
|
|
|
|
{
|
|
|
|
|
int cellX;
|
|
|
|
|
int cellY;
|
|
|
|
@ -60,7 +62,7 @@ namespace MWWorld
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ActionTeleport::getFollowersToTeleport(const MWWorld::Ptr& actor, std::set<MWWorld::Ptr>& out) {
|
|
|
|
|
void ActionTeleport::getFollowers(const MWWorld::Ptr& actor, std::set<MWWorld::Ptr>& out, bool includeHostiles) {
|
|
|
|
|
std::set<MWWorld::Ptr> followers;
|
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->getActorsFollowing(actor, followers);
|
|
|
|
|
|
|
|
|
@ -69,11 +71,17 @@ namespace MWWorld
|
|
|
|
|
MWWorld::Ptr follower = *it;
|
|
|
|
|
|
|
|
|
|
std::string script = follower.getClass().getScript(follower);
|
|
|
|
|
|
|
|
|
|
if (!includeHostiles && follower.getClass().getCreatureStats(follower).getAiSequence().isInCombat(actor))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (!script.empty() && follower.getRefData().getLocals().getIntVar(script, "stayoutside") == 1)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if ((follower.getRefData().getPosition().asVec3() - actor.getRefData().getPosition().asVec3()).length2() <= 800*800)
|
|
|
|
|
out.insert(follower);
|
|
|
|
|
if ((follower.getRefData().getPosition().asVec3() - actor.getRefData().getPosition().asVec3()).length2() > 800 * 800)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
out.emplace(follower);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|