Add UnsimulatedGridAtmosphereComponent and a command to add it (#2019)
* Add UnsimulatedGridAtmosphereComponent * Override prytile, repopulate, invalidate and revalidate * Attributes
This commit is contained in:
@@ -17,11 +17,21 @@ namespace Content.Server.Atmos
|
|||||||
{
|
{
|
||||||
public string Command => "addatmos";
|
public string Command => "addatmos";
|
||||||
public string Description => "Adds atmos support to a grid.";
|
public string Description => "Adds atmos support to a grid.";
|
||||||
public string Help => "addatmos <GridId>";
|
public string Help => $"{Command} <GridId>";
|
||||||
|
|
||||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length < 1) return;
|
if (args.Length < 1)
|
||||||
if(!int.TryParse(args[0], out var id)) return;
|
{
|
||||||
|
shell.SendText(player, Help);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!int.TryParse(args[0], out var id))
|
||||||
|
{
|
||||||
|
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var gridId = new GridId(id);
|
var gridId = new GridId(id);
|
||||||
|
|
||||||
@@ -29,7 +39,7 @@ namespace Content.Server.Atmos
|
|||||||
|
|
||||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||||
{
|
{
|
||||||
shell.SendText(player, "Invalid grid ID.");
|
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +51,7 @@ namespace Content.Server.Atmos
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grid.HasComponent<GridAtmosphereComponent>())
|
if (grid.HasComponent<IGridAtmosphereComponent>())
|
||||||
{
|
{
|
||||||
shell.SendText(player, "Grid already has an atmosphere.");
|
shell.SendText(player, "Grid already has an atmosphere.");
|
||||||
return;
|
return;
|
||||||
@@ -53,6 +63,56 @@ namespace Content.Server.Atmos
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AddUnsimulatedAtmos : IClientCommand
|
||||||
|
{
|
||||||
|
public string Command => "addunsimulatedatmos";
|
||||||
|
public string Description => "Adds unimulated atmos support to a grid.";
|
||||||
|
public string Help => $"{Command} <GridId>";
|
||||||
|
|
||||||
|
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length < 1)
|
||||||
|
{
|
||||||
|
shell.SendText(player, Help);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!int.TryParse(args[0], out var id))
|
||||||
|
{
|
||||||
|
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var gridId = new GridId(id);
|
||||||
|
|
||||||
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
|
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||||
|
{
|
||||||
|
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
|
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||||
|
{
|
||||||
|
shell.SendText(player, "Failed to get grid entity.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grid.HasComponent<IGridAtmosphereComponent>())
|
||||||
|
{
|
||||||
|
shell.SendText(player, "Grid already has an atmosphere.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
grid.AddComponent<UnsimulatedGridAtmosphereComponent>();
|
||||||
|
|
||||||
|
shell.SendText(player, $"Added unsimulated atmosphere to grid {id}.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class ListGases : IClientCommand
|
public class ListGases : IClientCommand
|
||||||
{
|
{
|
||||||
public string Command => "listgases";
|
public string Command => "listgases";
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.GameObjects.Components.Map;
|
using Robust.Shared.GameObjects.Components.Map;
|
||||||
using Robust.Shared.GameObjects.Components.Transform;
|
using Robust.Shared.GameObjects.Components.Transform;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.Interfaces.Timing;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -72,7 +69,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
private double _excitedGroupLastProcess;
|
private double _excitedGroupLastProcess;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private readonly Dictionary<MapIndices, TileAtmosphere> _tiles = new Dictionary<MapIndices, TileAtmosphere>(1000);
|
protected readonly Dictionary<MapIndices, TileAtmosphere> Tiles = new Dictionary<MapIndices, TileAtmosphere>(1000);
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private readonly HashSet<TileAtmosphere> _activeTiles = new HashSet<TileAtmosphere>(1000);
|
private readonly HashSet<TileAtmosphere> _activeTiles = new HashSet<TileAtmosphere>(1000);
|
||||||
@@ -156,7 +153,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void PryTile(MapIndices indices)
|
public virtual void PryTile(MapIndices indices)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out IMapGridComponent? mapGridComponent)) return;
|
if (!Owner.TryGetComponent(out IMapGridComponent? mapGridComponent)) return;
|
||||||
if (IsSpace(indices) || IsAirBlocked(indices)) return;
|
if (IsSpace(indices) || IsAirBlocked(indices)) return;
|
||||||
@@ -177,17 +174,17 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
RepopulateTiles();
|
RepopulateTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RepopulateTiles()
|
public virtual void RepopulateTiles()
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
||||||
|
|
||||||
foreach (var tile in mapGrid.Grid.GetAllTiles())
|
foreach (var tile in mapGrid.Grid.GetAllTiles())
|
||||||
{
|
{
|
||||||
if(!_tiles.ContainsKey(tile.GridIndices))
|
if(!Tiles.ContainsKey(tile.GridIndices))
|
||||||
_tiles.Add(tile.GridIndices, new TileAtmosphere(this, tile.GridIndex, tile.GridIndices, new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C}));
|
Tiles.Add(tile.GridIndices, new TileAtmosphere(this, tile.GridIndex, tile.GridIndices, new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C}));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var (_, tile) in _tiles.ToArray())
|
foreach (var (_, tile) in Tiles.ToArray())
|
||||||
{
|
{
|
||||||
tile.UpdateAdjacent();
|
tile.UpdateAdjacent();
|
||||||
tile.UpdateVisuals();
|
tile.UpdateVisuals();
|
||||||
@@ -195,12 +192,12 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Invalidate(MapIndices indices)
|
public virtual void Invalidate(MapIndices indices)
|
||||||
{
|
{
|
||||||
_invalidatedCoords.Add(indices);
|
_invalidatedCoords.Add(indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Revalidate()
|
protected virtual void Revalidate()
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
||||||
|
|
||||||
@@ -212,14 +209,14 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
if (tile == null)
|
if (tile == null)
|
||||||
{
|
{
|
||||||
tile = new TileAtmosphere(this, mapGrid.Grid.Index, indices, new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C});
|
tile = new TileAtmosphere(this, mapGrid.Grid.Index, indices, new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C});
|
||||||
_tiles[indices] = tile;
|
Tiles[indices] = tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSpace(indices))
|
if (IsSpace(indices))
|
||||||
{
|
{
|
||||||
tile.Air = new GasMixture(GetVolumeForCells(1));
|
tile.Air = new GasMixture(GetVolumeForCells(1));
|
||||||
tile.Air.MarkImmutable();
|
tile.Air.MarkImmutable();
|
||||||
_tiles[indices] = tile;
|
Tiles[indices] = tile;
|
||||||
|
|
||||||
} else if (IsAirBlocked(indices))
|
} else if (IsAirBlocked(indices))
|
||||||
{
|
{
|
||||||
@@ -257,18 +254,18 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void FixVacuum(MapIndices indices)
|
public virtual void FixVacuum(MapIndices indices)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
||||||
var tile = GetTile(indices);
|
var tile = GetTile(indices);
|
||||||
if (tile?.GridIndex != mapGrid.Grid.Index) return;
|
if (tile?.GridIndex != mapGrid.Grid.Index) return;
|
||||||
var adjacent = GetAdjacentTiles(indices);
|
var adjacent = GetAdjacentTiles(indices);
|
||||||
tile.Air = new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C};
|
tile.Air = new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C};
|
||||||
_tiles[indices] = tile;
|
Tiles[indices] = tile;
|
||||||
|
|
||||||
var ratio = 1f / adjacent.Count;
|
var ratio = 1f / adjacent.Count;
|
||||||
|
|
||||||
foreach (var (direction, adj) in adjacent)
|
foreach (var (_, adj) in adjacent)
|
||||||
{
|
{
|
||||||
var mix = adj.Air.RemoveRatio(ratio);
|
var mix = adj.Air.RemoveRatio(ratio);
|
||||||
tile.Air.Merge(mix);
|
tile.Air.Merge(mix);
|
||||||
@@ -278,7 +275,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void AddActiveTile(TileAtmosphere? tile)
|
public virtual void AddActiveTile(TileAtmosphere? tile)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
||||||
if (tile?.GridIndex != mapGrid.Grid.Index) return;
|
if (tile?.GridIndex != mapGrid.Grid.Index) return;
|
||||||
@@ -288,7 +285,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void RemoveActiveTile(TileAtmosphere? tile)
|
public virtual void RemoveActiveTile(TileAtmosphere? tile)
|
||||||
{
|
{
|
||||||
if (tile == null) return;
|
if (tile == null) return;
|
||||||
_activeTiles.Remove(tile);
|
_activeTiles.Remove(tile);
|
||||||
@@ -298,7 +295,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void AddHotspotTile(TileAtmosphere? tile)
|
public virtual void AddHotspotTile(TileAtmosphere? tile)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
||||||
if (tile?.GridIndex != mapGrid.Grid.Index || tile?.Air == null) return;
|
if (tile?.GridIndex != mapGrid.Grid.Index || tile?.Air == null) return;
|
||||||
@@ -307,20 +304,20 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void RemoveHotspotTile(TileAtmosphere? tile)
|
public virtual void RemoveHotspotTile(TileAtmosphere? tile)
|
||||||
{
|
{
|
||||||
if (tile == null) return;
|
if (tile == null) return;
|
||||||
_hotspotTiles.Remove(tile);
|
_hotspotTiles.Remove(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddSuperconductivityTile(TileAtmosphere? tile)
|
public virtual void AddSuperconductivityTile(TileAtmosphere? tile)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
||||||
if (tile?.GridIndex != mapGrid.Grid.Index) return;
|
if (tile?.GridIndex != mapGrid.Grid.Index) return;
|
||||||
_superconductivityTiles.Add(tile);
|
_superconductivityTiles.Add(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveSuperconductivityTile(TileAtmosphere? tile)
|
public virtual void RemoveSuperconductivityTile(TileAtmosphere? tile)
|
||||||
{
|
{
|
||||||
if (tile == null) return;
|
if (tile == null) return;
|
||||||
_superconductivityTiles.Remove(tile);
|
_superconductivityTiles.Remove(tile);
|
||||||
@@ -328,7 +325,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void AddHighPressureDelta(TileAtmosphere? tile)
|
public virtual void AddHighPressureDelta(TileAtmosphere? tile)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
||||||
if (tile?.GridIndex != mapGrid.Grid.Index) return;
|
if (tile?.GridIndex != mapGrid.Grid.Index) return;
|
||||||
@@ -337,21 +334,21 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool HasHighPressureDelta(TileAtmosphere tile)
|
public virtual bool HasHighPressureDelta(TileAtmosphere tile)
|
||||||
{
|
{
|
||||||
return _highPressureDelta.Contains(tile);
|
return _highPressureDelta.Contains(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void AddExcitedGroup(ExcitedGroup excitedGroup)
|
public virtual void AddExcitedGroup(ExcitedGroup excitedGroup)
|
||||||
{
|
{
|
||||||
_excitedGroups.Add(excitedGroup);
|
_excitedGroups.Add(excitedGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void RemoveExcitedGroup(ExcitedGroup excitedGroup)
|
public virtual void RemoveExcitedGroup(ExcitedGroup excitedGroup)
|
||||||
{
|
{
|
||||||
_excitedGroups.Remove(excitedGroup);
|
_excitedGroups.Remove(excitedGroup);
|
||||||
}
|
}
|
||||||
@@ -387,7 +384,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return null;
|
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return null;
|
||||||
|
|
||||||
if (_tiles.TryGetValue(indices, out var tile)) return tile;
|
if (Tiles.TryGetValue(indices, out var tile)) return tile;
|
||||||
|
|
||||||
// We don't have that tile!
|
// We don't have that tile!
|
||||||
if (IsSpace(indices) && createSpace)
|
if (IsSpace(indices) && createSpace)
|
||||||
@@ -440,7 +437,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Update(float frameTime)
|
public virtual void Update(float frameTime)
|
||||||
{
|
{
|
||||||
_timer += frameTime;
|
_timer += frameTime;
|
||||||
|
|
||||||
@@ -540,7 +537,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
UpdateCounter++;
|
UpdateCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ProcessTileEqualize(bool resumed = false)
|
public virtual bool ProcessTileEqualize(bool resumed = false)
|
||||||
{
|
{
|
||||||
_stopwatch.Restart();
|
_stopwatch.Restart();
|
||||||
|
|
||||||
@@ -567,7 +564,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ProcessActiveTiles(bool resumed = false)
|
public virtual bool ProcessActiveTiles(bool resumed = false)
|
||||||
{
|
{
|
||||||
_stopwatch.Restart();
|
_stopwatch.Restart();
|
||||||
|
|
||||||
@@ -594,7 +591,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ProcessExcitedGroups(bool resumed = false)
|
public virtual bool ProcessExcitedGroups(bool resumed = false)
|
||||||
{
|
{
|
||||||
_stopwatch.Restart();
|
_stopwatch.Restart();
|
||||||
|
|
||||||
@@ -628,7 +625,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ProcessHighPressureDelta(bool resumed = false)
|
public virtual bool ProcessHighPressureDelta(bool resumed = false)
|
||||||
{
|
{
|
||||||
_stopwatch.Restart();
|
_stopwatch.Restart();
|
||||||
|
|
||||||
@@ -658,7 +655,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ProcessHotspots(bool resumed = false)
|
protected virtual bool ProcessHotspots(bool resumed = false)
|
||||||
{
|
{
|
||||||
_stopwatch.Restart();
|
_stopwatch.Restart();
|
||||||
|
|
||||||
@@ -685,7 +682,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ProcessSuperconductivity(bool resumed = false)
|
protected virtual bool ProcessSuperconductivity(bool resumed = false)
|
||||||
{
|
{
|
||||||
_stopwatch.Restart();
|
_stopwatch.Restart();
|
||||||
|
|
||||||
@@ -712,7 +709,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ProcessPipeNets(bool resumed = false)
|
protected virtual bool ProcessPipeNets(bool resumed = false)
|
||||||
{
|
{
|
||||||
_stopwatch.Restart();
|
_stopwatch.Restart();
|
||||||
|
|
||||||
@@ -739,7 +736,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ProcessPipeNetDevices(bool resumed = false)
|
protected virtual bool ProcessPipeNetDevices(bool resumed = false)
|
||||||
{
|
{
|
||||||
_stopwatch.Restart();
|
_stopwatch.Restart();
|
||||||
|
|
||||||
@@ -796,11 +793,11 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
!serializer.TryReadDataField("tiles", out Dictionary<MapIndices, int>? tiles))
|
!serializer.TryReadDataField("tiles", out Dictionary<MapIndices, int>? tiles))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_tiles.Clear();
|
Tiles.Clear();
|
||||||
|
|
||||||
foreach (var (indices, mix) in tiles!)
|
foreach (var (indices, mix) in tiles!)
|
||||||
{
|
{
|
||||||
_tiles.Add(indices, new TileAtmosphere(this, gridId, indices, (GasMixture)uniqueMixes![mix].Clone()));
|
Tiles.Add(indices, new TileAtmosphere(this, gridId, indices, (GasMixture)uniqueMixes![mix].Clone()));
|
||||||
Invalidate(indices);
|
Invalidate(indices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -809,7 +806,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
var uniqueMixes = new List<GasMixture>();
|
var uniqueMixes = new List<GasMixture>();
|
||||||
var uniqueMixHash = new Dictionary<GasMixture, int>();
|
var uniqueMixHash = new Dictionary<GasMixture, int>();
|
||||||
var tiles = new Dictionary<MapIndices, int>();
|
var tiles = new Dictionary<MapIndices, int>();
|
||||||
foreach (var (indices, tile) in _tiles)
|
foreach (var (indices, tile) in Tiles)
|
||||||
{
|
{
|
||||||
if (tile.Air == null) continue;
|
if (tile.Air == null) continue;
|
||||||
|
|
||||||
@@ -832,7 +829,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
public IEnumerator<TileAtmosphere> GetEnumerator()
|
public IEnumerator<TileAtmosphere> GetEnumerator()
|
||||||
{
|
{
|
||||||
return _tiles.Values.GetEnumerator();
|
return Tiles.Values.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
@@ -841,7 +838,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void BurnTile(MapIndices gridIndices)
|
public virtual void BurnTile(MapIndices gridIndices)
|
||||||
{
|
{
|
||||||
// TODO ATMOS
|
// TODO ATMOS
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using Content.Server.Atmos;
|
||||||
|
using Content.Shared.Atmos;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Map;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
|
namespace Content.Server.GameObjects.Components.Atmos
|
||||||
|
{
|
||||||
|
[RegisterComponent]
|
||||||
|
[ComponentReference(typeof(IGridAtmosphereComponent))]
|
||||||
|
[ComponentReference(typeof(GridAtmosphereComponent))]
|
||||||
|
[Serializable]
|
||||||
|
public class UnsimulatedGridAtmosphereComponent : GridAtmosphereComponent, IGridAtmosphereComponent
|
||||||
|
{
|
||||||
|
public override string Name => "UnsimulatedGridAtmosphere";
|
||||||
|
|
||||||
|
public override void PryTile(MapIndices indices) { }
|
||||||
|
|
||||||
|
public override void RepopulateTiles()
|
||||||
|
{
|
||||||
|
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
|
||||||
|
|
||||||
|
foreach (var tile in mapGrid.Grid.GetAllTiles())
|
||||||
|
{
|
||||||
|
if(!Tiles.ContainsKey(tile.GridIndices))
|
||||||
|
Tiles.Add(tile.GridIndices, new TileAtmosphere(this, tile.GridIndex, tile.GridIndices, new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Invalidate(MapIndices indices) { }
|
||||||
|
|
||||||
|
protected override void Revalidate() { }
|
||||||
|
|
||||||
|
public override void FixVacuum(MapIndices indices) { }
|
||||||
|
|
||||||
|
public override void AddActiveTile(TileAtmosphere? tile) { }
|
||||||
|
|
||||||
|
public override void RemoveActiveTile(TileAtmosphere? tile) { }
|
||||||
|
|
||||||
|
public override void AddHotspotTile(TileAtmosphere? tile) { }
|
||||||
|
|
||||||
|
public override void RemoveHotspotTile(TileAtmosphere? tile) { }
|
||||||
|
|
||||||
|
public override void AddSuperconductivityTile(TileAtmosphere? tile) { }
|
||||||
|
|
||||||
|
public override void RemoveSuperconductivityTile(TileAtmosphere? tile) { }
|
||||||
|
|
||||||
|
public override void AddHighPressureDelta(TileAtmosphere? tile) { }
|
||||||
|
|
||||||
|
public override bool HasHighPressureDelta(TileAtmosphere tile)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AddExcitedGroup(ExcitedGroup excitedGroup) { }
|
||||||
|
|
||||||
|
public override void RemoveExcitedGroup(ExcitedGroup excitedGroup) { }
|
||||||
|
|
||||||
|
public override void Update(float frameTime) { }
|
||||||
|
|
||||||
|
public override bool ProcessTileEqualize(bool resumed = false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool ProcessActiveTiles(bool resumed = false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool ProcessExcitedGroups(bool resumed = false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool ProcessHighPressureDelta(bool resumed = false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool ProcessHotspots(bool resumed = false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool ProcessSuperconductivity(bool resumed = false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool ProcessPipeNets(bool resumed = false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool ProcessPipeNetDevices(bool resumed = false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user