Core/Scripts: Integrate new ActionResultSetter with movement generators and spells
Port From (https://github.com/TrinityCore/TrinityCore/commit/b265c49977235dea5e7e69d7b6fb93f4943bf87a)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
@@ -56,7 +57,7 @@ namespace Game.Movement
|
||||
float? _totalTurnAngle;
|
||||
uint _diffSinceLastUpdate;
|
||||
|
||||
public RotateMovementGenerator(uint id, RotateDirection direction, TimeSpan? duration, float? turnSpeed, float? totalTurnAngle)
|
||||
public RotateMovementGenerator(uint id, RotateDirection direction, TimeSpan? duration, float? turnSpeed, float? totalTurnAngle, TaskCompletionSource<MovementStopReason> scriptResult)
|
||||
{
|
||||
_id = id;
|
||||
_direction = direction;
|
||||
@@ -70,6 +71,7 @@ namespace Game.Movement
|
||||
Priority = MovementGeneratorPriority.Normal;
|
||||
Flags = MovementGeneratorFlags.InitializationPending;
|
||||
BaseUnitState = UnitState.Rotating;
|
||||
ScriptResult = scriptResult;
|
||||
}
|
||||
|
||||
public override void Initialize(Unit owner)
|
||||
@@ -142,8 +144,12 @@ namespace Game.Movement
|
||||
{
|
||||
AddFlag(MovementGeneratorFlags.Finalized);
|
||||
|
||||
if (movementInform && owner.IsCreature())
|
||||
owner.ToCreature().GetAI().MovementInform(MovementGeneratorType.Rotate, _id);
|
||||
if (movementInform)
|
||||
{
|
||||
SetScriptResult(MovementStopReason.Finished);
|
||||
if (owner.IsCreature())
|
||||
owner.ToCreature().GetAI().MovementInform(MovementGeneratorType.Rotate, _id);
|
||||
}
|
||||
}
|
||||
|
||||
public override MovementGeneratorType GetMovementGeneratorType() { return MovementGeneratorType.Rotate; }
|
||||
|
||||
Reference in New Issue
Block a user