Core/SAI: SMART_ACTION_PAUSE_MOVEMENT
Port From (https://github.com/TrinityCore/TrinityCore/commit/a90b9abbf0754d4156b3d6b02f1a97eafae8f3e9)
This commit is contained in:
@@ -1425,6 +1425,15 @@ namespace Game.AI
|
||||
|
||||
break;
|
||||
}
|
||||
case SmartActions.PauseMovement:
|
||||
{
|
||||
if (e.Action.pauseMovement.pauseTimer == 0)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} does not specify pause duration");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SmartActions.SetMovementSpeed:
|
||||
{
|
||||
if (e.Action.movementSpeed.movementType >= (int)MovementGeneratorType.Max)
|
||||
@@ -1529,7 +1538,6 @@ namespace Game.AI
|
||||
case SmartActions.RemoveAllGameobjects:
|
||||
case SmartActions.SpawnSpawngroup:
|
||||
case SmartActions.DespawnSpawngroup:
|
||||
case SmartActions.RemoveMovement:
|
||||
break;
|
||||
default:
|
||||
Log.outError(LogFilter.ScriptsAi, "SmartAIMgr: Not handled action_type({0}), event_type({1}), Entry {2} SourceType {3} Event {4}, skipped.", e.GetActionType(), e.GetEventType(), e.EntryOrGuid, e.GetScriptType(), e.EventId);
|
||||
@@ -2534,7 +2542,7 @@ namespace Game.AI
|
||||
public RandomTimedEvent randomTimedEvent;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public RemoveMovement removeMovement;
|
||||
public PauseMovement pauseMovement;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public RespawnData respawnData;
|
||||
@@ -3047,10 +3055,11 @@ namespace Game.AI
|
||||
public uint minId;
|
||||
public uint maxId;
|
||||
}
|
||||
public struct RemoveMovement
|
||||
public struct PauseMovement
|
||||
{
|
||||
public uint movementType;
|
||||
public uint forced;
|
||||
public uint movementSlot;
|
||||
public uint pauseTimer;
|
||||
public uint force;
|
||||
}
|
||||
public struct RespawnData
|
||||
{
|
||||
|
||||
@@ -2331,18 +2331,11 @@ namespace Game.AI
|
||||
|
||||
break;
|
||||
}
|
||||
case SmartActions.RemoveMovement:
|
||||
case SmartActions.PauseMovement:
|
||||
{
|
||||
foreach (var target in targets)
|
||||
{
|
||||
if (IsUnit(target))
|
||||
{
|
||||
if (e.Action.removeMovement.movementType != 0 && e.Action.removeMovement.movementType < (uint)MovementGeneratorType.Max)
|
||||
target.ToUnit().GetMotionMaster().Remove((MovementGeneratorType)e.Action.removeMovement.movementType);
|
||||
if (e.Action.removeMovement.forced != 0)
|
||||
target.ToUnit().StopMoving();
|
||||
}
|
||||
}
|
||||
target.ToUnit().PauseMovement(e.Action.pauseMovement.pauseTimer, (MovementSlot)e.Action.pauseMovement.movementSlot, e.Action.pauseMovement.force != 0);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user