mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Make ACtionTeleport non player specific and teleport actors following the teleporting actor
This commit is contained in:
parent
1ae62665d6
commit
0e46c40cb5
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
#include "player.hpp"
|
#include "player.hpp"
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
@ -16,11 +17,35 @@ namespace MWWorld
|
|||||||
void ActionTeleport::executeImp (const Ptr& actor)
|
void ActionTeleport::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
world->getPlayer().setTeleported(true);
|
|
||||||
|
|
||||||
if (mCellName.empty())
|
//find any NPC that is following the actor and teleport him too
|
||||||
world->changeToExteriorCell (mPosition);
|
std::list<MWWorld::Ptr> followers = MWBase::Environment::get().getMechanicsManager()->getActorsFollowing(actor);
|
||||||
|
for(std::list<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();it++)
|
||||||
|
{
|
||||||
|
std::cout << "teleporting someone!" << (*it).getCellRef().mRefID;
|
||||||
|
executeImp(*it);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(actor == world->getPlayerPtr())
|
||||||
|
{
|
||||||
|
world->getPlayer().setTeleported(true);
|
||||||
|
if (mCellName.empty())
|
||||||
|
world->changeToExteriorCell (mPosition);
|
||||||
|
else
|
||||||
|
world->changeToInteriorCell (mCellName, mPosition);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
world->changeToInteriorCell (mCellName, mPosition);
|
{
|
||||||
|
if (mCellName.empty())
|
||||||
|
{
|
||||||
|
int cellX;
|
||||||
|
int cellY;
|
||||||
|
world->positionToIndex(mPosition.pos[0],mPosition.pos[1],cellX,cellY);
|
||||||
|
world->moveObject(actor,*world->getExterior(cellX,cellY),
|
||||||
|
mPosition.pos[0],mPosition.pos[1],mPosition.pos[2]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
world->moveObject(actor,*world->getInterior(mCellName),mPosition.pos[0],mPosition.pos[1],mPosition.pos[2]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user