Makes Airtight ECS. (#4351)

* Makes Airtight ECS.

* Remove atmos holdovers while at it!
This commit is contained in:
Vera Aguilera Puerto
2021-07-25 09:04:58 +02:00
committed by GitHub
parent 0aaa2727c8
commit 93acc565f0
44 changed files with 151 additions and 193 deletions

View File

@@ -4,7 +4,6 @@ using Content.Client.Lobby;
using Content.Client.Preferences; using Content.Client.Preferences;
using Content.Client.State; using Content.Client.State;
using Content.Server.GameTicking; using Content.Server.GameTicking;
using Content.Server.Interfaces;
using Content.Server.Preferences; using Content.Server.Preferences;
using Content.Server.Preferences.Managers; using Content.Server.Preferences.Managers;
using Content.Shared; using Content.Shared;

View File

@@ -1,6 +1,5 @@
using Content.Server.Database; using Content.Server.Database;
using Content.Server.Interfaces;
using Content.Server.Preferences.Managers; using Content.Server.Preferences.Managers;
using Content.Shared.Administration; using Content.Shared.Administration;
using Robust.Server.Player; using Robust.Server.Player;

View File

@@ -1,6 +1,5 @@
using Content.Server.Administration.UI; using Content.Server.Administration.UI;
using Content.Server.EUI; using Content.Server.EUI;
using Content.Server.Interfaces;
using Content.Server.Inventory.Components; using Content.Server.Inventory.Components;
using Content.Server.Items; using Content.Server.Items;
using Content.Server.PDA; using Content.Server.PDA;

View File

@@ -6,7 +6,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class AddAtmosCommand : IConsoleCommand public class AddAtmosCommand : IConsoleCommand

View File

@@ -1,15 +1,13 @@
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Maths; using Robust.Shared.Maths;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class AddGasCommand : IConsoleCommand public class AddGasCommand : IConsoleCommand

View File

@@ -6,7 +6,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class AddUnsimulatedAtmosCommand : IConsoleCommand public class AddUnsimulatedAtmosCommand : IConsoleCommand

View File

@@ -1,6 +1,5 @@
using System; using System;
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Atmos; using Content.Shared.Atmos;
@@ -10,7 +9,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class DeleteGasCommand : IConsoleCommand public class DeleteGasCommand : IConsoleCommand

View File

@@ -1,5 +1,4 @@
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Atmos; using Content.Shared.Atmos;
@@ -8,7 +7,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class FillGas : IConsoleCommand public class FillGas : IConsoleCommand

View File

@@ -1,6 +1,4 @@
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Atmos;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Atmos; using Content.Shared.Atmos;
@@ -9,7 +7,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class FixGridAtmos : IConsoleCommand public class FixGridAtmos : IConsoleCommand

View File

@@ -4,7 +4,7 @@ using Content.Shared.Administration;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class ListGasesCommand : IConsoleCommand public class ListGasesCommand : IConsoleCommand

View File

@@ -1,14 +1,12 @@
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration; using Content.Shared.Administration;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Maths; using Robust.Shared.Maths;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class RemoveGasCommand : IConsoleCommand public class RemoveGasCommand : IConsoleCommand

View File

@@ -1,5 +1,4 @@
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Atmos; using Content.Shared.Atmos;
@@ -8,7 +7,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class SetAtmosTemperatureCommand : IConsoleCommand public class SetAtmosTemperatureCommand : IConsoleCommand

View File

@@ -1,15 +1,13 @@
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Maths; using Robust.Shared.Maths;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class SetTemperatureCommand : IConsoleCommand public class SetTemperatureCommand : IConsoleCommand

View File

@@ -5,7 +5,7 @@ using Robust.Server.Player;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
namespace Content.Server.Commands.Atmos namespace Content.Server.Atmos.Commands
{ {
[AdminCommand(AdminFlags.Debug)] [AdminCommand(AdminFlags.Debug)]
public class ShowAtmos : IConsoleCommand public class ShowAtmos : IConsoleCommand

View File

@@ -11,159 +11,37 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.Atmos.Components namespace Content.Server.Atmos.Components
{ {
[RegisterComponent] [RegisterComponent]
public class AirtightComponent : Component, IMapInit public class AirtightComponent : Component
{ {
[Dependency] private readonly IMapManager _mapManager = default!;
private (GridId, Vector2i) _lastPosition;
public override string Name => "Airtight"; public override string Name => "Airtight";
public (GridId Grid, Vector2i Tile) LastPosition { get; set; }
[DataField("airBlockedDirection", customTypeSerializer: typeof(FlagSerializer<AtmosDirectionFlags>))] [DataField("airBlockedDirection", customTypeSerializer: typeof(FlagSerializer<AtmosDirectionFlags>))]
[ViewVariables] [ViewVariables]
private int _initialAirBlockedDirection = (int) AtmosDirection.All; public int InitialAirBlockedDirection { get; set; } = (int) AtmosDirection.All;
[ViewVariables] [ViewVariables]
private int _currentAirBlockedDirection; public int CurrentAirBlockedDirection;
[DataField("airBlocked")] [DataField("airBlocked")]
private bool _airBlocked = true; public bool AirBlocked { get; set; } = true;
[DataField("fixVacuum")] [DataField("fixVacuum")]
private bool _fixVacuum = true; public bool FixVacuum { get; set; } = true;
[ViewVariables] [ViewVariables]
[DataField("rotateAirBlocked")] [DataField("rotateAirBlocked")]
private bool _rotateAirBlocked = true; public bool RotateAirBlocked { get; set; } = true;
[ViewVariables] [ViewVariables]
[DataField("fixAirBlockedDirectionInitialize")] [DataField("fixAirBlockedDirectionInitialize")]
private bool _fixAirBlockedDirectionInitialize = true; public bool FixAirBlockedDirectionInitialize { get; set; } = true;
[ViewVariables] [ViewVariables]
[DataField("noAirWhenFullyAirBlocked")] [DataField("noAirWhenFullyAirBlocked")]
public bool NoAirWhenFullyAirBlocked { get; } = true; public bool NoAirWhenFullyAirBlocked { get; set; } = true;
[ViewVariables(VVAccess.ReadWrite)] public AtmosDirection AirBlockedDirection => (AtmosDirection)CurrentAirBlockedDirection;
public bool AirBlocked
{
get => _airBlocked;
set
{
_airBlocked = value;
UpdatePosition();
}
}
public AtmosDirection AirBlockedDirection
{
get => (AtmosDirection)_currentAirBlockedDirection;
set
{
_currentAirBlockedDirection = (int) value;
_initialAirBlockedDirection = (int)Rotate(AirBlockedDirection, -Owner.Transform.LocalRotation);
UpdatePosition();
}
}
[ViewVariables]
public bool FixVacuum => _fixVacuum;
protected override void Initialize()
{
base.Initialize();
if (_fixAirBlockedDirectionInitialize)
RotateEvent(new RotateEvent(Owner, Angle.Zero, Owner.Transform.WorldRotation));
// Adding this component will immediately anchor the entity, because the atmos system
// requires airtight entities to be anchored for performance.
Owner.Transform.Anchored = true;
UpdatePosition();
}
public void RotateEvent(RotateEvent ev)
{
if (!_rotateAirBlocked || ev.Sender != Owner || _initialAirBlockedDirection == (int)AtmosDirection.Invalid)
return;
_currentAirBlockedDirection = (int) Rotate((AtmosDirection)_initialAirBlockedDirection, ev.NewRotation);
UpdatePosition();
}
private AtmosDirection Rotate(AtmosDirection myDirection, Angle myAngle)
{
var newAirBlockedDirs = AtmosDirection.Invalid;
if (myAngle == Angle.Zero)
return myDirection;
// TODO ATMOS MULTIZ When we make multiZ atmos, special case this.
for (var i = 0; i < Atmospherics.Directions; i++)
{
var direction = (AtmosDirection) (1 << i);
if (!myDirection.IsFlagSet(direction)) continue;
var angle = direction.ToAngle();
angle += myAngle;
newAirBlockedDirs |= angle.ToAtmosDirectionCardinal();
}
return newAirBlockedDirs;
}
public void MapInit()
{
UpdatePosition();
}
protected override void Shutdown()
{
base.Shutdown();
_airBlocked = false;
InvalidatePosition(_lastPosition.Item1, _lastPosition.Item2);
if (_fixVacuum)
{
EntitySystem.Get<AtmosphereSystem>().FixVacuum(_lastPosition.Item1, _lastPosition.Item2);
}
}
public void AnchorStateChanged()
{
var gridId = Owner.Transform.GridID;
var coords = Owner.Transform.Coordinates;
var grid = _mapManager.GetGrid(gridId);
var tilePos = grid.TileIndicesFor(coords);
// Update and invalidate new position.
_lastPosition = (gridId, tilePos);
InvalidatePosition(gridId, tilePos);
}
private void UpdatePosition()
{
if (!Owner.Transform.Anchored || !Owner.Transform.GridID.IsValid())
return;
var grid = _mapManager.GetGrid(Owner.Transform.GridID);
_lastPosition = (Owner.Transform.GridID, grid.TileIndicesFor(Owner.Transform.Coordinates));
InvalidatePosition(_lastPosition.Item1, _lastPosition.Item2);
}
private void InvalidatePosition(GridId gridId, Vector2i pos)
{
if (!gridId.IsValid())
return;
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
atmosphereSystem.UpdateAdjacent(gridId, pos);
atmosphereSystem.InvalidateTile(gridId, pos);
}
} }
} }

View File

@@ -28,7 +28,7 @@ namespace Content.Server.Atmos.Components
_doorComponent.Close(); _doorComponent.Close();
if (Owner.TryGetComponent(out AirtightComponent? airtight)) if (Owner.TryGetComponent(out AirtightComponent? airtight))
{ {
airtight.AirBlocked = true; EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
} }
return true; return true;
} }

View File

@@ -1,5 +1,4 @@
using Content.Server.Interfaces; using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;

View File

@@ -3,7 +3,6 @@ using System;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Respiratory; using Content.Server.Body.Respiratory;
using Content.Server.Explosion; using Content.Server.Explosion;
using Content.Server.Interfaces;
using Content.Server.NodeContainer; using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes; using Content.Server.NodeContainer.Nodes;
using Content.Server.UserInterface; using Content.Server.UserInterface;

View File

@@ -1,26 +1,121 @@
using Content.Server.Atmos.Components; using Content.Server.Atmos.Components;
using Content.Shared.Atmos;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
namespace Content.Server.Atmos.EntitySystems namespace Content.Server.Atmos.EntitySystems
{ {
[UsedImplicitly] [UsedImplicitly]
public class AirtightSystem : EntitySystem public class AirtightSystem : EntitySystem
{ {
[Dependency] private readonly IMapManager _mapManager = default!;
public override void Initialize() public override void Initialize()
{ {
SubscribeLocalEvent<AirtightComponent, ComponentInit>(OnAirtightInit);
SubscribeLocalEvent<AirtightComponent, ComponentShutdown>(OnAirtightShutdown);
SubscribeLocalEvent<AirtightComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<AirtightComponent, AnchorStateChangedEvent>(OnAirtightPositionChanged); SubscribeLocalEvent<AirtightComponent, AnchorStateChangedEvent>(OnAirtightPositionChanged);
SubscribeLocalEvent<AirtightComponent, RotateEvent>(OnAirtightRotated); SubscribeLocalEvent<AirtightComponent, RotateEvent>(OnAirtightRotated);
} }
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent component, AnchorStateChangedEvent args) private void OnAirtightInit(EntityUid uid, AirtightComponent airtight, ComponentInit args)
{ {
component.AnchorStateChanged(); if (airtight.FixAirBlockedDirectionInitialize)
OnAirtightRotated(uid, airtight, new RotateEvent(airtight.Owner, Angle.Zero, airtight.Owner.Transform.WorldRotation));
// Adding this component will immediately anchor the entity, because the atmos system
// requires airtight entities to be anchored for performance.
airtight.Owner.Transform.Anchored = true;
UpdatePosition(airtight);
}
private void OnAirtightShutdown(EntityUid uid, AirtightComponent airtight, ComponentShutdown args)
{
SetAirblocked(airtight, false);
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2);
if (airtight.FixVacuum)
{
Get<AtmosphereSystem>().FixVacuum(airtight.LastPosition.Item1, airtight.LastPosition.Item2);
}
}
private void OnMapInit(EntityUid uid, AirtightComponent airtight, MapInitEvent args)
{
}
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, AnchorStateChangedEvent args)
{
var gridId = airtight.Owner.Transform.GridID;
var coords = airtight.Owner.Transform.Coordinates;
var grid = _mapManager.GetGrid(gridId);
var tilePos = grid.TileIndicesFor(coords);
// Update and invalidate new position.
airtight.LastPosition = (gridId, tilePos);
InvalidatePosition(gridId, tilePos);
} }
private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, RotateEvent ev) private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, RotateEvent ev)
{ {
airtight.RotateEvent(ev); if (!airtight.RotateAirBlocked || airtight.InitialAirBlockedDirection == (int)AtmosDirection.Invalid)
return;
airtight.CurrentAirBlockedDirection = (int) Rotate((AtmosDirection)airtight.InitialAirBlockedDirection, ev.NewRotation);
UpdatePosition(airtight);
}
public void SetAirblocked(AirtightComponent airtight, bool airblocked)
{
airtight.AirBlocked = airblocked;
UpdatePosition(airtight);
}
public void UpdatePosition(AirtightComponent airtight)
{
if (!airtight.Owner.Transform.Anchored || !airtight.Owner.Transform.GridID.IsValid())
return;
var grid = _mapManager.GetGrid(airtight.Owner.Transform.GridID);
airtight.LastPosition = (airtight.Owner.Transform.GridID, grid.TileIndicesFor(airtight.Owner.Transform.Coordinates));
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2);
}
public void InvalidatePosition(GridId gridId, Vector2i pos)
{
if (!gridId.IsValid())
return;
var atmosphereSystem = Get<AtmosphereSystem>();
atmosphereSystem.UpdateAdjacent(gridId, pos);
atmosphereSystem.InvalidateTile(gridId, pos);
}
private AtmosDirection Rotate(AtmosDirection myDirection, Angle myAngle)
{
var newAirBlockedDirs = AtmosDirection.Invalid;
if (myAngle == Angle.Zero)
return myDirection;
// TODO ATMOS MULTIZ: When we make multiZ atmos, special case this.
for (var i = 0; i < Atmospherics.Directions; i++)
{
var direction = (AtmosDirection) (1 << i);
if (!myDirection.IsFlagSet(direction)) continue;
var angle = direction.ToAngle();
angle += myAngle;
newAirBlockedDirs |= angle.ToAtmosDirectionCardinal();
}
return newAirBlockedDirs;
} }
} }
} }

