From 7ab27a718f472144315d2a5672c517fd2906147f Mon Sep 17 00:00:00 2001 From: Whatstone <166147148+whatston3@users.noreply.github.com> Date: Tue, 11 Mar 2025 03:02:35 -0400 Subject: [PATCH 1/3] Prevent gas extraction from map mixes - see note, temporary until a better solution is proposed. (#3061) * Atmos: don't pull from the map * fix passive vents, check null map in tile check * cvar-based gas extraction * Restore scrubbers --- Content.Server/Atmos/EntitySystems/AirFilterSystem.cs | 4 +++- .../Atmos/EntitySystems/AtmosphereSystem.API.cs | 6 ++++++ .../Atmos/EntitySystems/AtmosphereSystem.CVars.cs | 3 +++ .../Piping/Unary/EntitySystems/GasPassiveVentSystem.cs | 4 +++- .../Piping/Unary/EntitySystems/GasVentPumpSystem.cs | 4 +++- .../Piping/Unary/EntitySystems/GasVentScrubberSystem.cs | 4 +++- Content.Server/Atmos/Portable/PortableScrubberSystem.cs | 4 +++- Content.Shared/_NF/CCVar/NFCCVars.cs | 9 +++++++++ 8 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs b/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs index c3344c830c0..b4ea5a597d2 100644 --- a/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs @@ -31,7 +31,9 @@ private void OnIntakeUpdate(EntityUid uid, AirIntakeComponent intake, ref AtmosD if (air.Pressure >= intake.Pressure) return; - var environment = _atmosphere.GetContainingMixture(uid, args.Grid, args.Map, true, true); + var map = _atmosphere.AllowMapGasExtraction ? args.Map : null; // Frontier + + var environment = _atmosphere.GetContainingMixture(uid, args.Grid, map, true, true); // Frontier: args.Map entity, Vector2i til && Resolve(gridEnt, ref gridEnt.Comp1, false) && gridEnt.Comp1.Tiles.TryGetValue(gridTile, out var tile)) { + // Frontier: hack to avoid infinite gas extraction from planets + if (tile.MapAtmosphere && map == null) + { + return GasMixture.SpaceGas; + } + // End Frontier if (excite) { AddActiveTile(gridEnt.Comp1, tile); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs index 3aaa5429fb0..19b3766b1dc 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs @@ -1,3 +1,4 @@ +using Content.Shared._NF.CCVar; // Frontier using Content.Shared.CCVar; using Robust.Shared.Configuration; @@ -26,6 +27,7 @@ public sealed partial class AtmosphereSystem public float AtmosTickRate { get; private set; } public float Speedup { get; private set; } public float HeatScale { get; private set; } + public bool AllowMapGasExtraction { get; private set; } // Frontier /// /// Time between each atmos sub-update. If you are writing an atmos device, use AtmosDeviceUpdateEvent.dt @@ -55,6 +57,7 @@ private void InitializeCVars() Subs.CVar(_cfg, CCVars.AtmosHeatScale, value => { HeatScale = value; InitializeGases(); }, true); Subs.CVar(_cfg, CCVars.ExcitedGroups, value => ExcitedGroups = value, true); Subs.CVar(_cfg, CCVars.ExcitedGroupsSpaceIsAllConsuming, value => ExcitedGroupsSpaceIsAllConsuming = value, true); + Subs.CVar(_cfg, NFCCVars.AllowMapGasExtraction, value => AllowMapGasExtraction = value, true); // Frontier } } } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs index 72812cb5237..a1a4af93886 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs @@ -24,7 +24,9 @@ public override void Initialize() private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, ref AtmosDeviceUpdateEvent args) { - var environment = _atmosphereSystem.GetContainingMixture(uid, args.Grid, args.Map, true, true); + var map = _atmosphereSystem.AllowMapGasExtraction ? args.Map : null; // Frontier + + var environment = _atmosphereSystem.GetContainingMixture(uid, args.Grid, map, true, true); // Frontier: args.Map public static readonly CVarDef CrateGenerationGridBoundsScale = CVarDef.Create("nf14.events.crate_generation_grid_bounds_scale", 0.6f, CVar.SERVERONLY); + + /* + * Atmos + */ + /// + /// If true, allows map extraction (scrubbing a planet's atmosphere). + /// + public static readonly CVarDef AllowMapGasExtraction = + CVarDef.Create("nf14.atmos.allow_map_gas_extraction", false, CVar.SERVER | CVar.REPLICATED); } From c93d6665357a754d1e0c7e7bfc6ed862bbf9a1bb Mon Sep 17 00:00:00 2001 From: Whatstone <166147148+whatston3@users.noreply.github.com> Date: Sun, 16 Mar 2025 03:10:33 -0400 Subject: [PATCH 2/3] Disable atmospheric devices on expedition maps. (#3116) * disable atmos devices based only on map * comment include in AtmosSystem.Utils --- .../Atmos/EntitySystems/AirFilterSystem.cs | 7 +++++-- .../Atmos/EntitySystems/AtmosphereSystem.API.cs | 6 ------ .../EntitySystems/AtmosphereSystem.Utils.cs | 16 ++++++++++++++++ .../Atmos/EntitySystems/AtmosphereSystem.cs | 2 ++ .../Unary/EntitySystems/GasPassiveVentSystem.cs | 7 +++++-- .../Unary/EntitySystems/GasVentPumpSystem.cs | 7 +++++-- .../Unary/EntitySystems/GasVentScrubberSystem.cs | 7 +++++-- .../Atmos/Portable/PortableScrubberSystem.cs | 9 ++++++--- 8 files changed, 44 insertions(+), 17 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs b/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs index b4ea5a597d2..784c32146e3 100644 --- a/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs @@ -31,9 +31,12 @@ private void OnIntakeUpdate(EntityUid uid, AirIntakeComponent intake, ref AtmosD if (air.Pressure >= intake.Pressure) return; - var map = _atmosphere.AllowMapGasExtraction ? args.Map : null; // Frontier + // Frontier: check running gas extraction + if (!_atmosphere.AtmosInputCanRunOnMap(args.Map)) + return; + // End Frontier - var environment = _atmosphere.GetContainingMixture(uid, args.Grid, map, true, true); // Frontier: args.Map entity, Vector2i til && Resolve(gridEnt, ref gridEnt.Comp1, false) && gridEnt.Comp1.Tiles.TryGetValue(gridTile, out var tile)) { - // Frontier: hack to avoid infinite gas extraction from planets - if (tile.MapAtmosphere && map == null) - { - return GasMixture.SpaceGas; - } - // End Frontier if (excite) { AddActiveTile(gridEnt.Comp1, tile); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs index e39447d81a9..68f19957a4a 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs @@ -4,6 +4,7 @@ using Content.Shared.Atmos; using Content.Shared.Atmos.Components; using Content.Shared.Maps; +using Content.Shared.Shuttles.Components; // Frontier using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -128,4 +129,19 @@ private void PryTile(MapGridComponent mapGrid, Vector2i tile) _tile.PryTile(tileRef); } + + // Frontier: disable atmos off maps + /// + /// Checks if atmos input devices are allowed to run on the given map entity. + /// + /// The map in question. + public bool AtmosInputCanRunOnMap(EntityUid? mapUid) + { + // Frontier: check running gas extraction + if (!TryComp(mapUid, out var mapComp)) + return false; + + return AllowMapGasExtraction || HasComp(mapUid) || mapComp.MapId == _gameTicker.DefaultMap; + } + // End Frontier: disable atmos off maps } diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs index e9383f3a23a..69abef31c57 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Atmos.Components; using Content.Server.Body.Systems; using Content.Server.Fluids.EntitySystems; +using Content.Server.GameTicking; // Frontier using Content.Server.NodeContainer.EntitySystems; using Content.Shared.Atmos.EntitySystems; using Content.Shared.Decals; @@ -37,6 +38,7 @@ public sealed partial class AtmosphereSystem : SharedAtmosphereSystem [Dependency] private readonly TileSystem _tile = default!; [Dependency] private readonly MapSystem _map = default!; [Dependency] public readonly PuddleSystem Puddle = default!; + [Dependency] private readonly GameTicker _gameTicker = default!; // Frontier private const float ExposedUpdateDelay = 1f; private float _exposedTimer = 0f; diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs index a1a4af93886..41f60b99858 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs @@ -24,9 +24,12 @@ public override void Initialize() private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, ref AtmosDeviceUpdateEvent args) { - var map = _atmosphereSystem.AllowMapGasExtraction ? args.Map : null; // Frontier + // Frontier: check running gas extraction + if (!_atmosphereSystem.AtmosInputCanRunOnMap(args.Map)) + return; + // End Frontier - var environment = _atmosphereSystem.GetContainingMixture(uid, args.Grid, map, true, true); // Frontier: args.Map Date: Mon, 2 Mar 2026 23:46:24 -0600 Subject: [PATCH 3/3] Expanded Gas Deposit Scanner range to 64 tiles. (#4343) --- .../_NF/Entities/Objects/Specific/Atmospherics/deposits.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Prototypes/_NF/Entities/Objects/Specific/Atmospherics/deposits.yml b/Resources/Prototypes/_NF/Entities/Objects/Specific/Atmospherics/deposits.yml index 894a51e8a6e..ffb36630f81 100644 --- a/Resources/Prototypes/_NF/Entities/Objects/Specific/Atmospherics/deposits.yml +++ b/Resources/Prototypes/_NF/Entities/Objects/Specific/Atmospherics/deposits.yml @@ -488,7 +488,7 @@ - type: ItemToggle - type: ProximityBeeper - type: ProximityDetector - range: 20 + range: 64 criteria: components: - GasDeposit