mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
fix(Core/Creature): Update movement in UpdateEntry() (#17291)
* fix(Core/Creature): Update movement in UpdateEntry() * Update Creature.cpp * Update Creature.cpp * hover * just replace with updatemovememntflags * Update Creature.cpp * Update Creature.cpp --------- Co-authored-by: Skjalf <47818697+Nyeriah@users.noreply.github.com>
This commit is contained in:
@@ -578,13 +578,13 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
|
|||||||
ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true);
|
ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetMovementTemplate().IsRooted())
|
|
||||||
{
|
|
||||||
SetControlled(true, UNIT_STATE_ROOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetDetectionDistance(cInfo->detection_range);
|
SetDetectionDistance(cInfo->detection_range);
|
||||||
|
|
||||||
|
// Update movement
|
||||||
|
if (IsRooted())
|
||||||
|
SetControlled(true, UNIT_STATE_ROOT);
|
||||||
|
UpdateMovementFlags();
|
||||||
|
|
||||||
LoadSpellTemplateImmunity();
|
LoadSpellTemplateImmunity();
|
||||||
|
|
||||||
if (updateAI)
|
if (updateAI)
|
||||||
@@ -3116,7 +3116,7 @@ bool Creature::SetDisableGravity(bool disable, bool packetOnly /*= false*/, bool
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !GetMovementTemplate().IsRooted())
|
if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !IsRooted())
|
||||||
{
|
{
|
||||||
if (IsLevitating())
|
if (IsLevitating())
|
||||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_FLY);
|
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_FLY);
|
||||||
@@ -3265,7 +3265,7 @@ bool Creature::SetHover(bool enable, bool packetOnly /*= false*/, bool updateAni
|
|||||||
if (!packetOnly && !Unit::SetHover(enable))
|
if (!packetOnly && !Unit::SetHover(enable))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !GetMovementTemplate().IsRooted())
|
if (updateAnimationTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !IsRooted())
|
||||||
{
|
{
|
||||||
if (IsLevitating())
|
if (IsLevitating())
|
||||||
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_FLY);
|
SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_FLY);
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public:
|
|||||||
[[nodiscard]] bool CanEnterWater() const override;
|
[[nodiscard]] bool CanEnterWater() const override;
|
||||||
[[nodiscard]] bool CanFly() const override { return GetMovementTemplate().IsFlightAllowed() || IsFlying(); }
|
[[nodiscard]] bool CanFly() const override { return GetMovementTemplate().IsFlightAllowed() || IsFlying(); }
|
||||||
[[nodiscard]] bool CanHover() const { return GetMovementTemplate().Ground == CreatureGroundMovementType::Hover || IsHovering(); }
|
[[nodiscard]] bool CanHover() const { return GetMovementTemplate().Ground == CreatureGroundMovementType::Hover || IsHovering(); }
|
||||||
|
[[nodiscard]] bool IsRooted() const { return GetMovementTemplate().IsRooted(); }
|
||||||
|
|
||||||
MovementGeneratorType GetDefaultMovementType() const override { return m_defaultMovementType; }
|
MovementGeneratorType GetDefaultMovementType() const override { return m_defaultMovementType; }
|
||||||
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
|
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
|
||||||
|
|||||||
Reference in New Issue
Block a user