From 9128634fdeabaff9b7a4ccad4e1604d748b9dd81 Mon Sep 17 00:00:00 2001 From: Plykiya <58439124+Plykiya@users.noreply.github.com> Date: Wed, 13 Mar 2024 20:35:48 +1100 Subject: [PATCH] Cherry-picked commit 37cd12524e85b6a3b31827e4751a94ca51268694 from space-wizards/space-station-14/master --- .../Chemistry/EntitySystems/InjectorSystem.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs b/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs index 0846d354777..a6d13b2f7cd 100644 --- a/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs @@ -128,9 +128,21 @@ private void InjectDoAfter(Entity injector, EntityUid target, return; var actualDelay = MathHelper.Max(injector.Comp.Delay, TimeSpan.FromSeconds(1)); + float 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()); + } + 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()); + } + + // Injections take 0.5 seconds longer per 5u of possible space/content + actualDelay += TimeSpan.FromSeconds(amountToInject / 10); - // Injections take 0.5 seconds longer per additional 5u - actualDelay += TimeSpan.FromSeconds(injector.Comp.TransferAmount.Float() / injector.Comp.Delay.TotalSeconds - 0.5f); var isTarget = user != target;