From 6a24e9ce29953e4a211b070ed91be60d291ee0e5 Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Sun, 23 Feb 2025 14:26:44 -0500 Subject: [PATCH] Core/SAI: Allow update of disable gravity/root applied via static flags (using related action type) Port From (https://github.com/TrinityCore/TrinityCore/commit/2cf2535cd637b5b8966f7990f6826bdac94d77ce) --- Source/Game/AI/SmartScripts/SmartAI.cs | 5 ----- Source/Game/AI/SmartScripts/SmartScript.cs | 9 ++++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs index 96c087d01..af6f29f68 100644 --- a/Source/Game/AI/SmartScripts/SmartAI.cs +++ b/Source/Game/AI/SmartScripts/SmartAI.cs @@ -770,11 +770,6 @@ namespace Game.AI _run = run; } - public void SetDisableGravity(bool disable = true) - { - me.SetDisableGravity(disable); - } - public void SetEvadeDisabled(bool disable) { _evadeDisabled = disable; diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 1ec506462..e3952a4c5 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -1228,10 +1228,9 @@ namespace Game.AI } case SmartActions.SetDisableGravity: { - if (!IsSmart()) - break; - - ((SmartAI)_me.GetAI()).SetDisableGravity(e.Action.setDisableGravity.disable != 0); + foreach (WorldObject target in targets) + if (IsCreature(target)) + target.ToCreature().SetFloating(e.Action.setDisableGravity.disable != 0); break; } case SmartActions.SetRun: @@ -1980,7 +1979,7 @@ namespace Game.AI { foreach (var target in targets) if (IsCreature(target)) - target.ToCreature().SetControlled(e.Action.setRoot.root != 0, UnitState.Root); + target.ToCreature().SetSessile(e.Action.setRoot.root != 0); break; } case SmartActions.SummonCreatureGroup: