Core/Creatures: Allow toggling creature default root state

Port From (https://github.com/TrinityCore/TrinityCore/commit/eb93afffc08a45354e1b896adf38d1f8e8b352ac)
This commit is contained in:
hondacrx
2023-03-14 04:30:36 -04:00
parent 1d5d0a32e6
commit 40898d4b9f
2 changed files with 14 additions and 6 deletions
+11 -3
View File
@@ -410,7 +410,6 @@ namespace Game.Entities
SetIsCombatDisallowed(cInfo.FlagsExtra.HasFlag(CreatureFlagsExtra.CannotEnterCombat));
LoadTemplateRoot();
InitializeMovementFlags();
LoadCreaturesAddon();
@@ -1684,8 +1683,15 @@ namespace Game.Entities
void LoadTemplateRoot()
{
if (GetMovementTemplate().IsRooted())
SetControlled(true, UnitState.Root);
SetTemplateRooted(GetMovementTemplate().IsRooted());
}
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)
@@ -2521,6 +2527,8 @@ namespace Game.Entities
void InitializeMovementFlags()
{
LoadTemplateRoot();
// It does the same, for now
UpdateMovementFlags();
}