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.
This commit is contained in:
Vera Aguilera Puerto
2021-03-28 14:28:04 +02:00
parent 610db55454
commit 0884bcf7ec
3 changed files with 57 additions and 47 deletions

View File

@@ -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;

View File

@@ -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)

View File

@@ -0,0 +1,4 @@
author: Zumorica
changes:
- type: Fix
message: Fixes bug where plasma fires wouldn't spread properly under certain conditions.