Skip to content

Commit

Permalink
Cherry-picked commit 37cd125 from space-wizards/space-station-14/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Plykiya authored and SimpleStation14 committed Apr 21, 2024
1 parent 3bf08c7 commit 9128634
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Content.Server/Chemistry/EntitySystems/InjectorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,21 @@ private void InjectDoAfter(Entity<InjectorComponent> 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;

Expand Down

0 comments on commit 9128634

Please sign in to comment.