diff --git a/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs b/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs index c3344c830c0..784c32146e3 100644 --- a/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs @@ -31,6 +31,11 @@ private void OnIntakeUpdate(EntityUid uid, AirIntakeComponent intake, ref AtmosD if (air.Pressure >= intake.Pressure) return; + // Frontier: check running gas extraction + if (!_atmosphere.AtmosInputCanRunOnMap(args.Map)) + return; + // End Frontier + var environment = _atmosphere.GetContainingMixture(uid, args.Grid, args.Map, true, true); // nothing to intake from if (environment == null) 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/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 72812cb5237..41f60b99858 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs @@ -24,6 +24,11 @@ public override void Initialize() private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, ref AtmosDeviceUpdateEvent args) { + // Frontier: check running gas extraction + if (!_atmosphereSystem.AtmosInputCanRunOnMap(args.Map)) + return; + // End Frontier + var environment = _atmosphereSystem.GetContainingMixture(uid, args.Grid, args.Map, true, true); if (environment == null) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 013668613a2..c13192d03fe 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -85,6 +85,11 @@ private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, ref return; } + // Frontier: check running gas extraction + if (!_atmosphereSystem.AtmosInputCanRunOnMap(args.Map)) + return; + // End Frontier + var environment = _atmosphereSystem.GetContainingMixture(uid, args.Grid, args.Map, true, true); // We're in an air-blocked tile... Do nothing. diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs index b5c8a9c1a94..10d3de04092 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs @@ -66,6 +66,11 @@ private void OnVentScrubberUpdated(EntityUid uid, GasVentScrubberComponent scrub if (args.Grid is not {} grid) return; + // Frontier: check running gas extraction + if (!_atmosphereSystem.AtmosInputCanRunOnMap(args.Map)) + return; + // End Frontier + var position = _transformSystem.GetGridTilePositionOrDefault(uid); var environment = _atmosphereSystem.GetTileMixture(grid, args.Map, position, true); diff --git a/Content.Server/Atmos/Portable/PortableScrubberSystem.cs b/Content.Server/Atmos/Portable/PortableScrubberSystem.cs index 7dc141f8753..0854d1c0b11 100644 --- a/Content.Server/Atmos/Portable/PortableScrubberSystem.cs +++ b/Content.Server/Atmos/Portable/PortableScrubberSystem.cs @@ -57,6 +57,11 @@ private void OnDeviceUpdated(EntityUid uid, PortableScrubberComponent component, if (!component.Enabled) return; + // Frontier: check running gas extraction + if (!_atmosphereSystem.AtmosInputCanRunOnMap(args.Map)) + return; + // End Frontier + // If we are on top of a connector port, empty into it. if (_nodeContainer.TryGetNode(uid, component.PortName, out PortablePipeNode? portableNode) && portableNode.ConnectionsEnabled) diff --git a/Content.Shared/_NF/CCVar/NFCCVars.cs b/Content.Shared/_NF/CCVar/NFCCVars.cs index fee3e715a50..45c385a8cc2 100644 --- a/Content.Shared/_NF/CCVar/NFCCVars.cs +++ b/Content.Shared/_NF/CCVar/NFCCVars.cs @@ -242,4 +242,13 @@ public sealed class NFCCVars /// 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); } 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