Add atmos ignition logs (#14216)

This commit is contained in:
Chief-Engineer
2023-02-28 14:43:24 -06:00
committed by GitHub
parent 51796db42a
commit 017fb28ce3
10 changed files with 20 additions and 15 deletions

View File

@@ -55,7 +55,7 @@ public sealed class PyroclasticAnomalySystem : EntitySystem
mix.AdjustMoles(component.SupercriticalGas, component.SupercriticalMoleAmount); mix.AdjustMoles(component.SupercriticalGas, component.SupercriticalMoleAmount);
mix.Temperature += component.HotspotExposeTemperature; mix.Temperature += component.HotspotExposeTemperature;
_atmosphere.HotspotExpose(grid.Value, indices, component.HotspotExposeTemperature, mix.Volume, true); _atmosphere.HotspotExpose(grid.Value, indices, component.HotspotExposeTemperature, mix.Volume, uid, true);
} }
} }
IgniteNearby(xform.Coordinates, 1, component.MaximumIgnitionRadius * 2); IgniteNearby(xform.Coordinates, 1, component.MaximumIgnitionRadius * 2);
@@ -80,7 +80,7 @@ public sealed class PyroclasticAnomalySystem : EntitySystem
if (grid != null && anom.Severity > pyro.AnomalyHotspotThreshold) if (grid != null && anom.Severity > pyro.AnomalyHotspotThreshold)
{ {
_atmosphere.HotspotExpose(grid.Value, indices, pyro.HotspotExposeTemperature, pyro.HotspotExposeVolume, true); _atmosphere.HotspotExpose(grid.Value, indices, pyro.HotspotExposeTemperature, pyro.HotspotExposeVolume, ent, true);
} }
} }
} }

View File

@@ -216,9 +216,10 @@ public partial class AtmosphereSystem
RaiseLocalEvent(gridUid, ref ev); RaiseLocalEvent(gridUid, ref ev);
} }
public void HotspotExpose(EntityUid gridUid, Vector2i tile, float exposedTemperature, float exposedVolume, bool soh = false) public void HotspotExpose(EntityUid gridUid, Vector2i tile, float exposedTemperature, float exposedVolume,
EntityUid? sparkSourceUid = null, bool soh = false)
{ {
var ev = new HotspotExposeMethodEvent(gridUid, tile, exposedTemperature, exposedVolume, soh); var ev = new HotspotExposeMethodEvent(gridUid, sparkSourceUid, tile, exposedTemperature, exposedVolume, soh);
RaiseLocalEvent(gridUid, ref ev); RaiseLocalEvent(gridUid, ref ev);
} }
@@ -300,7 +301,7 @@ public partial class AtmosphereSystem
[ByRefEvent] private record struct IsTileAirBlockedMethodEvent [ByRefEvent] private record struct IsTileAirBlockedMethodEvent
(EntityUid Grid, Vector2i Tile, AtmosDirection Direction = AtmosDirection.All, MapGridComponent? MapGridComponent = null, bool Result = false, bool Handled = false) (EntityUid Grid, Vector2i Tile, AtmosDirection Direction = AtmosDirection.All, MapGridComponent? MapGridComponent = null, bool Result = false, bool Handled = false)
{ {
/// <summary> /// <summary>
/// True if one of the enabled blockers has <see cref="AirtightComponent.NoAirWhenFullyAirBlocked"/>. Note /// True if one of the enabled blockers has <see cref="AirtightComponent.NoAirWhenFullyAirBlocked"/>. Note
/// that this does not actually check if all directions are blocked. /// that this does not actually check if all directions are blocked.
/// </summary> /// </summary>
@@ -321,7 +322,7 @@ public partial class AtmosphereSystem
(EntityUid Grid, Vector2i Tile, MapGridComponent? MapGridComponent = null, bool Handled = false); (EntityUid Grid, Vector2i Tile, MapGridComponent? MapGridComponent = null, bool Handled = false);
[ByRefEvent] private record struct HotspotExposeMethodEvent [ByRefEvent] private record struct HotspotExposeMethodEvent
(EntityUid Grid, Vector2i Tile, float ExposedTemperature, float ExposedVolume, bool soh, bool Handled = false); (EntityUid Grid, EntityUid? SparkSourceUid, Vector2i Tile, float ExposedTemperature, float ExposedVolume, bool soh, bool Handled = false);
[ByRefEvent] private record struct HotspotExtinguishMethodEvent [ByRefEvent] private record struct HotspotExtinguishMethodEvent
(EntityUid Grid, Vector2i Tile, bool Handled = false); (EntityUid Grid, Vector2i Tile, bool Handled = false);

View File

@@ -405,7 +405,7 @@ public sealed partial class AtmosphereSystem
if (!component.Tiles.TryGetValue(args.Tile, out var tile)) if (!component.Tiles.TryGetValue(args.Tile, out var tile))
return; return;
HotspotExpose(component, tile, args.ExposedTemperature, args.ExposedVolume, args.soh); HotspotExpose(component, tile, args.ExposedTemperature, args.ExposedVolume, args.soh, args.SparkSourceUid);
args.Handled = true; args.Handled = true;
} }

View File

