Files
tbd-station-14/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosphereSystem.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

44 lines
1.7 KiB
C#

using System.Collections.Generic;
using Content.Shared.Atmos;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Shared.GameObjects.EntitySystems.Atmos
{
public class SharedAtmosphereSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
protected readonly GasPrototype[] GasPrototypes = new GasPrototype[Atmospherics.TotalNumberOfGases];
private readonly SpriteSpecifier[] _gasOverlays = new SpriteSpecifier[Atmospherics.TotalNumberOfGases];
public override void Initialize()
{
base.Initialize();
for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
{
var gasPrototype = _prototypeManager.Index<GasPrototype>(i.ToString());
GasPrototypes[i] = gasPrototype;
if(string.IsNullOrEmpty(gasPrototype.GasOverlaySprite) && !string.IsNullOrEmpty(gasPrototype.GasOverlayTexture))
_gasOverlays[i] = new SpriteSpecifier.Texture(new ResourcePath(gasPrototype.GasOverlayTexture));
if(!string.IsNullOrEmpty(gasPrototype.GasOverlaySprite) && !string.IsNullOrEmpty(gasPrototype.GasOverlayState))
_gasOverlays[i] = new SpriteSpecifier.Rsi(new ResourcePath(gasPrototype.GasOverlaySprite), gasPrototype.GasOverlayState);
}
}
public GasPrototype GetGas(int gasId) => GasPrototypes[gasId];
public GasPrototype GetGas(Gas gasId) => GasPrototypes[(int) gasId];
public IEnumerable<GasPrototype> Gases => GasPrototypes;
public SpriteSpecifier GetOverlay(int overlayId) => _gasOverlays[overlayId];
}
}