Log explosive depressurization. (#5474)
This commit is contained in:
committed by
GitHub
parent
8c6125752b
commit
af86378995
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -16,6 +17,11 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Threshold for logging explosive depressurization.
|
||||
/// </summary>
|
||||
private const float DepressurizationLogThreshold = Atmospherics.MolesCellStandard * 10;
|
||||
|
||||
private readonly TileAtmosphereComparer _monstermosComparer = new();
|
||||
|
||||
private readonly TileAtmosphere?[] _equalizeTiles = new TileAtmosphere[Atmospherics.MonstermosHardTileLimit];
|
||||
@@ -360,7 +366,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
const int limit = Atmospherics.MonstermosHardTileLimit;
|
||||
|
||||
var totalGasesRemoved = 0f;
|
||||
var totalMolesRemoved = 0f;
|
||||
var queueCycle = ++gridAtmosphere.EqualizationQueueCycleControl;
|
||||
|
||||
var tileCount = 0;
|
||||
@@ -447,7 +453,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
var otherTile2 = otherTile.AdjacentTiles[otherTile.MonstermosInfo.CurrentTransferDirection.ToIndex()];
|
||||
if (otherTile2?.Air == null) continue;
|
||||
var sum = otherTile2.Air.TotalMoles;
|
||||
totalGasesRemoved += sum;
|
||||
totalMolesRemoved += sum;
|
||||
otherTile.MonstermosInfo.CurrentTransferAmount += sum;
|
||||
otherTile2.MonstermosInfo.CurrentTransferAmount += otherTile.MonstermosInfo.CurrentTransferAmount;
|
||||
otherTile.PressureDifference = otherTile.MonstermosInfo.CurrentTransferAmount;
|
||||
@@ -471,10 +477,14 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
var gridPhysics = EntityManager.GetComponent<PhysicsComponent>(mapGrid.GridEntityId);
|
||||
|
||||
// TODO ATMOS: Come up with better values for these.
|
||||
gridPhysics.ApplyLinearImpulse(direction * totalGasesRemoved * gridPhysics.Mass);
|
||||
gridPhysics.ApplyAngularImpulse(Vector2.Cross(tile.GridIndices - gridPhysics.LocalCenter, direction) * totalGasesRemoved);
|
||||
gridPhysics.ApplyLinearImpulse(direction * totalMolesRemoved * gridPhysics.Mass);
|
||||
gridPhysics.ApplyAngularImpulse(Vector2.Cross(tile.GridIndices - gridPhysics.LocalCenter, direction) * totalMolesRemoved);
|
||||
}
|
||||
|
||||
if(totalMolesRemoved > DepressurizationLogThreshold)
|
||||
_adminLog.Add(LogType.ExplosiveDepressurization, LogImpact.High,
|
||||
$"Explosive depressurization removed {totalMolesRemoved} moles from {tileCount} tiles starting from position {tile.GridIndices:position} on grid ID {tile.GridIndex:grid}");
|
||||
|
||||
Array.Clear(_depressurizeTiles, 0, Atmospherics.MonstermosHardTileLimit);
|
||||
Array.Clear(_depressurizeSpaceTiles, 0, Atmospherics.MonstermosHardTileLimit);
|
||||
Array.Clear(_depressurizeProgressionOrder, 0, Atmospherics.MonstermosHardTileLimit * 2);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.Temperature.Components;
|
||||
@@ -18,6 +19,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
public partial class AtmosphereSystem : SharedAtmosphereSystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly AdminLogSystem _adminLog = default!;
|
||||
|
||||
private const float ExposedUpdateDelay = 1f;
|
||||
private float _exposedTimer = 0f;
|
||||
|
||||
@@ -15,6 +15,7 @@ public enum LogType
|
||||
Verb = 19,
|
||||
ShuttleCalled = 8,
|
||||
ShuttleRecalled = 9,
|
||||
ExplosiveDepressurization = 10,
|
||||
ChemicalReaction = 17,
|
||||
ReagentEffect = 18,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user