From 8589df5457e2f146d82ba45edc63a222f8aadc79 Mon Sep 17 00:00:00 2001 From: SimpleStation14 <130339894+SimpleStation14@users.noreply.github.com> Date: Sat, 4 May 2024 17:30:58 -0700 Subject: [PATCH] Mirror: Syringe doafter based on Syringe contents (#176) ## Mirror of PR #25890: [Syringe doafter based on Syringe contents](https://github.com/space-wizards/space-station-14/pull/25890) from space-wizards [space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14) ###### `37cd12524e85b6a3b31827e4751a94ca51268694` PR opened by Plykiya at 2024-03-06 21:57:17 UTC PR merged by web-flow at 2024-03-13 09:35:48 UTC --- PR changed 1 files with 14 additions and 2 deletions. The PR had the following labels: ---

Original Body

> > > > ## About the PR > > Altered the **additional doafter time penalty** to be based on what's actually in the syringe rather than what you have the TransferAmount set to for both drawing and injecting. > > ## Why / Balance > > It just makes sense.. honestly though, if I could change the total do-after time to something less than five seconds I would, but I know that for balance reasons it's probably not good to be able to inject someone in like one second with 1u of content. That would be infringing on the territory of hypospray speed for self-injections... > > I think the equation for calculating the additional do-after was wrong or I'm just really bad at math. I fixed it based on what the comment intended. > > ## Technical details > > Altered do-after equation to be based on empty space when drawing and current content amount when injecting. > > ## Media > > > - [ X ] I have added screenshots/videos to this PR showcasing its changes ingame, **or** this PR does not require an ingame showcase > > ## Breaking changes > > > **Changelog** > > > > :cl: > - tweak: Additional syringe doafter delay is now based on syringe contents rather than transfer amount setting.
Co-authored-by: Plykiya <58439124+Plykiya@users.noreply.github.com> --- .../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;