ECS Atmos Part 5: Moves all logic from GridAtmosphereComponent to AtmosphereSystem. (#4331)

This commit is contained in:
Vera Aguilera Puerto
2021-07-23 11:09:01 +02:00
committed by GitHub
parent 354ef6daf3
commit 4112847142
23 changed files with 1242 additions and 1355 deletions

View File

@@ -4,8 +4,8 @@ using Content.Server.Atmos.Components;
using Content.Server.Atmos.Reactions;
using Content.Server.Coordinates.Helpers;
using Content.Shared.Atmos;
using Content.Shared.GameTicking;
using Content.Shared.Maps;
using Robust.Shared.Map;
namespace Content.Server.Atmos.EntitySystems
{
@@ -15,13 +15,13 @@ namespace Content.Server.Atmos.EntitySystems
{
if (!tile.Hotspot.Valid)
{
gridAtmosphere.RemoveHotspotTile(tile);
gridAtmosphere.HotspotTiles.Remove(tile);
return;
}
if (!tile.Excited)
{
gridAtmosphere.AddActiveTile(tile);
AddActiveTile(gridAtmosphere, tile);
}
if (!tile.Hotspot.SkippedFirstProcess)
@@ -30,13 +30,14 @@ namespace Content.Server.Atmos.EntitySystems
return;
}
tile.ExcitedGroup?.ResetCooldowns();
if(tile.ExcitedGroup != null)
ExcitedGroupResetCooldowns(tile.ExcitedGroup);
if ((tile.Hotspot.Temperature < Atmospherics.FireMinimumTemperatureToExist) || (tile.Hotspot.Volume <= 1f)
|| tile.Air == null || tile.Air.GetMoles(Gas.Oxygen) < 0.5f || (tile.Air.GetMoles(Gas.Plasma) < 0.5f && tile.Air.GetMoles(Gas.Tritium) < 0.5f))
{
tile.Hotspot = new Hotspot();
tile.UpdateVisuals();
InvalidateVisuals(tile.GridIndex, tile.GridIndices);
return;
}
@@ -45,13 +46,17 @@ namespace Content.Server.Atmos.EntitySystems
if (tile.Hotspot.Bypassing)
{
tile.Hotspot.State = 3;
gridAtmosphere.BurnTile(tile.GridIndices);
// TODO ATMOS: Burn tile here
if (tile.Air.Temperature > Atmospherics.FireMinimumTemperatureToSpread)
{
var radiatedTemperature = tile.Air.Temperature * Atmospherics.FireSpreadRadiosityScale;
foreach (var otherTile in tile.AdjacentTiles)
{
// TODO ATMOS: This is sus. Suss this out.
if (otherTile == null)
continue;
if(!otherTile.Hotspot.Valid)
HotspotExpose(gridAtmosphere, otherTile, radiatedTemperature, Atmospherics.CellVolume/4);
}
@@ -108,8 +113,8 @@ namespace Content.Server.Atmos.EntitySystems
tile.Hotspot.Start();
gridAtmosphere.AddActiveTile(tile);
gridAtmosphere.AddHotspotTile(tile);
AddActiveTile(gridAtmosphere, tile);
gridAtmosphere.HotspotTiles.Add(tile);
}
}
@@ -128,11 +133,11 @@ namespace Content.Server.Atmos.EntitySystems
{
var affected = tile.Air.RemoveRatio(tile.Hotspot.Volume / tile.Air.Volume);
affected.Temperature = tile.Hotspot.Temperature;
gridAtmosphere.AtmosphereSystem.React(affected, tile);
React(affected, tile);
tile.Hotspot.Temperature = affected.Temperature;
tile.Hotspot.Volume = affected.ReactionResults[GasReaction.Fire] * Atmospherics.FireGrowthRate;
Merge(tile.Air, affected);
gridAtmosphere.Invalidate(tile.GridIndices);
gridAtmosphere.InvalidatedCoords.Add(tile.GridIndices);
}
var tileRef = tile.GridIndices.GetTileRef(tile.GridIndex);