mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-05 11:45:32 +00:00
check position to stop AIFollow
This commit is contained in:
parent
ccf07f9406
commit
051d7141be
1 changed files with 7 additions and 6 deletions
|
@ -27,17 +27,19 @@ MWMechanics::AiFollow *MWMechanics::AiFollow::clone() const
|
|||
mStuckTimer = mStuckTimer + duration;
|
||||
mTotalTime = mTotalTime + duration;
|
||||
|
||||
if(mTotalTime > mDuration) return true;
|
||||
ESM::Position pos = actor.getRefData().getPosition();
|
||||
|
||||
if(mTotalTime > mDuration ||
|
||||
(pos.pos[0]-mX)*(pos.pos[0]-mX) +
|
||||
(pos.pos[1]-mY)*(pos.pos[1]-mY) +
|
||||
(pos.pos[2]-mZ)*(pos.pos[2]-mZ) < 100*100)
|
||||
return true;
|
||||
|
||||
ESM::Pathgrid::Point dest;
|
||||
dest.mX = target.getRefData().getPosition().pos[0];
|
||||
dest.mY = target.getRefData().getPosition().pos[1];
|
||||
dest.mZ = target.getRefData().getPosition().pos[2];
|
||||
|
||||
//std::cout << dest.mX;
|
||||
|
||||
ESM::Position pos = actor.getRefData().getPosition();
|
||||
|
||||
if(mTimer > 0.25)
|
||||
{
|
||||
if(!mPathFinder.getPath().empty())
|
||||
|
@ -63,7 +65,6 @@ MWMechanics::AiFollow *MWMechanics::AiFollow::clone() const
|
|||
+(mStuckPos.pos[2] - pos.pos[2])*(mStuckPos.pos[2] - pos.pos[2])
|
||||
< 100) //NPC is stuck
|
||||
{
|
||||
std::cout << "stck\n";
|
||||
ESM::Pathgrid::Point start;
|
||||
start.mX = pos.pos[0];
|
||||
start.mY = pos.pos[1];
|
||||
|
|
Loading…
Reference in a new issue