forked from mirror/openmw-tes3mp
Make Position instruction move non-player actors within their cell only (Fixes #1791)
This commit is contained in:
parent
f724732290
commit
36ba56d037
1 changed files with 13 additions and 2 deletions
|
@ -363,8 +363,19 @@ namespace MWScript
|
|||
runtime.pop();
|
||||
int cx,cy;
|
||||
MWBase::Environment::get().getWorld()->positionToIndex(x,y,cx,cy);
|
||||
MWBase::Environment::get().getWorld()->moveObject(ptr,
|
||||
MWBase::Environment::get().getWorld()->getExterior(cx,cy),x,y,z);
|
||||
|
||||
// another morrowind oddity: player will be moved to the exterior cell at this location,
|
||||
// non-player actors will move within the cell they are in.
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->moveObject(ptr,
|
||||
MWBase::Environment::get().getWorld()->getExterior(cx,cy),x,y,z);
|
||||
}
|
||||
else
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->moveObject(ptr, x, y, z);
|
||||
}
|
||||
|
||||
float ax = Ogre::Radian(ptr.getRefData().getPosition().rot[0]).valueDegrees();
|
||||
float ay = Ogre::Radian(ptr.getRefData().getPosition().rot[1]).valueDegrees();
|
||||
if(ptr.getTypeName() == typeid(ESM::NPC).name())//some morrowind oddity
|
||||
|
|
Loading…
Reference in a new issue