Files
tbd-station-14/Content.Shared/Atmos/AtmosCommandUtils.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

27 lines
728 B
C#

#nullable enable
using System;
namespace Content.Shared.Atmos
{
public class AtmosCommandUtils
{
/// <summary>
/// Gas ID parser for atmospherics commands.
/// This is so there's a central place for this logic for if the Gas enum gets removed.
/// </summary>
public static bool TryParseGasID(string str, out int x)
{
x = -1;
if (Enum.TryParse<Gas>(str, true, out var gas))
{
x = (int) gas;
}
else
{
if (!int.TryParse(str, out x))
return false;
}
return ((x >= 0) && (x < Atmospherics.TotalNumberOfGases));
}
}
}