Revert "Update submodule (again)" (#7730)
This commit is contained in:
@@ -22,7 +22,6 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
SubscribeLocalEvent<AirtightComponent, ComponentInit>(OnAirtightInit);
|
||||
SubscribeLocalEvent<AirtightComponent, ComponentShutdown>(OnAirtightShutdown);
|
||||
SubscribeLocalEvent<AirtightComponent, AnchorStateChangedEvent>(OnAirtightPositionChanged);
|
||||
SubscribeLocalEvent<AirtightComponent, ReAnchorEvent>(OnAirtightReAnchor);
|
||||
SubscribeLocalEvent<AirtightComponent, RotateEvent>(OnAirtightRotated);
|
||||
}
|
||||
|
||||
@@ -58,7 +57,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, ref AnchorStateChangedEvent args)
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
var xform = EntityManager.GetComponent<TransformComponent>(uid);
|
||||
|
||||
var gridId = xform.GridID;
|
||||
var coords = xform.Coordinates;
|
||||
@@ -71,16 +70,6 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
InvalidatePosition(gridId, tilePos);
|
||||
}
|
||||
|
||||
private void OnAirtightReAnchor(EntityUid uid, AirtightComponent airtight, ref ReAnchorEvent args)
|
||||
{
|
||||
foreach (var gridId in new[] { args.OldGrid, args.GridId })
|
||||
{
|
||||
// Update and invalidate new position.
|
||||
airtight.LastPosition = (gridId, args.TilePos);
|
||||
InvalidatePosition(gridId, args.TilePos);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, ref RotateEvent ev)
|
||||
{
|
||||
if (!airtight.RotateAirBlocked || airtight.InitialAirBlockedDirection == (int)AtmosDirection.Invalid)
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
private void InitializeGrid()
|
||||
{
|
||||
SubscribeLocalEvent<GridAtmosphereComponent, ComponentInit>(OnGridAtmosphereInit);
|
||||
SubscribeLocalEvent<GridAtmosphereComponent, GridSplitEvent>(OnGridSplit);
|
||||
}
|
||||
|
||||
private void OnGridAtmosphereInit(EntityUid uid, GridAtmosphereComponent gridAtmosphere, ComponentInit args)
|
||||
@@ -61,56 +60,6 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
GridRepopulateTiles(mapGrid.Grid, gridAtmosphere);
|
||||
}
|
||||
|
||||
private void OnGridSplit(EntityUid uid, GridAtmosphereComponent originalGridAtmos, ref GridSplitEvent args)
|
||||
{
|
||||
foreach (var newGrid in args.NewGrids)
|
||||
{
|
||||
// Make extra sure this is a valid grid.
|
||||
if (!_mapManager.TryGetGrid(newGrid, out var mapGrid))
|
||||
continue;
|
||||
|
||||
var entity = mapGrid.GridEntityId;
|
||||
|
||||
// If the new split grid has an atmosphere already somehow, use that. Otherwise, add a new one.
|
||||
if (!TryComp(entity, out GridAtmosphereComponent? newGridAtmos))
|
||||
newGridAtmos = AddComp<GridAtmosphereComponent>(entity);
|
||||
|
||||
// We assume the tiles on the new grid have the same coordinates as they did on the old grid...
|
||||
var enumerator = mapGrid.GetAllTilesEnumerator();
|
||||
|
||||
while (enumerator.MoveNext(out var tile))
|
||||
{
|
||||
var indices = tile.Value.GridIndices;
|
||||
|
||||
// This split event happens *before* the spaced tiles have been invalidated, therefore we can still
|
||||
// access their gas data. On the next atmos update tick, these tiles will be spaced. Poof!
|
||||
if (!originalGridAtmos.Tiles.TryGetValue(indices, out var tileAtmosphere))
|
||||
continue;
|
||||
|
||||
// The new grid atmosphere has been initialized, meaning it has all the needed TileAtmospheres...
|
||||
if (!newGridAtmos.Tiles.TryGetValue(indices, out var newTileAtmosphere))
|
||||
// Let's be honest, this is really not gonna happen, but just in case...!
|
||||
continue;
|
||||
|
||||
// Copy a bunch of data over... Not great, maybe put this in TileAtmosphere?
|
||||
newTileAtmosphere.Air = tileAtmosphere.Air?.Clone() ?? null;
|
||||
newTileAtmosphere.Hotspot = tileAtmosphere.Hotspot;
|
||||
newTileAtmosphere.HeatCapacity = tileAtmosphere.HeatCapacity;
|
||||
newTileAtmosphere.Temperature = tileAtmosphere.Temperature;
|
||||
newTileAtmosphere.PressureDifference = tileAtmosphere.PressureDifference;
|
||||
newTileAtmosphere.PressureDirection = tileAtmosphere.PressureDirection;
|
||||
|
||||
// TODO ATMOS: Somehow force GasTileOverlaySystem to perform an update *right now, right here.*
|
||||
// The reason why is that right now, gas will flicker until the next GasTileOverlay update.
|
||||
// That looks bad, of course. We want to avoid that! Anyway that's a bit more complicated so out of scope.
|
||||
|
||||
// Invalidate the tile, it's redundant but redundancy is good! Also HashSet so really, no duplicates.
|
||||
InvalidateTile(originalGridAtmos, indices);
|
||||
InvalidateTile(newGridAtmos, indices);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Grid Is Simulated
|
||||
|
||||
/// <summary>
|
||||
@@ -268,11 +217,10 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
private AtmosDirection GetBlockedDirections(IMapGrid mapGrid, Vector2i indices)
|
||||
{
|
||||
var value = AtmosDirection.Invalid;
|
||||
var enumerator = GetObstructingComponentsEnumerator(mapGrid, indices);
|
||||
|
||||
while (enumerator.MoveNext(out var airtightComponent))
|
||||
foreach (var airtightComponent in GetObstructingComponents(mapGrid, indices))
|
||||
{
|
||||
if (airtightComponent.AirBlocked)
|
||||
if(airtightComponent.AirBlocked)
|
||||
value |= airtightComponent.AirBlockedDirection;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Content.Server.Atmos.EntitySystems;
|
||||
/// </summary>
|
||||
public sealed class AutomaticAtmosSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -19,6 +20,7 @@ public sealed class AutomaticAtmosSystem : EntitySystem
|
||||
SubscribeLocalEvent<TileChangedEvent>(OnTileChanged);
|
||||
}
|
||||
|
||||
|
||||
private void OnTileChanged(TileChangedEvent ev)
|
||||
{
|
||||
// Only if a atmos-holding tile has been added or removed.
|
||||
@@ -26,18 +28,18 @@ public sealed class AutomaticAtmosSystem : EntitySystem
|
||||
// TODO: Make tiledefmanager cache the IsSpace property, and turn this lookup-through-two-interfaces into
|
||||
// TODO: a simple array lookup, as tile IDs are likely contiguous, and there's at most 2^16 possibilities anyway.
|
||||
if (!((ev.OldTile.IsSpace(_tileDefinitionManager) && !ev.NewTile.IsSpace(_tileDefinitionManager)) ||
|
||||
(!ev.OldTile.IsSpace(_tileDefinitionManager) && ev.NewTile.IsSpace(_tileDefinitionManager))) ||
|
||||
HasComp<IAtmosphereComponent>(ev.Entity))
|
||||
(!ev.OldTile.IsSpace(_tileDefinitionManager) && ev.NewTile.IsSpace(_tileDefinitionManager))))
|
||||
return;
|
||||
|
||||
if (!TryComp<PhysicsComponent>(ev.Entity, out var physics))
|
||||
var uid = _mapManager.GetGridEuid(ev.NewTile.GridIndex);
|
||||
if (!TryComp<PhysicsComponent>(uid, out var physics))
|
||||
return;
|
||||
|
||||
// We can't actually count how many tiles there are efficiently, so instead estimate with the mass.
|
||||
if (physics.Mass / ShuttleSystem.TileMassMultiplier >= 7.0f)
|
||||
if (physics.Mass / ShuttleSystem.TileMassMultiplier >= 7.0f && !HasComp<IAtmosphereComponent>(uid))
|
||||
{
|
||||
AddComp<GridAtmosphereComponent>(ev.Entity);
|
||||
Logger.InfoS("atmos", $"Giving grid {ev.Entity} GridAtmosphereComponent.");
|
||||
AddComp<GridAtmosphereComponent>(uid);
|
||||
Logger.InfoS("atmos", $"Giving grid {uid} GridAtmosphereComponent.");
|
||||
}
|
||||
// It's not super important to remove it should the grid become too small again.
|
||||
// If explosions ever gain the ability to outright shatter grids, do rethink this.
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Server.Atmos
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public sealed class GasMixture : IEquatable<GasMixture>, ISerializationHooks
|
||||
public sealed class GasMixture : IEquatable<GasMixture>, ICloneable, ISerializationHooks
|
||||
{
|
||||
public static GasMixture SpaceGas => new() {Volume = Atmospherics.CellVolume, Temperature = Atmospherics.TCMB, Immutable = true};
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace Content.Server.Atmos
|
||||
return hashCode.ToHashCode();
|
||||
}
|
||||
|
||||
public GasMixture Clone()
|
||||
public object Clone()
|
||||
{
|
||||
var newMixture = new GasMixture()
|
||||
{
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
||||
|
||||
SubscribeLocalEvent<AtmosDeviceComponent, ComponentInit>(OnDeviceInitialize);
|
||||
SubscribeLocalEvent<AtmosDeviceComponent, ComponentShutdown>(OnDeviceShutdown);
|
||||
// Re-anchoring should be handled by the parent change.
|
||||
SubscribeLocalEvent<AtmosDeviceComponent, EntParentChangedMessage>(OnDeviceParentChanged);
|
||||
SubscribeLocalEvent<AtmosDeviceComponent, AnchorStateChangedEvent>(OnDeviceAnchorChanged);
|
||||
}
|
||||
@@ -105,7 +104,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
||||
if (!component.RequireAnchored)
|
||||
return;
|
||||
|
||||
if (args.Anchored)
|
||||
if(EntityManager.GetComponent<TransformComponent>(component.Owner).Anchored)
|
||||
JoinAtmosphere(component);
|
||||
else
|
||||
LeaveAtmosphere(component);
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
SubscribeLocalEvent<GasMixerComponent, GasMixerChangeNodePercentageMessage>(OnChangeNodePercentageMessage);
|
||||
SubscribeLocalEvent<GasMixerComponent, GasMixerToggleStatusMessage>(OnToggleStatusMessage);
|
||||
|
||||
// Shouldn't need re-anchor event
|
||||
SubscribeLocalEvent<GasMixerComponent, AnchorStateChangedEvent>(OnAnchorChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<GasPortableComponent, AnchorAttemptEvent>(OnPortableAnchorAttempt);
|
||||
// Shouldn't need re-anchored event.
|
||||
SubscribeLocalEvent<GasPortableComponent, AnchorStateChangedEvent>(OnAnchorChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Content.Server.Atmos
|
||||
/// Internal Atmos class that stores data about the atmosphere in a grid.
|
||||
/// You shouldn't use this directly, use <see cref="AtmosphereSystem"/> instead.
|
||||
/// </summary>
|
||||
[Friend(typeof(AtmosphereSystem))]
|
||||
public sealed class TileAtmosphere : IGasMixtureHolder
|
||||
{
|
||||
[ViewVariables]
|
||||
|
||||
Reference in New Issue
Block a user