mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-03 18:15:35 +00:00
Don't teleport followers when using teleportation spells
This commit is contained in:
parent
d27b92e9f1
commit
d1b6289cad
6 changed files with 21 additions and 16 deletions
|
@ -147,7 +147,7 @@ namespace MWClass
|
||||||
|
|
||||||
if (ptr.getCellRef().getTeleport())
|
if (ptr.getCellRef().getTeleport())
|
||||||
{
|
{
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest()));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest(), true));
|
||||||
|
|
||||||
action->setSound(openSound);
|
action->setSound(openSound);
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
||||||
|
|
||||||
// Teleports any followers, too.
|
// Teleports any followers, too.
|
||||||
MWWorld::ActionTeleport action(interior ? cellname : "", pos);
|
MWWorld::ActionTeleport action(interior ? cellname : "", pos, true);
|
||||||
action.execute(player);
|
action.execute(player);
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0);
|
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0);
|
||||||
|
|
|
@ -679,7 +679,7 @@ namespace MWMechanics
|
||||||
if (markedCell)
|
if (markedCell)
|
||||||
{
|
{
|
||||||
MWWorld::ActionTeleport action(markedCell->isExterior() ? "" : markedCell->getCell()->mName,
|
MWWorld::ActionTeleport action(markedCell->isExterior() ? "" : markedCell->getCell()->mName,
|
||||||
markedPosition);
|
markedPosition, false);
|
||||||
action.execute(target);
|
action.execute(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,23 +25,26 @@ namespace
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
ActionTeleport::ActionTeleport (const std::string& cellName,
|
ActionTeleport::ActionTeleport (const std::string& cellName,
|
||||||
const ESM::Position& position)
|
const ESM::Position& position, bool teleportFollowers)
|
||||||
: Action (true), mCellName (cellName), mPosition (position)
|
: Action (true), mCellName (cellName), mPosition (position), mTeleportFollowers(teleportFollowers)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionTeleport::executeImp (const Ptr& actor)
|
void ActionTeleport::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
//find any NPC that is following the actor and teleport him too
|
if (mTeleportFollowers)
|
||||||
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;
|
//find any NPC that is following the actor and teleport him too
|
||||||
if (Ogre::Vector3(follower.getRefData().getPosition().pos).squaredDistance(
|
std::set<MWWorld::Ptr> followers;
|
||||||
Ogre::Vector3( actor.getRefData().getPosition().pos))
|
getFollowers(actor, followers);
|
||||||
<= 800*800)
|
for(std::set<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
|
||||||
teleport(*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);
|
teleport(actor);
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
std::string mCellName;
|
std::string mCellName;
|
||||||
ESM::Position mPosition;
|
ESM::Position mPosition;
|
||||||
|
bool mTeleportFollowers;
|
||||||
|
|
||||||
/// Teleports this actor and also teleports anyone following that actor.
|
/// Teleports this actor and also teleports anyone following that actor.
|
||||||
virtual void executeImp (const Ptr& actor);
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
@ -22,8 +23,9 @@ namespace MWWorld
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ActionTeleport (const std::string& cellName, const ESM::Position& position);
|
ActionTeleport (const std::string& cellName, const ESM::Position& position, bool teleportFollowers);
|
||||||
///< If cellName is empty, an exterior cell is assumed.
|
///< If cellName is empty, an exterior cell is assumed.
|
||||||
|
/// @param teleportFollowers Whether to teleport any following actors of the target actor as well.
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2921,7 +2921,7 @@ namespace MWWorld
|
||||||
if ( !closestMarker.mCell->isExterior() )
|
if ( !closestMarker.mCell->isExterior() )
|
||||||
cellName = closestMarker.mCell->getCell()->mName;
|
cellName = closestMarker.mCell->getCell()->mName;
|
||||||
|
|
||||||
MWWorld::ActionTeleport action(cellName, closestMarker.getRefData().getPosition());
|
MWWorld::ActionTeleport action(cellName, closestMarker.getRefData().getPosition(), false);
|
||||||
action.execute(ptr);
|
action.execute(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue