mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Movement: Add forced speed and movement type parameters to random movement generator
This commit is contained in:
@@ -593,13 +593,14 @@ void MotionMaster::MoveTargetedHome()
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::MoveRandom(float wanderDistance /*= 0.0f*/, Optional<Milliseconds> duration /*= {}*/, MovementSlot slot /*= MOTION_SLOT_DEFAULT*/,
|
||||
void MotionMaster::MoveRandom(float wanderDistance /*= 0.0f*/, Optional<Milliseconds> duration /*= {}*/, Optional<float> speed /*= {}*/,
|
||||
MovementWalkRunSpeedSelectionMode speedSelectionMode /*= MovementWalkRunSpeedSelectionMode::ForceWalk*/, MovementSlot slot /*= MOTION_SLOT_DEFAULT*/,
|
||||
Optional<Scripting::v2::ActionResultSetter<MovementStopReason>>&& scriptResult /*= {}*/)
|
||||
{
|
||||
if (_owner->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveRandom: '{}', started random movement (spawnDist: {})", _owner->GetGUID(), wanderDistance);
|
||||
Add(new RandomMovementGenerator<Creature>(wanderDistance, duration, std::move(scriptResult)), slot);
|
||||
Add(new RandomMovementGenerator<Creature>(wanderDistance, duration, speed, speedSelectionMode, std::move(scriptResult)), slot);
|
||||
}
|
||||
else if (scriptResult)
|
||||
scriptResult->SetResult(MovementStopReason::Interrupted);
|
||||
|
||||
Reference in New Issue
Block a user