Fixed AiPursue by fixing underlying issue is Pathto()

deque
Thomas 11 years ago
parent 2425d2c2ab
commit d2aada95b4

@ -37,7 +37,6 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
}
else {
pathTo(actor, dest, duration); //Go to the destination
actor.getClass().getMovementSettings(actor).mPosition[1] = 1;
}
return false;

@ -22,7 +22,7 @@ bool MWMechanics::AiAvoidDoor::execute (const MWWorld::Ptr& actor,float duration
{
ESM::Position pos = actor.getRefData().getPosition();
if(mDuration = 1) //If it just started, get the actor position as the stuck detection thing
if(mDuration == 1) //If it just started, get the actor position as the stuck detection thing
mLastPos = pos;
mDuration -= duration; //Update timer

@ -58,12 +58,11 @@ bool MWMechanics::AiFollow::execute (const MWWorld::Ptr& actor,float duration)
//Set the target desition from the actor
ESM::Pathgrid::Point dest = target.getRefData().getPosition().pos;
pathTo(actor, dest, duration); //Go to the destination
if(distance(dest, pos.pos[0], pos.pos[1], pos.pos[2]) < 100) //Stop when you get close
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
else
actor.getClass().getMovementSettings(actor).mPosition[1] = 1;
else {
pathTo(actor, dest, duration); //Go to the destination
}
//Check if you're far away
if(distance(dest, pos.pos[0], pos.pos[1], pos.pos[2]) > 1000)

@ -16,7 +16,7 @@
MWMechanics::AiPackage::~AiPackage() {}
MWMechanics::AiPackage::AiPackage() : mLastDoorChecked(MWWorld::Ptr()), mTimer(0), mStuckTimer(0) {
MWMechanics::AiPackage::AiPackage() : mLastDoorChecked(MWWorld::Ptr()), mTimer(.26), mStuckTimer(0) { //mTimer starts at .26 to force initial pathbuild
}
@ -118,6 +118,7 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, ESM::Pathgrid::Po
mStuckTimer = 0;
mStuckPos = pos;
mLastDoorChecked = MWWorld::Ptr(); //Resets it, in case he gets stuck behind the door again
actor.getClass().getMovementSettings(actor).mPosition[1] = 1; //Just run forward
}
}
else {

Loading…
Cancel
Save