View File

@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Content.Server.Atmos.Reactions; using Content.Server.Atmos.Reactions;
using Content.Server.Interfaces;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Maths; using Robust.Shared.Maths;

View File

@@ -246,6 +246,9 @@ namespace Content.Server.Atmos.EntitySystems
var isAirBlocked = IsTileAirBlocked(mapGrid, indices); var isAirBlocked = IsTileAirBlocked(mapGrid, indices);
tile.BlockedAirflow = GetBlockedDirections(mapGrid, indices);
UpdateAdjacent(mapGrid, gridAtmosphere, tile);
if (IsTileSpace(mapGrid, indices) && !isAirBlocked) if (IsTileSpace(mapGrid, indices) && !isAirBlocked)
{ {
tile.Air = new GasMixture(volume); tile.Air = new GasMixture(volume);
@@ -293,11 +296,8 @@ namespace Content.Server.Atmos.EntitySystems
// Then we activate the tile again. // Then we activate the tile again.
AddActiveTile(gridAtmosphere, tile); AddActiveTile(gridAtmosphere, tile);
tile.BlockedAirflow = GetBlockedDirections(mapGrid, indices);
// TODO ATMOS: Query all the contents of this tile (like walls) and calculate the correct thermal conductivity // TODO ATMOS: Query all the contents of this tile (like walls) and calculate the correct thermal conductivity
tile.ThermalConductivity = tile.Tile?.Tile.GetContentTileDefinition().ThermalConductivity ?? 0.5f; tile.ThermalConductivity = tile.Tile?.Tile.GetContentTileDefinition().ThermalConductivity ?? 0.5f;
UpdateAdjacent(mapGrid, gridAtmosphere, tile);
InvalidateVisuals(mapGrid.Index, indices); InvalidateVisuals(mapGrid.Index, indices);
for (var i = 0; i < Atmospherics.Directions; i++) for (var i = 0; i < Atmospherics.Directions; i++)
@@ -993,11 +993,25 @@ namespace Content.Server.Atmos.EntitySystems
public IEnumerable<GasMixture> GetAdjacentTileMixtures(GridAtmosphereComponent gridAtmosphere, Vector2i tile, bool includeBlocked = false, bool invalidate = false) public IEnumerable<GasMixture> GetAdjacentTileMixtures(GridAtmosphereComponent gridAtmosphere, Vector2i tile, bool includeBlocked = false, bool invalidate = false)
{ {
if (!gridAtmosphere.Tiles.TryGetValue(tile, out var tileAtmosphere)) if (!gridAtmosphere.Tiles.TryGetValue(tile, out var tileAtmosphere))
yield break; return Enumerable.Empty<GasMixture>();
for (var i = 0; i < tileAtmosphere.AdjacentTiles.Length; i++) return GetAdjacentTileMixtures(gridAtmosphere, tileAtmosphere, includeBlocked, invalidate);
}
/// <summary>
/// Gets all tile gas mixtures adjacent to a specific tile, and optionally invalidates them.
/// Does not return the tile in question, only the adjacent ones.
/// </summary>
/// <param name="gridAtmosphere">Grid Atmosphere where the tile is.</param>
/// <param name="tile">Tile Atmosphere in question.</param>
/// <param name="includeBlocked">Whether to include tiles in directions the tile is air-blocked in.</param>
/// <param name="invalidate">Whether to invalidate all adjacent tiles.</param>
/// <returns>All adjacent tile gas mixtures to the tile in question</returns>
private IEnumerable<GasMixture> GetAdjacentTileMixtures(GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, bool includeBlocked = false, bool invalidate = false)
{
for (var i = 0; i < tile.AdjacentTiles.Length; i++)
{ {
var adjacentTile = tileAtmosphere.AdjacentTiles[i]; var adjacentTile = tile.AdjacentTiles[i];
// TileAtmosphere has nullable disabled, so just in case... // TileAtmosphere has nullable disabled, so just in case...
// ReSharper disable once ConditionIsAlwaysTrueOrFalse // ReSharper disable once ConditionIsAlwaysTrueOrFalse
@@ -1007,7 +1021,7 @@ namespace Content.Server.Atmos.EntitySystems
if (!includeBlocked) if (!includeBlocked)
{ {
var direction = (AtmosDirection) (1 << i); var direction = (AtmosDirection) (1 << i);
if (tileAtmosphere.BlockedAirflow.IsFlagSet(direction)) if (tile.BlockedAirflow.IsFlagSet(direction))
continue; continue;
} }
@@ -1465,7 +1479,7 @@ namespace Content.Server.Atmos.EntitySystems
if (!gridAtmosphere.Tiles.TryGetValue(tile, out var tileAtmosphere)) if (!gridAtmosphere.Tiles.TryGetValue(tile, out var tileAtmosphere))
return; return;
var adjacent = GetAdjacentTileMixtures(gridAtmosphere, tile, invalidate:true).ToArray(); var adjacent = GetAdjacentTileMixtures(gridAtmosphere, tileAtmosphere, false, true).ToArray();
tileAtmosphere.Air = new GasMixture(GetVolumeForTiles(tileAtmosphere.GridIndex, 1)) tileAtmosphere.Air = new GasMixture(GetVolumeForTiles(tileAtmosphere.GridIndex, 1))
{Temperature = Atmospherics.T20C}; {Temperature = Atmospherics.T20C};

View File

@@ -4,7 +4,6 @@ using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Reactions; using Content.Server.Atmos.Reactions;
using Content.Server.Interfaces;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Maths; using Robust.Shared.Maths;

View File

@@ -1,8 +1,7 @@
using Content.Server.Atmos; using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.EntitySystems;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
namespace Content.Server.Interfaces namespace Content.Server.Atmos
{ {
public interface IGasMixtureHolder public interface IGasMixtureHolder
{ {

View File

@@ -1,9 +1,7 @@
using Content.Server.Atmos;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Reactions; using Content.Server.Atmos.Reactions;
using Robust.Server.GameObjects;
namespace Content.Server.Interfaces namespace Content.Server.Atmos
{ {
public interface IGasReactionEffect public interface IGasReactionEffect
{ {

View File

@@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Interfaces;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;

View File

@@ -1,7 +1,6 @@
using System; using System;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Coordinates.Helpers; using Content.Server.Coordinates.Helpers;
using Content.Server.Interfaces;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;

View File

@@ -1,6 +1,5 @@
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Coordinates.Helpers; using Content.Server.Coordinates.Helpers;
using Content.Server.Interfaces;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;

View File

@@ -1,6 +1,5 @@
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Fluids.Components; using Content.Server.Fluids.Components;
using Content.Server.Interfaces;
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
using Content.Shared.Chemistry.Solution; using Content.Shared.Chemistry.Solution;
using Content.Shared.Maps; using Content.Shared.Maps;

View File

@@ -1,6 +1,5 @@
#nullable disable warnings #nullable disable warnings
#nullable enable annotations #nullable enable annotations
using Content.Server.Interfaces;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.Maps; using Content.Shared.Maps;
using Robust.Shared.Map; using Robust.Shared.Map;

View File

@@ -3,7 +3,6 @@ using System.Linq;
using Content.Server.Atmos; using Content.Server.Atmos;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Chemistry.Components; using Content.Server.Chemistry.Components;
using Content.Server.Interfaces;
using Content.Server.Metabolism; using Content.Server.Metabolism;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.Body.Networks; using Content.Shared.Body.Networks;

View File

@@ -4,7 +4,6 @@ using System.Linq;
using Content.Server.Atmos; using Content.Server.Atmos;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Disposal.Tube.Components; using Content.Server.Disposal.Tube.Components;
using Content.Server.Interfaces;
using Content.Server.Items; using Content.Server.Items;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.Body.Components; using Content.Shared.Body.Components;

View File

@@ -9,7 +9,6 @@ using Content.Server.Construction.Components;
using Content.Server.Disposal.Tube.Components; using Content.Server.Disposal.Tube.Components;
using Content.Server.DoAfter; using Content.Server.DoAfter;
using Content.Server.Hands.Components; using Content.Server.Hands.Components;
using Content.Server.Interfaces;
using Content.Server.Power.Components; using Content.Server.Power.Components;
using Content.Server.UserInterface; using Content.Server.UserInterface;
using Content.Shared.ActionBlocker; using Content.Shared.ActionBlocker;

View File

@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Content.Server.Access; using Content.Server.Access;
using Content.Server.Access.Components; using Content.Server.Access.Components;
using Content.Server.Atmos.Components; using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Construction.Components; using Content.Server.Construction.Components;
using Content.Server.Hands.Components; using Content.Server.Hands.Components;
using Content.Server.Stunnable.Components; using Content.Server.Stunnable.Components;
@@ -313,7 +314,7 @@ namespace Content.Server.Doors.Components
{ {
if (Owner.TryGetComponent(out AirtightComponent? airtight)) if (Owner.TryGetComponent(out AirtightComponent? airtight))
{ {
airtight.AirBlocked = false; EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
} }
base.OnPartialOpen(); base.OnPartialOpen();
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, false)); Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, false));
@@ -441,7 +442,7 @@ namespace Content.Server.Doors.Components
if (becomeairtight && Owner.TryGetComponent(out AirtightComponent? airtight)) if (becomeairtight && Owner.TryGetComponent(out AirtightComponent? airtight))
{ {
airtight.AirBlocked = true; EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
} }
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, true)); Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, true));

View File

@@ -4,7 +4,6 @@ using System.Linq;
using Content.Server.Atmos; using Content.Server.Atmos;
using Content.Server.Atmos.Components; using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.NodeContainer.Nodes; using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using Content.Server.Atmos; using Content.Server.Atmos;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Interfaces;
using Content.Server.NodeContainer.EntitySystems; using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.NodeGroups; using Content.Server.NodeContainer.NodeGroups;
using Content.Shared.Atmos; using Content.Shared.Atmos;

View File

@@ -177,6 +177,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=adminbus/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=adminbus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=adminned/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=adminned/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Aghost/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Aghost/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Airblocked/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=akms/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=akms/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Anchorable/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Anchorable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Antag/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Antag/@EntryIndexedValue">True</s:Boolean>