diff --git a/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs b/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs index aac171371f..54c3fd576f 100644 --- a/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs @@ -118,21 +118,25 @@ public sealed class InjectorSystem : SharedInjectorSystem if (!SolutionContainers.TryGetSolution(injector.Owner, injector.Comp.SolutionName, out _, out var solution)) return; - var actualDelay = MathHelper.Max(injector.Comp.Delay, TimeSpan.FromSeconds(1)); - float amountToInject; + var actualDelay = injector.Comp.Delay; + FixedPoint2 amountToInject; if (injector.Comp.ToggleState == InjectorToggleMode.Draw) { // additional delay is based on actual volume left to draw in syringe when smaller than transfer amount - amountToInject = Math.Min(injector.Comp.TransferAmount.Float(), (solution.MaxVolume - solution.Volume).Float()); + amountToInject = FixedPoint2.Min(injector.Comp.TransferAmount, (solution.MaxVolume - solution.Volume)); } else { // additional delay is based on actual volume left to inject in syringe when smaller than transfer amount - amountToInject = Math.Min(injector.Comp.TransferAmount.Float(), solution.Volume.Float()); + amountToInject = FixedPoint2.Min(injector.Comp.TransferAmount, solution.Volume); } // Injections take 0.5 seconds longer per 5u of possible space/content - actualDelay += TimeSpan.FromSeconds(amountToInject / 10); + // First 5u(MinimumTransferAmount) doesn't incur delay + actualDelay += injector.Comp.DelayPerVolume * FixedPoint2.Max(0, amountToInject - injector.Comp.MinimumTransferAmount).Double(); + + // Ensure that minimum delay before incapacitation checks is 1 seconds + actualDelay = MathHelper.Max(actualDelay, TimeSpan.FromSeconds(1)); var isTarget = user != target; diff --git a/Content.Shared/Chemistry/Components/InjectorComponent.cs b/Content.Shared/Chemistry/Components/InjectorComponent.cs index ee7f9bd579..aec6834063 100644 --- a/Content.Shared/Chemistry/Components/InjectorComponent.cs +++ b/Content.Shared/Chemistry/Components/InjectorComponent.cs @@ -73,6 +73,12 @@ public sealed partial class InjectorComponent : Component [DataField] public TimeSpan Delay = TimeSpan.FromSeconds(5); + /// + /// Each additional 1u after first 5u increases the delay by X seconds. + /// + [DataField] + public TimeSpan DelayPerVolume = TimeSpan.FromSeconds(0.1); + /// /// 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