mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 10:05:32 +01:00
Core/Movement
* Changed speed selection for flying creatures - use MOVE_RUN by default. * Do not add MOVEMENTFLAG_WALKING to creatures that did not have it but called .SetWalk for their movement
This commit is contained in:
@@ -29,11 +29,7 @@ namespace Movement
|
||||
{
|
||||
UnitMoveType SelectSpeedType(uint32 moveFlags)
|
||||
{
|
||||
/*! Not sure about MOVEMENTFLAG_CAN_FLY here - do creatures that can fly
|
||||
but are on ground right now also have it? If yes, this needs a more
|
||||
dynamic check, such as is flying now
|
||||
*/
|
||||
if (moveFlags & (MOVEMENTFLAG_FLYING | MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_DISABLE_GRAVITY))
|
||||
if (moveFlags & MOVEMENTFLAG_FLYING)
|
||||
{
|
||||
if (moveFlags & MOVEMENTFLAG_BACKWARD /*&& speed_obj.flight >= speed_obj.flight_back*/)
|
||||
return MOVE_FLIGHT_BACK;
|
||||
@@ -55,6 +51,8 @@ namespace Movement
|
||||
else if (moveFlags & MOVEMENTFLAG_BACKWARD /*&& speed_obj.run >= speed_obj.run_back*/)
|
||||
return MOVE_RUN_BACK;
|
||||
|
||||
// Flying creatures use MOVEMENTFLAG_CAN_FLY or MOVEMENTFLAG_DISABLE_GRAVITY
|
||||
// Run speed is their default flight speed.
|
||||
return MOVE_RUN;
|
||||
}
|
||||
|
||||
@@ -90,22 +88,25 @@ namespace Movement
|
||||
move_spline.onTransport = transport;
|
||||
|
||||
uint32 moveFlags = unit->m_movementInfo.GetMovementFlags();
|
||||
if (args.flags.walkmode)
|
||||
moveFlags |= MOVEMENTFLAG_WALKING;
|
||||
else
|
||||
moveFlags &= ~MOVEMENTFLAG_WALKING;
|
||||
|
||||
moveFlags |= (MOVEMENTFLAG_SPLINE_ENABLED|MOVEMENTFLAG_FORWARD);
|
||||
|
||||
if (!args.HasVelocity)
|
||||
args.velocity = unit->GetSpeed(SelectSpeedType(moveFlags));
|
||||
|
||||
if (!args.Validate(unit))
|
||||
return 0;
|
||||
|
||||
if (moveFlags & MOVEMENTFLAG_ROOT)
|
||||
moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
|
||||
|
||||
if (!args.HasVelocity)
|
||||
{
|
||||
// If spline is initialized with SetWalk method it only means we need to select
|
||||
// walk move speed for it but not add walk flag to unit
|
||||
uint32 moveFlagsForSpeed = moveFlags;
|
||||
if (args.flags.walkmode)
|
||||
moveFlagsForSpeed |= MOVEMENTFLAG_WALKING;
|
||||
|
||||
args.velocity = unit->GetSpeed(SelectSpeedType(moveFlagsForSpeed));
|
||||
}
|
||||
|
||||
if (!args.Validate(unit))
|
||||
return 0;
|
||||
|
||||
unit->m_movementInfo.SetMovementFlags((MovementFlags)moveFlags);
|
||||
move_spline.Initialize(args);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user