[9435] Avoid useless creature running around at evade

* If creature near respawn point and by defult do random movement
  then restart from current point
* If creature have default waypoints movegen restart from last
  updated point. Not reload waypoints
This commit is contained in:
VladimirMangos 2010-02-22 22:38:19 +03:00
parent f47f5a1deb
commit d3fc17a81d
7 changed files with 41 additions and 12 deletions

View file

@ -39,14 +39,14 @@ HomeMovementGenerator<Creature>::Reset(Creature &)
void
HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner)
{
if( !&owner )
return;
if( owner.hasUnitState(UNIT_STAT_NOT_MOVE) )
if (owner.hasUnitState(UNIT_STAT_NOT_MOVE))
return;
float x, y, z;
owner.GetRespawnCoord(x, y, z);
// at apply we can select more nice return points base at current movegen
if (owner.GetMotionMaster()->empty() || !owner.GetMotionMaster()->top()->GetResetPosition(owner,x,y,z))
owner.GetRespawnCoord(x, y, z);
CreatureTraveller traveller(owner);