M Extensions/NosSmooth.Extensions.Combat/CombatState.cs => Extensions/NosSmooth.Extensions.Combat/CombatState.cs +18 -0
@@ 85,6 85,24 @@ internal class CombatState : ICombatState
}
/// <inheritdoc/>
+ public ICombatOperation? RemoveCurrentOperation(OperationQueueType queueType, bool emptyQueue = false)
+ {
+ if (emptyQueue && _operations.TryGetValue(queueType, out var queue))
+ {
+ queue.Clear();
+ }
+
+ if (_currentOperations.TryGetValue(queueType, out var operation))
+ {
+ operation.Dispose();
+ _currentOperations.Remove(queueType);
+ return operation;
+ }
+
+ return null;
+ }
+
+ /// <inheritdoc/>
public ICombatOperation? GetCurrentOperation(OperationQueueType queueType)
=> _currentOperations.GetValueOrDefault(queueType);
M Extensions/NosSmooth.Extensions.Combat/ICombatState.cs => Extensions/NosSmooth.Extensions.Combat/ICombatState.cs +8 -0
@@ 44,6 44,14 @@ public interface ICombatState
public IReadOnlyList<ICombatOperation> GetWaitingForOperations();
/// <summary>
+ /// Remove the current operation for the given queue.
+ /// </summary>
+ /// <param name="queueType">The queue type to get the current operation of.</param>
+ /// <param name="emptyQueue">Whether to empty the rest of the queue.</param>
+ /// <returns>The operation of the given queue, if any.</returns>
+ public ICombatOperation? RemoveCurrentOperation(OperationQueueType queueType, bool emptyQueue = false);
+
+ /// <summary>
/// Gets the current operation of the given queue type.
/// </summary>
/// <param name="queueType">The queue type to get the current operation of.</param>