From 0884bcf7eca961f48fa19edd59cb38b9e3f9d9a0 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Sun, 28 Mar 2021 14:28:04 +0200 Subject: [PATCH] Fixes bug where the PlasmaFire reaction wouldn't reset reaction results properly. This would cause the hotspot volume to grow more and more until the hotspot bypasses processing and therefore doesn't spread anymore. --- .../Atmos/Reactions/PlasmaFireReaction.cs | 1 + Content.Server/Atmos/TileAtmosphere.cs | 99 ++++++++++--------- Resources/Changelog/Parts/plasmafire.yml | 4 + 3 files changed, 57 insertions(+), 47 deletions(-) create mode 100644 Resources/Changelog/Parts/plasmafire.yml diff --git a/Content.Server/Atmos/Reactions/PlasmaFireReaction.cs b/Content.Server/Atmos/Reactions/PlasmaFireReaction.cs index 8dde9eb74a..035625def7 100644 --- a/Content.Server/Atmos/Reactions/PlasmaFireReaction.cs +++ b/Content.Server/Atmos/Reactions/PlasmaFireReaction.cs @@ -19,6 +19,7 @@ namespace Content.Server.Atmos.Reactions var oldHeatCapacity = mixture.HeatCapacity; var temperature = mixture.Temperature; var location = holder as TileAtmosphere; + mixture.ReactionResults[GasReaction.Fire] = 0; // More plasma released at higher temperatures var temperatureScale = 0f; diff --git a/Content.Server/Atmos/TileAtmosphere.cs b/Content.Server/Atmos/TileAtmosphere.cs index 6cb166a8d7..f65321bd99 100644 --- a/Content.Server/Atmos/TileAtmosphere.cs +++ b/Content.Server/Atmos/TileAtmosphere.cs @@ -139,51 +139,6 @@ namespace Content.Server.Atmos _temperatureArchived = Temperature; } - public void HotspotExpose(float exposedTemperature, float exposedVolume, bool soh = false) - { - if (Air == null) - return; - - var oxygen = Air.GetMoles(Gas.Oxygen); - - if (oxygen < 0.5f) - return; - - var plasma = Air.GetMoles(Gas.Plasma); - var tritium = Air.GetMoles(Gas.Tritium); - - if (Hotspot.Valid) - { - if (soh) - { - if (plasma > 0.5f || tritium > 0.5f) - { - if (Hotspot.Temperature < exposedTemperature) - Hotspot.Temperature = exposedTemperature; - if (Hotspot.Volume < exposedVolume) - Hotspot.Volume = exposedVolume; - } - } - - return; - } - - if ((exposedTemperature > Atmospherics.PlasmaMinimumBurnTemperature) && (plasma > 0.5f || tritium > 0.5f)) - { - Hotspot = new Hotspot - { - Volume = exposedVolume * 25f, - Temperature = exposedTemperature, - SkippedFirstProcess = _currentCycle > _gridAtmosphereComponent.UpdateCounter - }; - - Hotspot.Start(); - - _gridAtmosphereComponent.AddActiveTile(this); - _gridAtmosphereComponent.AddHotspotTile(this); - } - } - public void HighPressureMovements() { // TODO ATMOS finish this @@ -744,6 +699,11 @@ namespace Content.Server.Atmos return; } + if (!Excited) + { + _gridAtmosphereComponent.AddActiveTile(this); + } + if (!Hotspot.SkippedFirstProcess) { Hotspot.SkippedFirstProcess = true; @@ -779,7 +739,7 @@ namespace Content.Server.Atmos } else { - Hotspot.State = (byte) (Hotspot.Volume > Atmospherics.CellVolume * 0.4f ? 2 : 1); + Hotspot.State = Hotspot.Volume > Atmospherics.CellVolume * 0.4f ? 2 : 1; } if (Hotspot.Temperature > MaxFireTemperatureSustained) @@ -794,7 +754,7 @@ namespace Content.Server.Atmos { if (Air == null || !Hotspot.Valid) return; - Hotspot.Bypassing = Hotspot.SkippedFirstProcess && (Hotspot.Volume > Atmospherics.CellVolume*0.95); + Hotspot.Bypassing = Hotspot.SkippedFirstProcess && Hotspot.Volume > Air.Volume*0.95f; if (Hotspot.Bypassing) { @@ -823,6 +783,51 @@ namespace Content.Server.Atmos } } + public void HotspotExpose(float exposedTemperature, float exposedVolume, bool soh = false) + { + if (Air == null) + return; + + var oxygen = Air.GetMoles(Gas.Oxygen); + + if (oxygen < 0.5f) + return; + + var plasma = Air.GetMoles(Gas.Plasma); + var tritium = Air.GetMoles(Gas.Tritium); + + if (Hotspot.Valid) + { + if (soh) + { + if (plasma > 0.5f || tritium > 0.5f) + { + if (Hotspot.Temperature < exposedTemperature) + Hotspot.Temperature = exposedTemperature; + if (Hotspot.Volume < exposedVolume) + Hotspot.Volume = exposedVolume; + } + } + + return; + } + + if ((exposedTemperature > Atmospherics.PlasmaMinimumBurnTemperature) && (plasma > 0.5f || tritium > 0.5f)) + { + Hotspot = new Hotspot + { + Volume = exposedVolume * 25f, + Temperature = exposedTemperature, + SkippedFirstProcess = _currentCycle > _gridAtmosphereComponent.UpdateCounter + }; + + Hotspot.Start(); + + _gridAtmosphereComponent.AddActiveTile(this); + _gridAtmosphereComponent.AddHotspotTile(this); + } + } + private bool ConsiderSuperconductivity() { if (ThermalConductivity == 0f) diff --git a/Resources/Changelog/Parts/plasmafire.yml b/Resources/Changelog/Parts/plasmafire.yml new file mode 100644 index 0000000000..890e9bfe27 --- /dev/null +++ b/Resources/Changelog/Parts/plasmafire.yml @@ -0,0 +1,4 @@ +author: Zumorica +changes: + - type: Fix + message: Fixes bug where plasma fires wouldn't spread properly under certain conditions.