Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Content.Server/Atmos/EntitySystems/AirFilterSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions Content.Server/Atmos/EntitySystems/AtmosphereSystem.CVars.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Shared._NF.CCVar; // Frontier
using Content.Shared.CCVar;
using Robust.Shared.Configuration;

Expand Down Expand Up @@ -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

/// <summary>
/// Time between each atmos sub-update. If you are writing an atmos device, use AtmosDeviceUpdateEvent.dt
Expand Down Expand Up @@ -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
}
}
}
16 changes: 16 additions & 0 deletions Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -128,4 +129,19 @@ private void PryTile(MapGridComponent mapGrid, Vector2i tile)

_tile.PryTile(tileRef);
}

// Frontier: disable atmos off maps
/// <summary>
/// Checks if atmos input devices are allowed to run on the given map entity.
/// </summary>
/// <param name="mapGrid">The map in question.</param>
public bool AtmosInputCanRunOnMap(EntityUid? mapUid)
{
// Frontier: check running gas extraction
if (!TryComp<MapComponent>(mapUid, out var mapComp))
return false;

return AllowMapGasExtraction || HasComp<FTLMapComponent>(mapUid) || mapComp.MapId == _gameTicker.DefaultMap;
}
// End Frontier: disable atmos off maps
}
2 changes: 2 additions & 0 deletions Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions Content.Server/Atmos/Portable/PortableScrubberSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions Content.Shared/_NF/CCVar/NFCCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,13 @@ public sealed class NFCCVars
/// </summary>
public static readonly CVarDef<float> CrateGenerationGridBoundsScale =
CVarDef.Create("nf14.events.crate_generation_grid_bounds_scale", 0.6f, CVar.SERVERONLY);

/*
* Atmos
*/
/// <summary>
/// If true, allows map extraction (scrubbing a planet's atmosphere).
/// </summary>
public static readonly CVarDef<bool> AllowMapGasExtraction =
CVarDef.Create("nf14.atmos.allow_map_gas_extraction", false, CVar.SERVER | CVar.REPLICATED);
}
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@
- type: ItemToggle
- type: ProximityBeeper
- type: ProximityDetector
range: 20
range: 64
criteria:
components:
- GasDeposit
Expand Down
Loading