Core/Creatures: Allow toggling creature default root state
Port From (https://github.com/TrinityCore/TrinityCore/commit/eb93afffc08a45354e1b896adf38d1f8e8b352ac)
This commit is contained in:
@@ -410,7 +410,6 @@ namespace Game.Entities
|
|||||||
|
|
||||||
SetIsCombatDisallowed(cInfo.FlagsExtra.HasFlag(CreatureFlagsExtra.CannotEnterCombat));
|
SetIsCombatDisallowed(cInfo.FlagsExtra.HasFlag(CreatureFlagsExtra.CannotEnterCombat));
|
||||||
|
|
||||||
LoadTemplateRoot();
|
|
||||||
InitializeMovementFlags();
|
InitializeMovementFlags();
|
||||||
|
|
||||||
LoadCreaturesAddon();
|
LoadCreaturesAddon();
|
||||||
@@ -1684,8 +1683,15 @@ namespace Game.Entities
|
|||||||
|
|
||||||
void LoadTemplateRoot()
|
void LoadTemplateRoot()
|
||||||
{
|
{
|
||||||
if (GetMovementTemplate().IsRooted())
|
SetTemplateRooted(GetMovementTemplate().IsRooted());
|
||||||
SetControlled(true, UnitState.Root);
|
}
|
||||||
|
|
||||||
|
public bool IsTemplateRooted() { return _staticFlags.HasFlag(CreatureStaticFlags.Sessile); }
|
||||||
|
|
||||||
|
public void SetTemplateRooted(bool rooted)
|
||||||
|
{
|
||||||
|
_staticFlags.ApplyFlag(CreatureStaticFlags.Sessile, rooted);
|
||||||
|
SetControlled(rooted, UnitState.Root);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HasQuest(uint questId)
|
public override bool HasQuest(uint questId)
|
||||||
@@ -2521,6 +2527,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
void InitializeMovementFlags()
|
void InitializeMovementFlags()
|
||||||
{
|
{
|
||||||
|
LoadTemplateRoot();
|
||||||
|
|
||||||
// It does the same, for now
|
// It does the same, for now
|
||||||
UpdateMovementFlags();
|
UpdateMovementFlags();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -721,7 +721,7 @@ namespace Game.Entities
|
|||||||
SendMessageToSet(packet, true);
|
SendMessageToSet(packet, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UnitState.Root) && !ToCreature().GetMovementTemplate().IsRooted())
|
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UnitState.Root) && !ToCreature().IsTemplateRooted())
|
||||||
{
|
{
|
||||||
if (IsGravityDisabled())
|
if (IsGravityDisabled())
|
||||||
SetAnimTier(AnimTier.Fly);
|
SetAnimTier(AnimTier.Fly);
|
||||||
@@ -1096,7 +1096,7 @@ namespace Game.Entities
|
|||||||
SendMessageToSet(packet, true);
|
SendMessageToSet(packet, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UnitState.Root) && !ToCreature().GetMovementTemplate().IsRooted())
|
if (IsCreature() && updateAnimTier && IsAlive() && !HasUnitState(UnitState.Root) && !ToCreature().IsTemplateRooted())
|
||||||
{
|
{
|
||||||
if (IsGravityDisabled())
|
if (IsGravityDisabled())
|
||||||
SetAnimTier(AnimTier.Fly);
|
SetAnimTier(AnimTier.Fly);
|
||||||
@@ -1224,7 +1224,7 @@ namespace Game.Entities
|
|||||||
SetStunned(false);
|
SetStunned(false);
|
||||||
break;
|
break;
|
||||||
case UnitState.Root:
|
case UnitState.Root:
|
||||||
if (HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2) || HasAuraType(AuraType.ModRootDisableGravity) || GetVehicle() != null || (IsCreature() && ToCreature().GetMovementTemplate().IsRooted()))
|
if (HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2) || HasAuraType(AuraType.ModRootDisableGravity) || GetVehicle() != null || (IsCreature() && ToCreature().IsTemplateRooted()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ClearUnitState(state);
|
ClearUnitState(state);
|
||||||
|
|||||||
Reference in New Issue
Block a user