using System.Threading; using Content.Shared.Chemistry.Components; using Content.Shared.FixedPoint; namespace Content.Server.Chemistry.Components { /// /// Server behavior for reagent injectors and syringes. Can optionally support both /// injection and drawing or just injection. Can inject/draw reagents from solution /// containers, and can directly inject into a mobs bloodstream. /// [RegisterComponent] public sealed class InjectorComponent : SharedInjectorComponent { public const string SolutionName = "injector"; /// /// Whether or not the injector is able to draw from containers or if it's a single use /// device that can only inject. /// [ViewVariables] [DataField("injectOnly")] public bool InjectOnly; /// /// Amount to inject or draw on each usage. If the injector is inject only, it will /// attempt to inject it's entire contents upon use. /// [ViewVariables(VVAccess.ReadWrite)] [DataField("transferAmount")] public FixedPoint2 TransferAmount = FixedPoint2.New(5); /// /// Injection delay (seconds) when the target is a mob. /// /// /// The base delay has a minimum of 1 second, but this will still be modified if the target is incapacitated or /// in combat mode. /// [ViewVariables(VVAccess.ReadWrite)] [DataField("delay")] public float Delay = 5; /// /// Token for interrupting a do-after action (e.g., injection another player). If not null, implies /// component is currently "in use". /// public CancellationTokenSource? CancelToken; private InjectorToggleMode _toggleState; /// /// The state of the injector. Determines it's attack behavior. Containers must have the /// right SolutionCaps to support injection/drawing. For InjectOnly injectors this should /// only ever be set to Inject /// [ViewVariables(VVAccess.ReadWrite)] public InjectorToggleMode ToggleState { get => _toggleState; set { _toggleState = value; Dirty(); } } } }