From: Verm <32827189+Vermidia@users.noreply.github.com> Date: Wed, 7 May 2025 20:43:47 +0000 (-0500) Subject: Make container draw disableble for mob-affecting Hyposprays (#30683) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=47258651a3eff09c51b1e4212780287e54cc2c52;p=space-station-14.git Make container draw disableble for mob-affecting Hyposprays (#30683) * Seperate container draw from affects mobs * Spaces * More spaces * Fix toggle * Use better ands * Reorder checks for Performance:tm: --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> --- diff --git a/Content.Client/Chemistry/UI/HyposprayStatusControl.cs b/Content.Client/Chemistry/UI/HyposprayStatusControl.cs index 4a4d90dc4d..37b6fb5ed8 100644 --- a/Content.Client/Chemistry/UI/HyposprayStatusControl.cs +++ b/Content.Client/Chemistry/UI/HyposprayStatusControl.cs @@ -44,7 +44,7 @@ public sealed class HyposprayStatusControl : Control PrevMaxVolume = solution.MaxVolume; PrevOnlyAffectsMobs = _parent.Comp.OnlyAffectsMobs; - var modeStringLocalized = Loc.GetString(_parent.Comp.OnlyAffectsMobs switch + var modeStringLocalized = Loc.GetString((_parent.Comp.OnlyAffectsMobs && _parent.Comp.CanContainerDraw) switch { false => "hypospray-all-mode-text", true => "hypospray-mobs-only-mode-text", diff --git a/Content.Server/Chemistry/EntitySystems/HypospraySystem.cs b/Content.Server/Chemistry/EntitySystems/HypospraySystem.cs index d537c2ffdd..19ad64d046 100644 --- a/Content.Server/Chemistry/EntitySystems/HypospraySystem.cs +++ b/Content.Server/Chemistry/EntitySystems/HypospraySystem.cs @@ -33,8 +33,9 @@ public sealed class HypospraySystem : SharedHypospraySystem private bool TryUseHypospray(Entity entity, EntityUid target, EntityUid user) { - // if target is ineligible but is a container, try to draw from the container - if (!EligibleEntity(target, EntityManager, entity) + // if target is ineligible but is a container, try to draw from the container if allowed + if (entity.Comp.CanContainerDraw + && !EligibleEntity(target, EntityManager, entity) && _solutionContainers.TryGetDrawableSolution(target, out var drawableSolution, out _)) { return TryDraw(entity, target, drawableSolution.Value, user); diff --git a/Content.Shared/Chemistry/Components/HyposprayComponent.cs b/Content.Shared/Chemistry/Components/HyposprayComponent.cs index 17d52f0ad9..1e3a4751f4 100644 --- a/Content.Shared/Chemistry/Components/HyposprayComponent.cs +++ b/Content.Shared/Chemistry/Components/HyposprayComponent.cs @@ -20,12 +20,18 @@ public sealed partial class HyposprayComponent : Component /// /// Decides whether you can inject everything or just mobs. - /// When you can only affect mobs, you're capable of drawing from beakers. /// [AutoNetworkedField] [DataField(required: true)] public bool OnlyAffectsMobs = false; + /// + /// If this can draw from containers in mob-only mode. + /// + [AutoNetworkedField] + [DataField] + public bool CanContainerDraw = true; + /// /// Whether or not the hypospray is able to draw from containers or if it's a single use /// device that can only inject. diff --git a/Content.Shared/Chemistry/EntitySystems/SharedHypospraySystem.cs b/Content.Shared/Chemistry/EntitySystems/SharedHypospraySystem.cs index b647d33c98..6985ae693c 100644 --- a/Content.Shared/Chemistry/EntitySystems/SharedHypospraySystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/SharedHypospraySystem.cs @@ -46,7 +46,7 @@ public abstract class SharedHypospraySystem : EntitySystem private void ToggleMode(Entity entity, EntityUid user) { SetMode(entity, !entity.Comp.OnlyAffectsMobs); - string msg = entity.Comp.OnlyAffectsMobs ? "hypospray-verb-mode-inject-mobs-only" : "hypospray-verb-mode-inject-all"; + string msg = (entity.Comp.OnlyAffectsMobs && entity.Comp.CanContainerDraw) ? "hypospray-verb-mode-inject-mobs-only" : "hypospray-verb-mode-inject-all"; _popup.PopupClient(Loc.GetString(msg), entity, user); }