mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Reject AiTravel destinations further than 7168 units away, as in vanilla MW (Fixes #1911)
This commit is contained in:
parent
441073b475
commit
2eaceb71ba
1 changed files with 8 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
#include "aitravel.hpp"
|
||||
|
||||
#include <OgreVector3.h>
|
||||
|
||||
#include <components/esm/aisequence.hpp>
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -70,6 +72,12 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
// Maximum travel distance for vanilla compatibility.
|
||||
// Was likely meant to prevent NPCs walking into non-loaded exterior cells, but for some reason is used in interior cells as well.
|
||||
// We can make this configurable at some point, but the default *must* be the below value. Anything else will break shoddily-written content (*cough* MW *cough*) in bizarre ways.
|
||||
if (Ogre::Vector3(mX, mY, mZ).squaredDistance(Ogre::Vector3(pos.pos)) > 7168*7168)
|
||||
return false;
|
||||
|
||||
bool cellChange = cell->mData.mX != mCellX || cell->mData.mY != mCellY;
|
||||
if(!mPathFinder.isPathConstructed() || cellChange)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue