aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2016-04-13 20:47:57 +0200
committertkrokli <tkrokli@hotmail.com>2016-06-03 17:38:01 +0200
commit19aac66bc262a835cae288fc3d0ccdc8e93d0fb9 (patch)
tree5f0557308507f60acfd6a7f0091c39834c05b775
parentb253b694ed2ef8ee57a1c046ab80814a9a8aaa9b (diff)
Core/Movement: enable item use and spell cast when dismounting
Remove error message and allow spell cast or item use from mounted state on ground, especially when sitting on a landed flying mount. Current behavior is that the player will get the error message "You can't do that while moving" when trying to cast a spell or pick up an item while sitting on a flying mount after having landed. By joschiwald, closes #6236
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp21
-rw-r--r--src/server/game/Movement/MotionMaster.cpp9
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp14
3 files changed, 11 insertions, 33 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index df8d43062c5..6e921ae1622 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -17231,7 +17231,6 @@ bool Unit::SetWalk(bool enable)
AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
-
return true;
}
@@ -17246,15 +17245,7 @@ bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/)
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING);
}
else
- {
RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
- if (!HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY))
- {
- m_movementInfo.SetFallTime(0);
- AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
- }
- }
-
return true;
}
@@ -17267,7 +17258,6 @@ bool Unit::SetSwim(bool enable)
AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
-
return true;
}
@@ -17282,15 +17272,7 @@ bool Unit::SetCanFly(bool enable, bool /*packetOnly = false */)
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING);
}
else
- {
RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_MASK_MOVING_FLY);
- if (!IsLevitating())
- {
- m_movementInfo.SetFallTime(0);
- AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
- }
- }
-
return true;
}
@@ -17303,7 +17285,6 @@ bool Unit::SetWaterWalking(bool enable, bool /*packetOnly = false */)
AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
-
return true;
}
@@ -17316,7 +17297,6 @@ bool Unit::SetFeatherFall(bool enable, bool /*packetOnly = false */)
AddUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW);
-
return true;
}
@@ -17344,7 +17324,6 @@ bool Unit::SetHover(bool enable, bool /*packetOnly = false*/)
UpdateHeight(newZ);
}
}
-
return true;
}
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 6f7dae1d4f2..d2059886f40 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -479,11 +479,12 @@ void MotionMaster::MoveFall(uint32 id /*=0*/)
if (std::fabs(_owner->GetPositionZ() - tz) < 0.1f)
return;
+ _owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
+ _owner->m_movementInfo.SetFallTime(0);
+
+ // don't run spline movement for players
if (_owner->GetTypeId() == TYPEID_PLAYER)
- {
- _owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
- _owner->m_movementInfo.SetFallTime(0);
- }
+ return;
Movement::MoveSplineInit init(_owner);
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz, false);
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 9b23caef9ab..77757606aad 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -2535,10 +2535,9 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
return;
}
- target->SetCanFly(apply);
-
- if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
- target->GetMotionMaster()->MoveFall();
+ if (target->SetCanFly(apply))
+ if (!apply && !target->IsLevitating())
+ target->GetMotionMaster()->MoveFall();
}
void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -2928,10 +2927,9 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !target->HasAuraType(SPELL_AURA_FLY))))
{
- target->SetCanFly(apply);
-
- if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
- target->GetMotionMaster()->MoveFall();
+ if (target->SetCanFly(apply))
+ if (!apply && !target->IsLevitating())
+ target->GetMotionMaster()->MoveFall();
}
//! Someone should clean up these hacks and remove it from this function. It doesn't even belong here.