*Do not change dest when target does not move for targeted movement.

--HG--
branch : trunk
This commit is contained in:
megamage committed 2009-05-22 03:07:52 -05:00
1 parent 8a44eff53a
commit 6e6d10e3e9
2 files changed
+7 -5

No files matched your search

+6 -4
View File
@@ -61,6 +61,10 @@ TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
return;
}
// chaser is on the way, and target did not move much
if(GetDestination(x, y, z) && i_target->IsWithinDist3d(x, y, z, 0.3f))
return;
if(!i_offset)
{
// to nearest random contact position
@@ -111,7 +115,6 @@ TargetedMovementGenerator<T>::Initialize(T &owner)
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly())
owner.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2);
_setTargetLocation(owner);
}
@@ -158,7 +161,7 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
if( !i_destinationHolder.HasDestination() )
_setTargetLocation(owner);
if( owner.IsStopped() && !i_destinationHolder.HasArrived() )
else if( owner.IsStopped() && !i_destinationHolder.HasArrived() )
{
owner.addUnitState(UNIT_STAT_CHASE);
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly())
@@ -180,8 +183,7 @@ TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
// try to counter precision differences
//if( i_destinationHolder.GetDistance2dFromDestSq(*i_target.getTarget()) >= dist * dist)
if(i_offset ? !i_target->IsWithinDistInMap(&owner,2*i_offset)
: !i_target->IsWithinMeleeRange(&owner))
if(i_offset ? !i_target->IsWithinDistInMap(&owner, i_offset + 1.0f) : !i_target->IsWithinMeleeRange(&owner))
{
owner.SetInFront(i_target.getTarget()); // Set new Angle For Map::
_setTargetLocation(owner); //Calculate New Dest and Send data To Player