Syringe QoL improvements (#25480)

Co-authored-by: Plykiya <plykiya@protonmail.com>
This commit is contained in:
Plykiya
2024-03-03 21:07:11 -08:00
committed by GitHub
parent ee051217ae
commit 4f7ff56e87
3 changed files with 49 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.Administration.Logs;
using Content.Shared.Administration.Logs;
using Content.Shared.Chemistry.Components;
using Content.Shared.CombatMode;
using Content.Shared.DoAfter;
@@ -94,16 +94,34 @@ public abstract class SharedInjectorSystem : EntitySystem
if (injector.Comp.InjectOnly)
return;
if (!SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out var solEnt, out var solution))
return;
string msg;
switch (injector.Comp.ToggleState)
{
case InjectorToggleMode.Inject:
SetMode(injector, InjectorToggleMode.Draw);
msg = "injector-component-drawing-text";
if (solution.AvailableVolume > 0) // If solution has empty space to fill up, allow toggling to draw
{
SetMode(injector, InjectorToggleMode.Draw);
msg = "injector-component-drawing-text";
}
else
{
msg = "injector-component-cannot-toggle-draw-message";
}
break;
case InjectorToggleMode.Draw:
SetMode(injector, InjectorToggleMode.Inject);
msg = "injector-component-injecting-text";
if (solution.Volume > 0) // If solution has anything in it, allow toggling to inject
{
SetMode(injector, InjectorToggleMode.Inject);
msg = "injector-component-injecting-text";
}
else
{
msg = "injector-component-cannot-toggle-inject-message";
}
break;
default:
throw new ArgumentOutOfRangeException();