#nullable enable using System; using System.Threading; using Robust.Shared.Interfaces.GameObjects; // ReSharper disable UnassignedReadonlyField namespace Content.Server.GameObjects.EntitySystems { public sealed class DoAfterEventArgs { /// /// The entity invoking do_after /// public IEntity User { get; } /// /// How long does the do_after require to complete /// public float Delay { get; } /// /// Applicable target (if relevant) /// public IEntity? Target { get; } /// /// Manually cancel the do_after so it no longer runs /// public CancellationToken CancelToken { get; } // Break the chains /// /// Whether we need to keep our active hand as is (i.e. can't change hand or change item). /// This also covers requiring the hand to be free (if applicable). /// public readonly bool NeedHand; /// /// If do_after stops when the user moves /// public readonly bool BreakOnUserMove; /// /// If do_after stops when the target moves (if there is a target) /// public readonly bool BreakOnTargetMove; public readonly bool BreakOnDamage; public readonly bool BreakOnStun; /// /// Additional conditions that need to be met. Return false to cancel. /// public readonly Func? ExtraCheck; public DoAfterEventArgs( IEntity user, float delay, CancellationToken cancelToken = default, IEntity? target = null) { User = user; Delay = delay; CancelToken = cancelToken; Target = target; if (Target == null) { BreakOnTargetMove = false; } } } }