mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
Core/Creatures: Allow toggling creature default root state
This commit is contained in:
@@ -684,7 +684,6 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/,
|
||||
|
||||
SetIsCombatDisallowed((cInfo->flags_extra & CREATURE_FLAG_EXTRA_CANNOT_ENTER_COMBAT) != 0);
|
||||
|
||||
LoadTemplateRoot();
|
||||
InitializeMovementFlags();
|
||||
|
||||
LoadCreaturesAddon();
|
||||
@@ -1895,8 +1894,13 @@ void Creature::SetSpawnHealth()
|
||||
|
||||
void Creature::LoadTemplateRoot()
|
||||
{
|
||||
if (GetMovementTemplate().IsRooted())
|
||||
SetControlled(true, UNIT_STATE_ROOT);
|
||||
SetTemplateRooted(GetMovementTemplate().IsRooted());
|
||||
}
|
||||
|
||||
void Creature::SetTemplateRooted(bool rooted)
|
||||
{
|
||||
_staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_SESSILE, rooted);
|
||||
SetControlled(rooted, UNIT_STATE_ROOT);
|
||||
}
|
||||
|
||||
bool Creature::hasQuest(uint32 quest_id) const
|
||||
@@ -2766,6 +2770,7 @@ void Creature::GetRespawnPosition(float &x, float &y, float &z, float* ori, floa
|
||||
|
||||
void Creature::InitializeMovementFlags()
|
||||
{
|
||||
LoadTemplateRoot();
|
||||
// It does the same, for now
|
||||
UpdateMovementFlags();
|
||||
}
|
||||
|
||||
@@ -94,6 +94,8 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
void LoadEquipment(int8 id = 1, bool force = false);
|
||||
void SetSpawnHealth();
|
||||
void LoadTemplateRoot();
|
||||
bool IsTemplateRooted() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_SESSILE); }
|
||||
void SetTemplateRooted(bool rooted);
|
||||
|
||||
ObjectGuid::LowType GetSpawnId() const { return m_spawnId; }
|
||||
|
||||
|
||||
@@ -10962,7 +10962,7 @@ void Unit::SetControlled(bool apply, UnitState state)
|
||||
SetStunned(false);
|
||||
break;
|
||||
case UNIT_STATE_ROOT:
|
||||
if (HasAuraType(SPELL_AURA_MOD_ROOT) || HasAuraType(SPELL_AURA_MOD_ROOT_2) || HasAuraType(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY) || GetVehicle() || (ToCreature() && ToCreature()->GetMovementTemplate().IsRooted()))
|
||||
if (HasAuraType(SPELL_AURA_MOD_ROOT) || HasAuraType(SPELL_AURA_MOD_ROOT_2) || HasAuraType(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY) || GetVehicle() || (ToCreature() && ToCreature()->IsTemplateRooted()))
|
||||
return;
|
||||
|
||||
ClearUnitState(state);
|
||||
@@ -12760,7 +12760,7 @@ bool Unit::SetDisableGravity(bool disable, bool updateAnimTier /*= true*/)
|
||||
SendMessageToSet(packet.Write(), true);
|
||||
}
|
||||
|
||||
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !ToCreature()->GetMovementTemplate().IsRooted())
|
||||
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !ToCreature()->IsTemplateRooted())
|
||||
{
|
||||
if (IsGravityDisabled())
|
||||
SetAnimTier(AnimTier::Fly);
|
||||
@@ -12976,7 +12976,7 @@ bool Unit::SetHover(bool enable, bool updateAnimTier /*= true*/)
|
||||
SendMessageToSet(packet.Write(), true);
|
||||
}
|
||||
|
||||
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !ToCreature()->GetMovementTemplate().IsRooted())
|
||||
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UNIT_STATE_ROOT) && !ToCreature()->IsTemplateRooted())
|
||||
{
|
||||
if (IsGravityDisabled())
|
||||
SetAnimTier(AnimTier::Fly);
|
||||
|
||||
Reference in New Issue
Block a user