Make Position instruction move non-player actors within their cell only (Fixes #1791)

deque
scrawl 11 years ago
parent f724732290
commit 36ba56d037

@ -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…
Cancel
Save