Makes Airtight ECS. (#4351)
* Makes Airtight ECS. * Remove atmos holdovers while at it!
This commit is contained in:
committed by
GitHub
parent
0aaa2727c8
commit
93acc565f0
@@ -4,7 +4,6 @@ using Content.Client.Lobby;
|
||||
using Content.Client.Preferences;
|
||||
using Content.Client.State;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Preferences;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Shared;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
using Content.Server.Database;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Server.Administration.UI;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Inventory.Components;
|
||||
using Content.Server.Items;
|
||||
using Content.Server.PDA;
|
||||
|
||||
@@ -6,7 +6,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class AddAtmosCommand : IConsoleCommand
|
||||
@@ -1,15 +1,13 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class AddGasCommand : IConsoleCommand
|
||||
@@ -6,7 +6,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class AddUnsimulatedAtmosCommand : IConsoleCommand
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -10,7 +9,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class DeleteGasCommand : IConsoleCommand
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -8,7 +7,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class FillGas : IConsoleCommand
|
||||
@@ -1,6 +1,4 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -9,7 +7,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class FixGridAtmos : IConsoleCommand
|
||||
@@ -4,7 +4,7 @@ using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class ListGasesCommand : IConsoleCommand
|
||||
@@ -1,14 +1,12 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class RemoveGasCommand : IConsoleCommand
|
||||
@@ -1,5 +1,4 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -8,7 +7,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class SetAtmosTemperatureCommand : IConsoleCommand
|
||||
@@ -1,15 +1,13 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class SetTemperatureCommand : IConsoleCommand
|
||||
@@ -5,7 +5,7 @@ using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Commands.Atmos
|
||||
namespace Content.Server.Atmos.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public class ShowAtmos : IConsoleCommand
|
||||
@@ -11,159 +11,37 @@ using Robust.Shared.ViewVariables;
|
||||
namespace Content.Server.Atmos.Components
|
||||
{
|
||||
[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 (GridId Grid, Vector2i Tile) LastPosition { get; set; }
|
||||
|
||||
[DataField("airBlockedDirection", customTypeSerializer: typeof(FlagSerializer<AtmosDirectionFlags>))]
|
||||
[ViewVariables]
|
||||
private int _initialAirBlockedDirection = (int) AtmosDirection.All;
|
||||
public int InitialAirBlockedDirection { get; set; } = (int) AtmosDirection.All;
|
||||
|
||||
[ViewVariables]
|
||||
private int _currentAirBlockedDirection;
|
||||
public int CurrentAirBlockedDirection;
|
||||
|
||||
[DataField("airBlocked")]
|
||||
private bool _airBlocked = true;
|
||||
public bool AirBlocked { get; set; } = true;
|
||||
|
||||
[DataField("fixVacuum")]
|
||||
private bool _fixVacuum = true;
|
||||
public bool FixVacuum { get; set; } = true;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("rotateAirBlocked")]
|
||||
private bool _rotateAirBlocked = true;
|
||||
public bool RotateAirBlocked { get; set; } = true;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("fixAirBlockedDirectionInitialize")]
|
||||
private bool _fixAirBlockedDirectionInitialize = true;
|
||||
public bool FixAirBlockedDirectionInitialize { get; set; } = true;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("noAirWhenFullyAirBlocked")]
|
||||
public bool NoAirWhenFullyAirBlocked { get; } = true;
|
||||
public bool NoAirWhenFullyAirBlocked { get; set; } = true;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
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);
|
||||
}
|
||||
public AtmosDirection AirBlockedDirection => (AtmosDirection)CurrentAirBlockedDirection;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.Server.Atmos.Components
|
||||
_doorComponent.Close();
|
||||
if (Owner.TryGetComponent(out AirtightComponent? airtight))
|
||||
{
|
||||
airtight.AirBlocked = true;
|
||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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.ViewVariables;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ using System;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Body.Respiratory;
|
||||
using Content.Server.Explosion;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.NodeContainer;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Server.UserInterface;
|
||||
|
||||
@@ -1,26 +1,121 @@
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class AirtightSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<AirtightComponent, ComponentInit>(OnAirtightInit);
|
||||
SubscribeLocalEvent<AirtightComponent, ComponentShutdown>(OnAirtightShutdown);
|
||||
SubscribeLocalEvent<AirtightComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<AirtightComponent, AnchorStateChangedEvent>(OnAirtightPositionChanged);
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Atmos.Reactions;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
@@ -246,6 +246,9 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
var isAirBlocked = IsTileAirBlocked(mapGrid, indices);
|
||||
|
||||
tile.BlockedAirflow = GetBlockedDirections(mapGrid, indices);
|
||||
UpdateAdjacent(mapGrid, gridAtmosphere, tile);
|
||||
|
||||
if (IsTileSpace(mapGrid, indices) && !isAirBlocked)
|
||||
{
|
||||
tile.Air = new GasMixture(volume);
|
||||
@@ -293,11 +296,8 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
// Then we activate the tile again.
|
||||
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
|
||||
tile.ThermalConductivity = tile.Tile?.Tile.GetContentTileDefinition().ThermalConductivity ?? 0.5f;
|
||||
UpdateAdjacent(mapGrid, gridAtmosphere, tile);
|
||||
InvalidateVisuals(mapGrid.Index, indices);
|
||||
|
||||
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)
|
||||
{
|
||||
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...
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
@@ -1007,7 +1021,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!includeBlocked)
|
||||
{
|
||||
var direction = (AtmosDirection) (1 << i);
|
||||
if (tileAtmosphere.BlockedAirflow.IsFlagSet(direction))
|
||||
if (tile.BlockedAirflow.IsFlagSet(direction))
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1465,7 +1479,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!gridAtmosphere.Tiles.TryGetValue(tile, out var tileAtmosphere))
|
||||
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))
|
||||
{Temperature = Atmospherics.T20C};
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Atmos.Reactions;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Interfaces
|
||||
namespace Content.Server.Atmos
|
||||
{
|
||||
public interface IGasMixtureHolder
|
||||
{
|
||||
@@ -1,9 +1,7 @@
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Atmos.Reactions;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Interfaces
|
||||
namespace Content.Server.Atmos
|
||||
{
|
||||
public interface IGasReactionEffect
|
||||
{
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Coordinates.Helpers;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Coordinates.Helpers;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Fluids.Components;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Chemistry.Solution;
|
||||
using Content.Shared.Maps;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#nullable disable warnings
|
||||
#nullable enable annotations
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Linq;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Metabolism;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Body.Networks;
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Disposal.Tube.Components;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Items;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Body.Components;
|
||||
|
||||
@@ -9,7 +9,6 @@ using Content.Server.Construction.Components;
|
||||
using Content.Server.Disposal.Tube.Components;
|
||||
using Content.Server.DoAfter;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.ActionBlocker;
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
||||
using Content.Server.Access;
|
||||
using Content.Server.Access.Components;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Stunnable.Components;
|
||||
@@ -313,7 +314,7 @@ namespace Content.Server.Doors.Components
|
||||
{
|
||||
if (Owner.TryGetComponent(out AirtightComponent? airtight))
|
||||
{
|
||||
airtight.AirBlocked = false;
|
||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
||||
}
|
||||
base.OnPartialOpen();
|
||||
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))
|
||||
{
|
||||
airtight.AirBlocked = true;
|
||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
||||
}
|
||||
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, true));
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.NodeContainer.NodeGroups;
|
||||
using Content.Shared.Atmos;
|
||||
|
||||
@@ -177,6 +177,7 @@
|
||||
<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/=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/=Anchorable/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Antag/@EntryIndexedValue">True</s:Boolean>
|
||||
|
||||
Reference in New Issue
Block a user