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.Server.Body.Components; using Content.Server.Body.Components;
using Content.Server.Body.Systems; using Content.Server.Body.Systems;
using Content.Shared.Chemistry; using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Components;
@@ -115,7 +115,14 @@ public sealed class InjectorSystem : SharedInjectorSystem
private void InjectDoAfter(Entity<InjectorComponent> injector, EntityUid target, EntityUid user) private void InjectDoAfter(Entity<InjectorComponent> injector, EntityUid target, EntityUid user)
{ {
// Create a pop-up for the user // Create a pop-up for the user
Popup.PopupEntity(Loc.GetString("injector-component-injecting-user"), target, user); if (injector.Comp.ToggleState == InjectorToggleMode.Draw)
{
Popup.PopupEntity(Loc.GetString("injector-component-drawing-user"), target, user);
}
else
{
Popup.PopupEntity(Loc.GetString("injector-component-injecting-user"), target, user);
}
if (!SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out _, out var solution)) if (!SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out _, out var solution))
return; return;
@@ -131,8 +138,17 @@ public sealed class InjectorSystem : SharedInjectorSystem
{ {
// Create a pop-up for the target // Create a pop-up for the target
var userName = Identity.Entity(user, EntityManager); var userName = Identity.Entity(user, EntityManager);
Popup.PopupEntity(Loc.GetString("injector-component-injecting-target", if (injector.Comp.ToggleState == InjectorToggleMode.Draw)
("user", userName)), user, target); {
Popup.PopupEntity(Loc.GetString("injector-component-drawing-target",
("user", userName)), user, target);
}
else
{
Popup.PopupEntity(Loc.GetString("injector-component-injecting-target",
("user", userName)), user, target);
}
// Check if the target is incapacitated or in combat mode and modify time accordingly. // Check if the target is incapacitated or in combat mode and modify time accordingly.
if (MobState.IsIncapacitated(target)) if (MobState.IsIncapacitated(target))

View File

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

View File

@@ -18,8 +18,12 @@ injector-component-transfer-success-message = You transfer {$amount}u into {$tar
injector-component-draw-success-message = You draw {$amount}u from {$target}. injector-component-draw-success-message = You draw {$amount}u from {$target}.
injector-component-target-already-full-message = {$target} is already full! injector-component-target-already-full-message = {$target} is already full!
injector-component-target-is-empty-message = {$target} is empty! injector-component-target-is-empty-message = {$target} is empty!
injector-component-cannot-toggle-draw-message = Too full to draw!
injector-component-cannot-toggle-inject-message = Nothing to inject!
## mob-inject doafter messages ## mob-inject doafter messages
injector-component-injecting-user = You start inserting the needle. injector-component-drawing-user = You start drawing the needle.
injector-component-injecting-target = {CAPITALIZE(THE($user))} is trying to stick a needle into you! injector-component-injecting-user = You start injecting the needle.
injector-component-drawing-target = {CAPITALIZE(THE($user))} is trying to use a needle to draw from you!
injector-component-injecting-target = {CAPITALIZE(THE($user))} is trying to inject a needle into you!