fix(Core/Creature): Use proper name for wander distance (#2858)

* Change from spawndist to wander_distance

Co-Authored-By: ratkosrb <ratkosrb@users.noreply.github.com>

* fix sql error

Co-Authored-By: ratkosrb <ratkosrb@users.noreply.github.com>

* Let's see if this fixes eluna :)

* Revert "Let's see if this fixes eluna :)"

This reverts commit be675bf83fc6a02f3347ea76408152d623d374bf.

* fix indent

* Revert "fix indent"

This reverts commit f4cb3d2d9fa908445d342b6f2e6dda9d52fd4665.

* Revert "Revert "fix indent""

This reverts commit 48527cfd2f9031f95bdf6e0d7b90111a3c0dc0f2.

Co-authored-by: ratkosrb <ratkosrb@users.noreply.github.com>
This commit is contained in:
Kitzunu
2020-04-11 11:20:02 +02:00
committed by GitHub
parent 50287c05f0
commit 8a1eab2c23
14 changed files with 75 additions and 64 deletions

View File

@@ -217,7 +217,7 @@ void MotionMaster::MoveIdle()
Mutate(&si_idleMovement, MOTION_SLOT_IDLE);
}
void MotionMaster::MoveRandom(float spawndist)
void MotionMaster::MoveRandom(float wanderDistance)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
@@ -228,7 +228,7 @@ void MotionMaster::MoveRandom(float spawndist)
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Creature (GUID: %u) start moving random", _owner->GetGUIDLow());
#endif
Mutate(new RandomMovementGenerator<Creature>(spawndist), MOTION_SLOT_IDLE);
Mutate(new RandomMovementGenerator<Creature>(wanderDistance), MOTION_SLOT_IDLE);
}
}

View File

@@ -162,7 +162,7 @@ class MotionMaster //: private std::stack<MovementGenerator *>
void MoveIdle();
void MoveTargetedHome();
void MoveRandom(float spawndist = 0.0f);
void MoveRandom(float wanderDistance = 0.0f);
void MoveFollow(Unit* target, float dist, float angle, MovementSlot slot = MOTION_SLOT_ACTIVE);
void MoveChase(Unit* target, float dist = 0.0f, float angle = 0.0f);
void MoveConfused();

View File

@@ -202,10 +202,10 @@ void RandomMovementGenerator<Creature>::DoInitialize(Creature* creature)
return;
if (!_wanderDistance)
_wanderDistance = creature->GetRespawnRadius();
_wanderDistance = creature->GetWanderDistance();
_nextMoveTime.Reset(creature->GetDBTableGUIDLow() && creature->GetRespawnRadius() == _wanderDistance ? urand(1, 5000) : 0);
_wanderDistance = std::max((creature->GetRespawnRadius() == _wanderDistance && creature->GetInstanceId() == 0) ? (creature->CanFly() ? MIN_WANDER_DISTANCE_AIR : MIN_WANDER_DISTANCE_GROUND) : 0.0f, _wanderDistance);
_nextMoveTime.Reset(creature->GetDBTableGUIDLow() && creature->GetWanderDistance() == _wanderDistance ? urand(1, 5000) : 0);
_wanderDistance = std::max((creature->GetWanderDistance() == _wanderDistance && creature->GetInstanceId() == 0) ? (creature->CanFly() ? MIN_WANDER_DISTANCE_AIR : MIN_WANDER_DISTANCE_GROUND) : 0.0f, _wanderDistance);
if (G3D::fuzzyEq(_initialPosition.GetExactDist2d(0.0f, 0.0f), 0.0f))
{

View File

@@ -18,7 +18,7 @@ template<class T>
class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
{
public:
RandomMovementGenerator(float spawnDist = 0.0f) : _nextMoveTime(0), _moveCount(0), _wanderDistance(spawnDist), _pathGenerator(NULL), _currentPoint(RANDOM_POINTS_NUMBER)
RandomMovementGenerator(float wanderDistance = 0.0f) : _nextMoveTime(0), _moveCount(0), _wanderDistance(wanderDistance), _pathGenerator(NULL), _currentPoint(RANDOM_POINTS_NUMBER)
{
_initialPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
_destinationPoints.reserve(RANDOM_POINTS_NUMBER);