Core/Movement: updated and enabled SMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY and SMSG_MOVE_UNSET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY and use them to allow players to enter water from flight

This commit is contained in:
Ovahlord committed 2018-11-02 23:09:45 +01:00
1 parent 41c40ff3c7
commit cb3cc3983a
3 files changed
+17 -7

No files matched your search

+5 -2
View File
@@ -8341,8 +8341,6 @@ MountCapabilityEntry const* Unit::GetMountCapability(uint32 mountType) const
if (!(mountCapability->Flags & MOUNT_CAPABILITY_FLAG_GROUND))
continue;
}
else if (!(mountCapability->Flags & MOUNT_CAPABILITY_FLAG_UNDERWATER))
continue;
}
else if (isInWater)
{
@@ -14338,15 +14336,20 @@ bool Unit::SetCanFly(bool enable, bool /*packetOnly = false */)
{
AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_SPLINE_ELEVATION);
AddExtraUnitMovementFlag(MOVEMENTFLAG2_CAN_SWIM_TO_FLY_TRANS);
SetFall(false);
}
else
{
RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_MASK_MOVING_FLY);
RemoveExtraUnitMovementFlag(MOVEMENTFLAG2_CAN_SWIM_TO_FLY_TRANS);
if (!IsLevitating())
SetFall(true);
}
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->SendMovementSetCanTransitionBetweenSwimAndFly(enable);
if (enable)
Movement::PacketSender(this, SMSG_SPLINE_MOVE_SET_FLYING, SMSG_MOVE_SET_CAN_FLY).Send();
else