Partial atmos refactor (#22521)
* Reduce atmos component queries * Remove method events * Cache airtight data * Make MolesArchived nullable * Fix airtight cache * only get tile def once * Immutable mixtures * firelock queries * misc * misc cleanup * Trim disconnected tiles * Fix merge issues and bugs * Why does the PR keep increasing in scope * debug overlay * Fix bugs * Fix test, remove unused events * Add setmapatmos command * Fix overlays * Add map check * A * Resolve conflicts with #26102 * Remove some obsolete methods
This commit is contained in:
@@ -8,11 +8,6 @@ namespace Content.Shared.Atmos
|
||||
/// </summary>
|
||||
public static class Atmospherics
|
||||
{
|
||||
static Atmospherics()
|
||||
{
|
||||
AdjustedNumberOfGases = MathHelper.NextMultipleOf(TotalNumberOfGases, 4);
|
||||
}
|
||||
|
||||
#region ATMOS
|
||||
/// <summary>
|
||||
/// The universal gas constant, in kPa*L/(K*mol)
|
||||
@@ -183,7 +178,7 @@ namespace Content.Shared.Atmos
|
||||
/// This is the actual length of the gases arrays in mixtures.
|
||||
/// Set to the closest multiple of 4 relative to <see cref="TotalNumberOfGases"/> for SIMD reasons.
|
||||
/// </summary>
|
||||
public static readonly int AdjustedNumberOfGases;
|
||||
public const int AdjustedNumberOfGases = ((TotalNumberOfGases + 3) / 4) * 4;
|
||||
|
||||
/// <summary>
|
||||
/// Amount of heat released per mole of burnt hydrogen or tritium (hydrogen isotope)
|
||||
|
||||
@@ -66,7 +66,10 @@ namespace Content.Shared.Atmos.EntitySystems
|
||||
[Serializable, NetSerializable]
|
||||
public readonly struct GasOverlayData : IEquatable<GasOverlayData>
|
||||
{
|
||||
[ViewVariables]
|
||||
public readonly byte FireState;
|
||||
|
||||
[ViewVariables]
|
||||
public readonly byte[] Opacity;
|
||||
|
||||
// TODO change fire color based on temps
|
||||
|
||||
@@ -77,7 +77,11 @@ namespace Content.Shared.Maps
|
||||
[DataField("itemDrop", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string ItemDropPrototypeName { get; private set; } = "FloorTileItemSteel";
|
||||
|
||||
[DataField("isSpace")] public bool IsSpace { get; private set; }
|
||||
// TODO rename data-field in yaml
|
||||
/// <summary>
|
||||
/// Whether or not the tile is exposed to the map's atmosphere.
|
||||
/// </summary>
|
||||
[DataField("isSpace")] public bool MapAtmosphere { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Friction override for mob mover in <see cref="SharedMoverController"/>
|
||||
|
||||
@@ -12,22 +12,6 @@ namespace Content.Shared.Maps
|
||||
// That, or make the interface arguments non-optional so people stop failing to pass them in.
|
||||
public static class TurfHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Attempts to get the turf at map indices with grid id or null if no such turf is found.
|
||||
/// </summary>
|
||||
public static TileRef GetTileRef(this Vector2i vector2i, EntityUid gridId, IEntityManager? entityManager = null)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!entityManager.TryGetComponent<MapGridComponent>(gridId, out var grid))
|
||||
return default;
|
||||
|
||||
if (!grid.TryGetTileRef(vector2i, out var tile))
|
||||
return default;
|
||||
|
||||
return tile;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to get the turf at a certain coordinates or null if no such turf is found.
|
||||
/// </summary>
|
||||
@@ -68,7 +52,7 @@ namespace Content.Shared.Maps
|
||||
/// </summary>
|
||||
public static bool IsSpace(this Tile tile, ITileDefinitionManager? tileDefinitionManager = null)
|
||||
{
|
||||
return tile.GetContentTileDefinition(tileDefinitionManager).IsSpace;
|
||||
return tile.GetContentTileDefinition(tileDefinitionManager).MapAtmosphere;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -116,15 +100,6 @@ namespace Content.Shared.Maps
|
||||
return GetEntitiesInTile(turf.Value, flags, lookupSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper that returns all entities in a turf.
|
||||
/// </summary>
|
||||
[Obsolete("Use the lookup system")]
|
||||
public static IEnumerable<EntityUid> GetEntitiesInTile(this Vector2i indices, EntityUid gridId, LookupFlags flags = LookupFlags.Static, EntityLookupSystem? lookupSystem = null)
|
||||
{
|
||||
return GetEntitiesInTile(indices.GetTileRef(gridId), flags, lookupSystem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a turf has something dense on it.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user