aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOvahlord <Ovahlord@users.noreply.github.com>2020-02-18 22:52:35 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-21 23:55:34 +0100
commita90b9abbf0754d4156b3d6b02f1a97eafae8f3e9 (patch)
treee46ec2b3da16f69253606c5783331b8731abaae2 /src
parent94034e1565165593f64322a017c48a05e577610a (diff)
Core/SAI: SMART_ACTION_PAUSE_MOVEMENT
Closes #22346 (cherry picked from commit 6f31784979569c1a9ae3ee3f70416f5e11d3e7f0)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp11
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp10
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h9
3 files changed, 16 insertions, 14 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 4cd0883d733..4ea727cbfe7 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -2354,18 +2354,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
target->ToUnit()->RemoveAllGameObjects();
break;
}
- case SMART_ACTION_REMOVE_MOVEMENT:
+ case SMART_ACTION_PAUSE_MOVEMENT:
{
for (WorldObject* const target : targets)
- {
if (IsUnit(target))
- {
- if (e.action.removeMovement.movementType && e.action.removeMovement.movementType < MAX_MOTION_TYPE)
- target->ToUnit()->GetMotionMaster()->Remove(MovementGeneratorType(e.action.removeMovement.movementType));
- if (e.action.removeMovement.forced)
- target->ToUnit()->StopMoving();
- }
- }
+ target->ToUnit()->PauseMovement(e.action.pauseMovement.pauseTimer, e.action.pauseMovement.movementSlot, e.action.pauseMovement.force);
break;
}
case SMART_ACTION_RESPAWN_BY_SPAWNID:
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 21951cc1d6c..da5dbbad14d 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -1675,6 +1675,15 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
}
+ case SMART_ACTION_PAUSE_MOVEMENT:
+ {
+ if (!e.action.pauseMovement.pauseTimer)
+ {
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u does not specify pause duration", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ return false;
+ }
+ break;
+ }
case SMART_ACTION_SET_MOVEMENT_SPEED:
{
if (e.action.movementSpeed.movementType >= MAX_MOVE_TYPE)
@@ -1777,7 +1786,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS:
case SMART_ACTION_SPAWN_SPAWNGROUP:
case SMART_ACTION_DESPAWN_SPAWNGROUP:
- case SMART_ACTION_REMOVE_MOVEMENT:
break;
default:
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry " SI64FMTD " SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 00e74aaab2a..7cc6f0440ed 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -592,7 +592,7 @@ enum SMART_ACTION
SMART_ACTION_LOAD_EQUIPMENT = 124, // id
SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT = 125, // id min range, id max range
SMART_ACTION_REMOVE_ALL_GAMEOBJECTS = 126,
- SMART_ACTION_REMOVE_MOVEMENT = 127, // movementType, forced
+ SMART_ACTION_PAUSE_MOVEMENT = 127, // MovementSlot (default = 0, active = 1, controlled = 2), PauseTime (ms), Force
SMART_ACTION_PLAY_ANIMKIT = 128, // id, type (0 = oneShot, 1 = aiAnim, 2 = meleeAnim, 3 = movementAnim)
SMART_ACTION_SCENE_PLAY = 129, // sceneId
SMART_ACTION_SCENE_CANCEL = 130, // sceneId
@@ -1166,9 +1166,10 @@ struct SmartAction
struct
{
- uint32 movementType;
- uint32 forced;
- } removeMovement;
+ uint32 movementSlot;
+ uint32 pauseTimer;
+ uint32 force;
+ } pauseMovement;
struct
{