aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Unit
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Entities/Unit')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index a6d6b8b0bde..a1b85a33ff1 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -473,7 +473,7 @@ void Unit::Update(uint32 p_time)
}
UpdateSplineMovement(p_time);
- i_motionMaster->UpdateMotion(p_time);
+ i_motionMaster->Update(p_time);
}
bool Unit::haveOffhandWeapon() const
@@ -489,7 +489,7 @@ void Unit::MonsterMoveWithSpeed(float x, float y, float z, float speed, bool gen
Movement::MoveSplineInit init(this);
init.MoveTo(x, y, z, generatePath, forceDestination);
init.SetVelocity(speed);
- GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_SLOT_ACTIVE, POINT_MOTION_TYPE);
+ GetMotionMaster()->LaunchMoveSpline(std::move(init), 0, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE);
}
void Unit::UpdateSplineMovement(uint32 t_diff)
@@ -8065,7 +8065,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype)
{
if (GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
{
- Unit* followed = ASSERT_NOTNULL(dynamic_cast<AbstractFollower*>(GetMotionMaster()->top()))->GetTarget();
+ Unit* followed = ASSERT_NOTNULL(dynamic_cast<AbstractFollower*>(GetMotionMaster()->GetCurrentMovementGenerator()))->GetTarget();
if (followed && followed->GetGUID() == GetOwnerGUID() && !followed->IsInCombat())
{
float ownerSpeed = followed->GetSpeedRate(mtype);
@@ -8206,7 +8206,7 @@ void Unit::setDeathState(DeathState s)
// * Using 'call pet' on dead pets
// * Using 'call stabled pet'
// * Logging in with dead pets
- GetMotionMaster()->Clear(false);
+ GetMotionMaster()->Clear();
GetMotionMaster()->MoveIdle();
}
StopMoving();
@@ -9787,10 +9787,10 @@ void Unit::PauseMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/, bool forced/*
if (IsInvalidMovementSlot(slot))
return;
- if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(MovementSlot(slot)))
+ if (MovementGenerator* movementGenerator = GetMotionMaster()->GetCurrentMovementGenerator(MovementSlot(slot)))
movementGenerator->Pause(timer);
- if (forced)
+ if (forced && GetMotionMaster()->GetCurrentSlot() == MovementSlot(slot))
StopMoving();
}
@@ -9799,7 +9799,7 @@ void Unit::ResumeMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/)
if (IsInvalidMovementSlot(slot))
return;
- if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(MovementSlot(slot)))
+ if (MovementGenerator* movementGenerator = GetMotionMaster()->GetCurrentMovementGenerator(MovementSlot(slot)))
movementGenerator->Resume(timer);
}
@@ -10775,8 +10775,7 @@ void Unit::SetFeared(bool apply)
{
if (IsAlive())
{
- if (GetMotionMaster()->GetCurrentMovementGeneratorType() == FLEEING_MOTION_TYPE)
- GetMotionMaster()->MovementExpired();
+ GetMotionMaster()->Remove(FLEEING_MOTION_TYPE);
if (GetVictim())
SetTarget(EnsureVictim()->GetGUID());
}
@@ -10801,8 +10800,7 @@ void Unit::SetConfused(bool apply)
{
if (IsAlive())
{
- if (GetMotionMaster()->GetCurrentMovementGeneratorType() == CONFUSED_MOTION_TYPE)
- GetMotionMaster()->MovementExpired();
+ GetMotionMaster()->Remove(CONFUSED_MOTION_TYPE);
if (GetVictim())
SetTarget(EnsureVictim()->GetGUID());
}
@@ -10894,10 +10892,8 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
if (GetTypeId() == TYPEID_UNIT)
{
- if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE))
- movementGenerator->Pause(0);
-
- GetMotionMaster()->Clear(MOTION_SLOT_ACTIVE);
+ PauseMovement(0, 0, false);
+ GetMotionMaster()->Clear(MOTION_PRIORITY_NORMAL);
StopMoving();
@@ -11016,7 +11012,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
RestoreFaction();
///@todo Handle SLOT_IDLE motion resume
- GetMotionMaster()->InitDefault();
+ GetMotionMaster()->InitializeDefault();
if (Creature* creature = ToCreature())
{
@@ -11085,8 +11081,6 @@ void Unit::RemoveCharmedBy(Unit* charmer)
player->SetClientControl(this, true);
}
- EngageWithTarget(charmer);
-
// a guardian should always have charminfo
if (playerCharmer && this != charmer->GetFirstControlled())
playerCharmer->SendRemoveControlBar();
@@ -11939,7 +11933,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), height, false);
init.SetFacing(GetOrientation());
init.SetTransportExit();
- GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_EXIT, MOTION_SLOT_CONTROLLED);
+ GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_EXIT, MOTION_PRIORITY_HIGHEST);
if (player)
player->ResummonPetTemporaryUnSummonedIfAny();
@@ -12300,7 +12294,7 @@ void Unit::SetFacingTo(float ori, bool force)
init.DisableTransportPathTransformations(); // It makes no sense to target global orientation
init.SetFacing(ori);
- //GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_FACE, MOTION_SLOT_CONTROLLED);
+ //GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_FACE, MOTION_PRIORITY_HIGHEST);
init.Launch();
}
@@ -12315,7 +12309,7 @@ void Unit::SetFacingToObject(WorldObject const* object, bool force)
init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
init.SetFacing(GetAbsoluteAngle(object)); // when on transport, GetAbsoluteAngle will still return global coordinates (and angle) that needs transforming
- //GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_FACE, MOTION_SLOT_CONTROLLED);
+ //GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_FACE, MOTION_PRIORITY_HIGHEST);
init.Launch();
}