mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[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:
parent
f47f5a1deb
commit
d3fc17a81d
7 changed files with 41 additions and 12 deletions
|
|
@ -137,15 +137,13 @@ void RandomMovementGenerator<Creature>::Interrupt(Creature &creature)
|
|||
}
|
||||
|
||||
template<>
|
||||
void
|
||||
RandomMovementGenerator<Creature>::Finalize(Creature &creature)
|
||||
void RandomMovementGenerator<Creature>::Finalize(Creature &creature)
|
||||
{
|
||||
creature.clearUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
|
||||
}
|
||||
|
||||
template<>
|
||||
bool
|
||||
RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
|
||||
bool RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
|
||||
{
|
||||
if (creature.hasUnitState(UNIT_STAT_NOT_MOVE))
|
||||
{
|
||||
|
|
@ -183,3 +181,16 @@ RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template<>
|
||||
bool RandomMovementGenerator<Creature>::GetResetPosition(Creature& c, float& x, float& y, float& z)
|
||||
{
|
||||
float radius;
|
||||
c.GetRespawnCoord(x, y, z, NULL, &radius);
|
||||
|
||||
// use current if in range
|
||||
if (c.IsWithinDist2d(x,y,radius))
|
||||
c.GetPosition(x,y,z);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue