|
|
|
@ -25,23 +25,26 @@ namespace
|
|
|
|
|
namespace MWWorld
|
|
|
|
|
{
|
|
|
|
|
ActionTeleport::ActionTeleport (const std::string& cellName,
|
|
|
|
|
const ESM::Position& position)
|
|
|
|
|
: Action (true), mCellName (cellName), mPosition (position)
|
|
|
|
|
const ESM::Position& position, bool teleportFollowers)
|
|
|
|
|
: Action (true), mCellName (cellName), mPosition (position), mTeleportFollowers(teleportFollowers)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ActionTeleport::executeImp (const Ptr& actor)
|
|
|
|
|
{
|
|
|
|
|
//find any NPC that is following the actor and teleport him too
|
|
|
|
|
std::set<MWWorld::Ptr> followers;
|
|
|
|
|
getFollowers(actor, followers);
|
|
|
|
|
for(std::set<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
|
|
|
|
|
if (mTeleportFollowers)
|
|
|
|
|
{
|
|
|
|
|
MWWorld::Ptr follower = *it;
|
|
|
|
|
if (Ogre::Vector3(follower.getRefData().getPosition().pos).squaredDistance(
|
|
|
|
|
Ogre::Vector3( actor.getRefData().getPosition().pos))
|
|
|
|
|
<= 800*800)
|
|
|
|
|
teleport(*it);
|
|
|
|
|
//find any NPC that is following the actor and teleport him too
|
|
|
|
|
std::set<MWWorld::Ptr> followers;
|
|
|
|
|
getFollowers(actor, followers);
|
|
|
|
|
for(std::set<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
|
|
|
|
|
{
|
|
|
|
|
MWWorld::Ptr follower = *it;
|
|
|
|
|
if (Ogre::Vector3(follower.getRefData().getPosition().pos).squaredDistance(
|
|
|
|
|
Ogre::Vector3( actor.getRefData().getPosition().pos))
|
|
|
|
|
<= 800*800)
|
|
|
|
|
teleport(*it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
teleport(actor);
|
|
|
|
|