Core/Movement: Allow specifying timeout for random movement

This commit is contained in:
Shauren
2023-03-01 21:58:07 +01:00
parent 0748986835
commit 66b29fba44
4 changed files with 28 additions and 7 deletions

View File

@@ -596,12 +596,12 @@ void MotionMaster::MoveTargetedHome()
}
}
void MotionMaster::MoveRandom(float wanderDistance)
void MotionMaster::MoveRandom(float wanderDistance, Optional<Milliseconds> duration)
{
if (_owner->GetTypeId() == TYPEID_UNIT)
{
TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveRandom: '{}', started random movement (spawnDist: {})", _owner->GetGUID().ToString(), wanderDistance);
Add(new RandomMovementGenerator<Creature>(wanderDistance), MOTION_SLOT_DEFAULT);
Add(new RandomMovementGenerator<Creature>(wanderDistance, duration), MOTION_SLOT_DEFAULT);
}
}