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:
@@ -2,7 +2,6 @@ using Content.Server.Atmos.Components;
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Atmos.EntitySystems
|
||||
@@ -10,7 +9,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
[UsedImplicitly]
|
||||
public sealed class AirtightSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly ExplosionSystem _explosionSystem = default!;
|
||||
|
||||
@@ -121,19 +120,16 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!xform.Anchored || !TryComp(xform.GridUid, out MapGridComponent? grid))
|
||||
return;
|
||||
|
||||
airtight.LastPosition = (xform.GridUid.Value, grid.TileIndicesFor(xform.Coordinates));
|
||||
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum && !airtight.AirBlocked);
|
||||
var indices = _transform.GetGridTilePositionOrDefault((ent, xform), grid);
|
||||
airtight.LastPosition = (xform.GridUid.Value, indices);
|
||||
InvalidatePosition((xform.GridUid.Value, grid), indices);
|
||||
}
|
||||
|
||||
public void InvalidatePosition(EntityUid gridId, Vector2i pos, bool fixVacuum = false)
|
||||
public void InvalidatePosition(Entity<MapGridComponent?> grid, Vector2i pos)
|
||||
{
|
||||
if (!TryComp(gridId, out MapGridComponent? grid))
|
||||
return;
|
||||
|
||||
var query = EntityManager.GetEntityQuery<AirtightComponent>();
|
||||
_explosionSystem.UpdateAirtightMap(gridId, pos, grid, query);
|
||||
// TODO make atmos system use query
|
||||
_atmosphereSystem.InvalidateTile(gridId, pos);
|
||||
_explosionSystem.UpdateAirtightMap(grid, pos, grid, query);
|
||||
_atmosphereSystem.InvalidateTile(grid.Owner, pos);
|
||||
}
|
||||
|
||||
private AtmosDirection Rotate(AtmosDirection myDirection, Angle myAngle)
|
||||
|
||||
Reference in New Issue
Block a user