@@ -2,6 +2,7 @@ using Content.Server.Atmos.Components;
using Content.Server.Atmos.Reactions; using Content.Server.Atmos.Reactions;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.Audio; using Content.Shared.Audio;
using Content.Shared.Database;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -94,7 +95,8 @@ namespace Content.Server.Atmos.EntitySystems
// TODO ATMOS Maybe destroy location here? // TODO ATMOS Maybe destroy location here?
} }
private void HotspotExpose(GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, float exposedTemperature, float exposedVolume, bool soh = false) private void HotspotExpose(GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile,
float exposedTemperature, float exposedVolume, bool soh = false, EntityUid? sparkSourceUid = null)
{ {
if (tile.Air == null) if (tile.Air == null)
return; return;
@@ -125,6 +127,9 @@ namespace Content.Server.Atmos.EntitySystems
if ((exposedTemperature > Atmospherics.PlasmaMinimumBurnTemperature) && (plasma > 0.5f || tritium > 0.5f)) if ((exposedTemperature > Atmospherics.PlasmaMinimumBurnTemperature) && (plasma > 0.5f || tritium > 0.5f))
{ {
if (sparkSourceUid.HasValue)
_adminLog.Add(LogType.Flammable, LogImpact.High, $"Heat/spark of {ToPrettyString(sparkSourceUid.Value)} caused atmos ignition of gas: {tile.Air.Temperature.ToString():temperature}K - {oxygen}mol Oxygen, {plasma}mol Plasma, {tritium}mol Tritium");
tile.Hotspot = new Hotspot tile.Hotspot = new Hotspot
{ {
Volume = exposedVolume * 25f, Volume = exposedVolume * 25f,
@@ -134,7 +139,6 @@ namespace Content.Server.Atmos.EntitySystems
State = 1 State = 1
}; };
AddActiveTile(gridAtmosphere, tile); AddActiveTile(gridAtmosphere, tile);
gridAtmosphere.HotspotTiles.Add(tile); gridAtmosphere.HotspotTiles.Add(tile);
} }

View File

@@ -321,7 +321,7 @@ namespace Content.Server.Atmos.EntitySystems
{ {
_atmosphereSystem.HotspotExpose(transform.GridUid.Value, _atmosphereSystem.HotspotExpose(transform.GridUid.Value,
_transformSystem.GetGridOrMapTilePosition(uid, transform), _transformSystem.GetGridOrMapTilePosition(uid, transform),
700f, 50f, true); 700f, 50f, uid, true);
} }

View File

@@ -45,7 +45,7 @@ public sealed class IgnitionSourceSystem : EntitySystem
if (transform.GridUid is { } gridUid) if (transform.GridUid is { } gridUid)
{ {
var position = _transformSystem.GetGridOrMapTilePosition(source, transform); var position = _transformSystem.GetGridOrMapTilePosition(source, transform);
_atmosphereSystem.HotspotExpose(gridUid, position, component.Temperature, 50, true); _atmosphereSystem.HotspotExpose(gridUid, position, component.Temperature, 50, source, true);
} }
} }

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Light.EntitySystems
var position = _transformSystem.GetGridOrMapTilePosition(match.Owner, xform); var position = _transformSystem.GetGridOrMapTilePosition(match.Owner, xform);
_atmosphereSystem.HotspotExpose(gridUid, position, 400, 50, true); _atmosphereSystem.HotspotExpose(gridUid, position, 400, 50, match.Owner, true);
} }
} }

View File

@@ -112,7 +112,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (transform.GridUid is {} gridUid) if (transform.GridUid is {} gridUid)
{ {
var position = _transformSystem.GetGridOrMapTilePosition(uid, transform); var position = _transformSystem.GetGridOrMapTilePosition(uid, transform);
_atmos.HotspotExpose(gridUid, position, smokable.ExposeTemperature, smokable.ExposeVolume, true); _atmos.HotspotExpose(gridUid, position, smokable.ExposeTemperature, smokable.ExposeVolume, uid, true);
} }
} }

View File

@@ -139,7 +139,7 @@ namespace Content.Server.StationEvents.Events
// Don't want it to be so obnoxious as to instantly murder anyone in the area but enough that // Don't want it to be so obnoxious as to instantly murder anyone in the area but enough that
// it COULD start potentially start a bigger fire. // it COULD start potentially start a bigger fire.
_atmosphere.HotspotExpose(_targetGrid, _targetTile, 700f, 50f, true); _atmosphere.HotspotExpose(_targetGrid, _targetTile, 700f, 50f, null, true);
SoundSystem.Play("/Audio/Effects/sparks4.ogg", Filter.Pvs(_targetCoords), _targetCoords); SoundSystem.Play("/Audio/Effects/sparks4.ogg", Filter.Pvs(_targetCoords), _targetCoords);
} }
} }

View File

@@ -132,7 +132,7 @@ namespace Content.Server.Tools
if (transform.GridUid is {} gridUid) if (transform.GridUid is {} gridUid)
{ {
var position = _transformSystem.GetGridOrMapTilePosition(uid, transform); var position = _transformSystem.GetGridOrMapTilePosition(uid, transform);
_atmosphereSystem.HotspotExpose(gridUid, position, 700, 50, true); _atmosphereSystem.HotspotExpose(gridUid, position, 700, 50, uid, true);
} }
_entityManager.Dirty(welder); _entityManager.Dirty(welder);