Atmos optimizations (#1944)

* Adds IFireAct, ITemperatureExpose

* Use AtmosDirection instead of Direction for Atmos

* Refactor atmos to heavily rely on arrays and bitflags.
Adds F A S T M O S and reduces atmos tech debt heavily.

* Optimize and fix more stuff

* Kinda improve superconduction

* Pipenet is a word

* T U R B O M O S

* Address reviews

* Small optimization

* Superconduct is also a word

* Remove check

* Cleanup tile atmosphere

* Correct a comment
This commit is contained in:
Víctor Aguilera Puerto
2020-08-28 14:32:56 +02:00
committed by GitHub
parent 3758eb1b60
commit fb0ac3d70e
16 changed files with 619 additions and 275 deletions

View File

@@ -1,25 +1,50 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.Atmos;
using Content.Server.Atmos.Reactions;
using Content.Server.Interfaces;
using Content.Shared.GameObjects.EntitySystems.Atmos;
using JetBrains.Annotations;
using Robust.Server.Interfaces.Timing;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Map;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Server.GameObjects.EntitySystems
{
[UsedImplicitly]
public class AtmosphereSystem : SharedAtmosphereSystem
{
[Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPauseManager _pauseManager = default!;
[Dependency] private IEntityManager _entityManager = default!;
private GasReactionPrototype[] _gasReactions = Array.Empty<GasReactionPrototype>();
/// <summary>
/// List of gas reactions ordered by priority.
/// </summary>
public IEnumerable<GasReactionPrototype> GasReactions => _gasReactions!;
/// <summary>
/// EventBus reference for gas reactions.
/// </summary>
public IEventBus EventBus => _entityManager.EventBus;
public override void Initialize()
{
base.Initialize();
_gasReactions = _protoMan.EnumeratePrototypes<GasReactionPrototype>().ToArray();
Array.Sort(_gasReactions, (a, b) => b.Priority.CompareTo(a.Priority));
_mapManager.TileChanged += OnTileChanged;
}