From 5ee99f864effd3bde1bed0b5fd80e9043f6bfa63 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 17 Jul 2024 18:00:39 +0100 Subject: [PATCH 1/9] builds --- .../Unary/Components/GasVentPumpComponent.cs | 24 ++++++++++ .../Unary/EntitySystems/GasVentPumpSystem.cs | 45 +++++++++++++++++-- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs b/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs index 7d702904fbe83b..209c437fc83970 100644 --- a/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs +++ b/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs @@ -58,6 +58,30 @@ public sealed partial class GasVentPumpComponent : Component [ViewVariables(VVAccess.ReadWrite)] [DataField("underPressureLockoutLeaking")] public float UnderPressureLockoutLeaking = 0.0001f; + /// + /// Is the vent pressure lockout currently manually disabled? + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField("forceLockoutDisabled")] + public bool IsPressureLockoutManuallyDisabled = false; + /// + /// The time when the manual pressure lockout override occured. + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField("manualLockoutDisabledAt")] + public TimeSpan ManualLockoutDisabledAt; + /// + /// How long the lockout should remain manually disabled after being interacted with (in seconds). + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField("manualLockoutDisabledDuration")] + public float ManualLockoutDisabledDuration = 5.0f; + /// + /// How long the doAfter should take when attempting to manually disable the pressure lockout. + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField("manualLockoutDisableDoAfter")] + public float ManualLockoutDisableDoAfter = 2.0f; [ViewVariables(VVAccess.ReadWrite)] [DataField("externalPressureBound")] diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 2859c7f19d0c09..42a26d23b778a2 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -17,10 +17,14 @@ using Content.Shared.Atmos.Visuals; using Content.Shared.Audio; using Content.Shared.DeviceNetwork; +using Content.Shared.DoAfter; using Content.Shared.Examine; +using Content.Shared.Interaction; using Content.Shared.Tools.Systems; using JetBrains.Annotations; using Robust.Server.GameObjects; +using Robust.Shared.Serialization; +using Robust.Shared.Timing; namespace Content.Server.Atmos.Piping.Unary.EntitySystems { @@ -34,7 +38,9 @@ public sealed class GasVentPumpSystem : EntitySystem [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly WeldableSystem _weldable = default!; - + [Dependency] private readonly SharedToolSystem _toolSystem = default!; + [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!; + [Dependency] private readonly IGameTiming _timing = default!; public override void Initialize() { base.Initialize(); @@ -50,6 +56,8 @@ public override void Initialize() SubscribeLocalEvent(OnSignalReceived); SubscribeLocalEvent(OnAnalyzed); SubscribeLocalEvent(OnWeldChanged); + SubscribeLocalEvent(OnInteractUsing); + SubscribeLocalEvent(OnVentScrewed); } private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, ref AtmosDeviceUpdateEvent args) @@ -80,6 +88,11 @@ private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, ref return; } + if (vent.IsPressureLockoutManuallyDisabled && (_timing.CurTime - vent.ManualLockoutDisabledAt).TotalSeconds > vent.ManualLockoutDisabledDuration) + { + vent.IsPressureLockoutManuallyDisabled = false; + } + var timeDelta = args.dt; var pressureDelta = timeDelta * vent.TargetPressureChange; @@ -114,7 +127,7 @@ private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, ref var transferMoles = pressureDelta * environment.Volume / (pipe.Air.Temperature * Atmospherics.R); // Only run if the device is under lockout and not being overriden - if (vent.UnderPressureLockout & !vent.PressureLockoutOverride) + if (vent.UnderPressureLockout & !vent.PressureLockoutOverride & !vent.IsPressureLockoutManuallyDisabled) { // Leak only a small amount of gas as a proportion of supply pipe pressure. var pipeDelta = pipe.Air.Pressure - environment.Pressure; @@ -272,7 +285,7 @@ private void UpdateState(EntityUid uid, GasVentPumpComponent vent, AppearanceCom } else if (vent.PumpDirection == VentPumpDirection.Releasing) { - if (vent.UnderPressureLockout & !vent.PressureLockoutOverride) + if (vent.UnderPressureLockout & !vent.PressureLockoutOverride & !vent.IsPressureLockoutManuallyDisabled) _appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Lockout, appearance); else _appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Out, appearance); @@ -289,7 +302,7 @@ private void OnExamine(EntityUid uid, GasVentPumpComponent component, ExaminedEv return; if (args.IsInDetailsRange) { - if (pumpComponent.PumpDirection == VentPumpDirection.Releasing & pumpComponent.UnderPressureLockout & !pumpComponent.PressureLockoutOverride) + if (pumpComponent.PumpDirection == VentPumpDirection.Releasing & pumpComponent.UnderPressureLockout & !pumpComponent.PressureLockoutOverride & !pumpComponent.IsPressureLockoutManuallyDisabled) { args.PushMarkup(Loc.GetString("gas-vent-pump-uvlo")); } @@ -324,5 +337,29 @@ private void OnWeldChanged(EntityUid uid, GasVentPumpComponent component, ref We { UpdateState(uid, component); } + private void OnInteractUsing(EntityUid uid, GasVentPumpComponent component, InteractUsingEvent args) + { + if (args.Handled + || !_toolSystem.HasQuality(args.Used, "Screwing") + || component.UnderPressureLockout == false + ) + { + return; + } + + args.Handled = true; + + _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.ManualLockoutDisableDoAfter, new VentScrewedEvent(), uid, uid, args.Used) + { + DistanceThreshold = 1f + }); + } + private void OnVentScrewed(EntityUid uid, GasVentPumpComponent component, VentScrewedEvent args) + { + component.ManualLockoutDisabledAt = _timing.CurTime; + component.IsPressureLockoutManuallyDisabled = true; + } } + [Serializable, NetSerializable] + public sealed partial class VentScrewedEvent : SimpleDoAfterEvent; } From fc3a2b43d4dd29d7c56e0934243b66d6a7b837ab Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 17 Jul 2024 18:20:47 +0100 Subject: [PATCH 2/9] doesn't crash --- .../Piping/Unary/EntitySystems/GasVentPumpSystem.cs | 11 +++++------ .../Atmos/Piping/Unary/VentScrewedDoAfterEvent.cs | 9 +++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 Content.Shared/Atmos/Piping/Unary/VentScrewedDoAfterEvent.cs diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 42a26d23b778a2..40925590d1a792 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -13,6 +13,7 @@ using Content.Server.Power.Components; using Content.Shared.Atmos; using Content.Shared.Atmos.Monitor; +using Content.Shared.Atmos.Piping.Unary; using Content.Shared.Atmos.Piping.Unary.Components; using Content.Shared.Atmos.Visuals; using Content.Shared.Audio; @@ -57,7 +58,7 @@ public override void Initialize() SubscribeLocalEvent(OnAnalyzed); SubscribeLocalEvent(OnWeldChanged); SubscribeLocalEvent(OnInteractUsing); - SubscribeLocalEvent(OnVentScrewed); + SubscribeLocalEvent(OnVentScrewed); } private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, ref AtmosDeviceUpdateEvent args) @@ -96,7 +97,7 @@ private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, ref var timeDelta = args.dt; var pressureDelta = timeDelta * vent.TargetPressureChange; - var lockout = (environment.Pressure < vent.UnderPressureLockoutThreshold); + var lockout = (environment.Pressure < vent.UnderPressureLockoutThreshold) && !vent.IsPressureLockoutManuallyDisabled; if (vent.UnderPressureLockout != lockout) // update visuals only if this changes { vent.UnderPressureLockout = lockout; @@ -349,17 +350,15 @@ private void OnInteractUsing(EntityUid uid, GasVentPumpComponent component, Inte args.Handled = true; - _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.ManualLockoutDisableDoAfter, new VentScrewedEvent(), uid, uid, args.Used) + _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.ManualLockoutDisableDoAfter, new VentScrewedDoAfterEvent(), uid, uid, args.Used) { DistanceThreshold = 1f }); } - private void OnVentScrewed(EntityUid uid, GasVentPumpComponent component, VentScrewedEvent args) + private void OnVentScrewed(EntityUid uid, GasVentPumpComponent component, VentScrewedDoAfterEvent args) { component.ManualLockoutDisabledAt = _timing.CurTime; component.IsPressureLockoutManuallyDisabled = true; } } - [Serializable, NetSerializable] - public sealed partial class VentScrewedEvent : SimpleDoAfterEvent; } diff --git a/Content.Shared/Atmos/Piping/Unary/VentScrewedDoAfterEvent.cs b/Content.Shared/Atmos/Piping/Unary/VentScrewedDoAfterEvent.cs new file mode 100644 index 00000000000000..1fdc69bcf68b4a --- /dev/null +++ b/Content.Shared/Atmos/Piping/Unary/VentScrewedDoAfterEvent.cs @@ -0,0 +1,9 @@ +using Content.Shared.DoAfter; +using Robust.Shared.Serialization; + +namespace Content.Shared.Atmos.Piping.Unary; + +[Serializable, NetSerializable] +public sealed partial class VentScrewedDoAfterEvent : SimpleDoAfterEvent +{ +} From 91739277cabe33b13de5db8e2b0cc1e512fec7e8 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 3 Aug 2024 14:34:53 +0100 Subject: [PATCH 3/9] seems to work --- .../Atmos/Piping/Unary/Components/GasVentPumpComponent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs b/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs index 209c437fc83970..e589c96b8b5133 100644 --- a/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs +++ b/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs @@ -75,7 +75,7 @@ public sealed partial class GasVentPumpComponent : Component /// [ViewVariables(VVAccess.ReadWrite)] [DataField("manualLockoutDisabledDuration")] - public float ManualLockoutDisabledDuration = 5.0f; + public float ManualLockoutDisabledDuration = 30.0f; // Enough time to fill a 5x5 room /// /// How long the doAfter should take when attempting to manually disable the pressure lockout. /// From 5d70f10ecf1cb426b7d090fa76565f69dffec493 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 15 Aug 2024 18:26:08 +0100 Subject: [PATCH 4/9] distance cap was dumb --- .../Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 40925590d1a792..5426d419965045 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -350,10 +350,7 @@ private void OnInteractUsing(EntityUid uid, GasVentPumpComponent component, Inte args.Handled = true; - _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.ManualLockoutDisableDoAfter, new VentScrewedDoAfterEvent(), uid, uid, args.Used) - { - DistanceThreshold = 1f - }); + _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.ManualLockoutDisableDoAfter, new VentScrewedDoAfterEvent(), uid, uid, args.Used)); } private void OnVentScrewed(EntityUid uid, GasVentPumpComponent component, VentScrewedDoAfterEvent args) { From 35dfb1c002cdd94d0905e4ecaf5bc8fb497c2ec6 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 14 Sep 2024 14:37:01 +0100 Subject: [PATCH 5/9] Requested changes --- .../Unary/Components/GasVentPumpComponent.cs | 69 +++++++------------ .../Unary/EntitySystems/GasVentPumpSystem.cs | 4 +- 2 files changed, 28 insertions(+), 45 deletions(-) diff --git a/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs b/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs index e589c96b8b5133..fcf3ddf969c76b 100644 --- a/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs +++ b/Content.Server/Atmos/Piping/Unary/Components/GasVentPumpComponent.cs @@ -6,6 +6,7 @@ namespace Content.Server.Atmos.Piping.Unary.Components { // The world if people documented their shit. + [AutoGenerateComponentPause] [RegisterComponent] public sealed partial class GasVentPumpComponent : Component { @@ -15,31 +16,25 @@ public sealed partial class GasVentPumpComponent : Component [ViewVariables] public bool IsDirty { get; set; } = false; - [ViewVariables(VVAccess.ReadWrite)] - [DataField("inlet")] + [DataField] public string Inlet { get; set; } = "pipe"; - [ViewVariables(VVAccess.ReadWrite)] - [DataField("outlet")] + [DataField] public string Outlet { get; set; } = "pipe"; - [ViewVariables(VVAccess.ReadWrite)] - [DataField("pumpDirection")] + [DataField] public VentPumpDirection PumpDirection { get; set; } = VentPumpDirection.Releasing; - [ViewVariables(VVAccess.ReadWrite)] - [DataField("pressureChecks")] + [DataField] public VentPressureBound PressureChecks { get; set; } = VentPressureBound.ExternalBound; - [ViewVariables(VVAccess.ReadOnly)] - [DataField("underPressureLockout")] + [DataField] public bool UnderPressureLockout { get; set; } = false; /// /// In releasing mode, do not pump when environment pressure is below this limit. /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("underPressureLockoutThreshold")] + [DataField] public float UnderPressureLockoutThreshold = 80; // this must be tuned in conjunction with atmos.mmos_spacing_speed /// @@ -55,36 +50,30 @@ public sealed partial class GasVentPumpComponent : Component /// repressurizing of the development map take about 30 minutes using an oxygen tank (high pressure) /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("underPressureLockoutLeaking")] + [DataField] public float UnderPressureLockoutLeaking = 0.0001f; /// /// Is the vent pressure lockout currently manually disabled? /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("forceLockoutDisabled")] + [DataField] public bool IsPressureLockoutManuallyDisabled = false; /// - /// The time when the manual pressure lockout override occured. + /// The time when the manual pressure lockout will be reenabled. /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("manualLockoutDisabledAt")] - public TimeSpan ManualLockoutDisabledAt; + [DataField] + [AutoPausedField] + public TimeSpan ManualLockoutReenabledAt; /// - /// How long the lockout should remain manually disabled after being interacted with (in seconds). + /// How long the lockout should remain manually disabled after being interacted with. /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("manualLockoutDisabledDuration")] - public float ManualLockoutDisabledDuration = 30.0f; // Enough time to fill a 5x5 room + [DataField] + public TimeSpan ManualLockoutDisabledDuration = TimeSpan.FromSeconds(30); // Enough time to fill a 5x5 room /// /// How long the doAfter should take when attempting to manually disable the pressure lockout. /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("manualLockoutDisableDoAfter")] public float ManualLockoutDisableDoAfter = 2.0f; - [ViewVariables(VVAccess.ReadWrite)] - [DataField("externalPressureBound")] + [DataField] public float ExternalPressureBound { get => _externalPressureBound; @@ -96,8 +85,7 @@ public float ExternalPressureBound private float _externalPressureBound = Atmospherics.OneAtmosphere; - [ViewVariables(VVAccess.ReadWrite)] - [DataField("internalPressureBound")] + [DataField] public float InternalPressureBound { get => _internalPressureBound; @@ -112,8 +100,7 @@ public float InternalPressureBound /// /// Max pressure of the target gas (NOT relative to source). /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("maxPressure")] + [DataField] public float MaxPressure = Atmospherics.MaxOutputPressure; /// @@ -124,8 +111,7 @@ public float InternalPressureBound /// is too high, and the vent is connected to a large pipe-net, then someone can nearly instantly flood a /// room with gas. /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("targetPressureChange")] + [DataField] public float TargetPressureChange = Atmospherics.OneAtmosphere; /// @@ -135,29 +121,26 @@ public float InternalPressureBound /// Vents cannot suck a pipe completely empty, instead pressurizing a section to a max of /// pipe pressure * PumpPower (in kPa). So a 51 kPa pipe is required for 101 kPA sections at PumpPower 2.0 /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("PumpPower")] + [DataField] public float PumpPower = 2.0f; #region Machine Linking /// /// Whether or not machine linking is enabled for this component. /// - [DataField("canLink")] + [DataField] public bool CanLink = false; - [DataField("pressurizePort", customTypeSerializer: typeof(PrototypeIdSerializer))] + [DataField(customTypeSerializer: typeof(PrototypeIdSerializer))] public string PressurizePort = "Pressurize"; - [DataField("depressurizePort", customTypeSerializer: typeof(PrototypeIdSerializer))] + [DataField(customTypeSerializer: typeof(PrototypeIdSerializer))] public string DepressurizePort = "Depressurize"; - [ViewVariables(VVAccess.ReadWrite)] - [DataField("pressurizePressure")] + [DataField] public float PressurizePressure = Atmospherics.OneAtmosphere; - [ViewVariables(VVAccess.ReadWrite)] - [DataField("depressurizePressure")] + [DataField] public float DepressurizePressure = 0; // When true, ignore under-pressure lockout. Used to re-fill rooms in air alarm "Fill" mode. diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 5426d419965045..5b897b575b494f 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -89,7 +89,7 @@ private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, ref return; } - if (vent.IsPressureLockoutManuallyDisabled && (_timing.CurTime - vent.ManualLockoutDisabledAt).TotalSeconds > vent.ManualLockoutDisabledDuration) + if (vent.IsPressureLockoutManuallyDisabled && (_timing.CurTime >= vent.ManualLockoutReenabledAt)) { vent.IsPressureLockoutManuallyDisabled = false; } @@ -354,7 +354,7 @@ private void OnInteractUsing(EntityUid uid, GasVentPumpComponent component, Inte } private void OnVentScrewed(EntityUid uid, GasVentPumpComponent component, VentScrewedDoAfterEvent args) { - component.ManualLockoutDisabledAt = _timing.CurTime; + component.ManualLockoutReenabledAt = _timing.CurTime + component.ManualLockoutDisabledDuration; component.IsPressureLockoutManuallyDisabled = true; } } From 434702b14b905bb744eaf0b5ac7fc70508a32b29 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 14 Sep 2024 14:48:52 +0100 Subject: [PATCH 6/9] can't find any issues from making the changes --- .../Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 5b897b575b494f..9b6ace1ef92e4d 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -88,8 +88,8 @@ private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, ref { return; } - - if (vent.IsPressureLockoutManuallyDisabled && (_timing.CurTime >= vent.ManualLockoutReenabledAt)) + // If the lockout has expired, disable it. + if (vent.IsPressureLockoutManuallyDisabled && _timing.CurTime >= vent.ManualLockoutReenabledAt) { vent.IsPressureLockoutManuallyDisabled = false; } From 5cc3e0dc649cd9605875b11c172dec6d0e22946c Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 22 Sep 2024 19:26:04 +0100 Subject: [PATCH 7/9] Check for anchor and minor optimisation --- .../Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 9b6ace1ef92e4d..d0af3f04c42f29 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -42,6 +42,7 @@ public sealed class GasVentPumpSystem : EntitySystem [Dependency] private readonly SharedToolSystem _toolSystem = default!; [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!; [Dependency] private readonly IGameTiming _timing = default!; + // [Dependency] private readonly TransformSystem _transformSystem = default!; public override void Initialize() { base.Initialize(); @@ -341,8 +342,9 @@ private void OnWeldChanged(EntityUid uid, GasVentPumpComponent component, ref We private void OnInteractUsing(EntityUid uid, GasVentPumpComponent component, InteractUsingEvent args) { if (args.Handled - || !_toolSystem.HasQuality(args.Used, "Screwing") || component.UnderPressureLockout == false + || !_toolSystem.HasQuality(args.Used, "Screwing") + || (!CompOrNull(uid)?.Anchored ?? false) // If component doesn't exist continue, else check for anchor, stops it from eating the deconstruction screwdrivering ) { return; From 657388db8035969057fcf2cefaec193e42a8b3c8 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 22 Sep 2024 19:29:54 +0100 Subject: [PATCH 8/9] Removed unnecessary usings --- .../Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index fdc9e5e8e87c22..5f1b047a7e442b 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -7,10 +7,8 @@ using Content.Server.DeviceNetwork; using Content.Server.DeviceNetwork.Components; using Content.Server.DeviceNetwork.Systems; -using Content.Server.NodeContainer; using Content.Server.NodeContainer.EntitySystems; using Content.Server.NodeContainer.Nodes; -using Content.Server.Power.Components; using Content.Shared.Atmos; using Content.Shared.Atmos.Monitor; using Content.Shared.Atmos.Piping.Unary; @@ -24,8 +22,6 @@ using Content.Shared.Power; using Content.Shared.Tools.Systems; using JetBrains.Annotations; -using Robust.Server.GameObjects; -using Robust.Shared.Serialization; using Robust.Shared.Timing; namespace Content.Server.Atmos.Piping.Unary.EntitySystems From 1420a2ed10f17ee300a8c3976c0ee9968c4c18ae Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 22 Sep 2024 20:19:08 +0100 Subject: [PATCH 9/9] Code less verbose and cleanup --- .../Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 5f1b047a7e442b..9d9862ff1dde88 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -39,7 +39,6 @@ public sealed class GasVentPumpSystem : EntitySystem [Dependency] private readonly SharedToolSystem _toolSystem = default!; [Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!; [Dependency] private readonly IGameTiming _timing = default!; - // [Dependency] private readonly TransformSystem _transformSystem = default!; public override void Initialize() { base.Initialize(); @@ -341,7 +340,7 @@ private void OnInteractUsing(EntityUid uid, GasVentPumpComponent component, Inte if (args.Handled || component.UnderPressureLockout == false || !_toolSystem.HasQuality(args.Used, "Screwing") - || (!CompOrNull(uid)?.Anchored ?? false) // If component doesn't exist continue, else check for anchor, stops it from eating the deconstruction screwdrivering + || !Transform(uid).Anchored ) { return;