diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.API.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.API.cs index b58ec491a7..cbef6b8ad9 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.API.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.API.cs @@ -107,8 +107,16 @@ public partial class AtmosphereSystem else RaiseLocalEvent(ref ev); + if (ev.Handled) + return ev.Mixtures; + // Default to a space mixture... This is a space game, after all! - return ev.Mixtures ?? new GasMixture?[tiles.Count]; + ev.Mixtures ??= new GasMixture?[tiles.Count]; + for (var i = 0; i < tiles.Count; i++) + { + ev.Mixtures[i] ??= GasMixture.SpaceGas; + } + return ev.Mixtures; } public GasMixture? GetTileMixture(EntityUid? gridUid, EntityUid? mapUid, Vector2i tile, bool excite = false) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.GridAtmosphere.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.GridAtmosphere.cs index a4748f18f5..c70c5630ab 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.GridAtmosphere.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.GridAtmosphere.cs @@ -192,7 +192,11 @@ public sealed partial class AtmosphereSystem { var tile = args.Tiles[i]; if (!component.Tiles.TryGetValue(tile, out var atmosTile)) + { + // need to get map atmosphere + args.Handled = false; continue; + } if (args.Excite) component.InvalidatedCoords.Add(tile); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Map.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Map.cs index ad5c39e965..ecb784c763 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Map.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Map.cs @@ -32,17 +32,14 @@ public partial class AtmosphereSystem private void MapGetTileMixtures(EntityUid uid, MapAtmosphereComponent component, ref GetTileMixturesMethodEvent args) { - if (args.Handled) + if (args.Handled || component.Mixture == null) return; args.Handled = true; - args.Mixtures = new GasMixture?[args.Tiles.Count]; - - if (component.Mixture == null) - return; + args.Mixtures ??= new GasMixture?[args.Tiles.Count]; for (var i = 0; i < args.Tiles.Count; i++) { - args.Mixtures[i] = component.Mixture.Clone(); + args.Mixtures[i] ??= component.Mixture.Clone(); } } } diff --git a/Content.Server/Doors/Systems/FirelockSystem.cs b/Content.Server/Doors/Systems/FirelockSystem.cs index 308d3ca90d..e1c2e2229b 100644 --- a/Content.Server/Doors/Systems/FirelockSystem.cs +++ b/Content.Server/Doors/Systems/FirelockSystem.cs @@ -249,10 +249,6 @@ namespace Content.Server.Doors.Systems // achieving all this using existing atmos functions, and the functionality is too specialized to bother // adding new public atmos system functions. - - // TODO redo this with planet/map atmospheres - // there is probably a faster way of doing this. tbh I kinda hate the atmos method events for making - // accessing tile data directly such a pain. Dealting with maps will make it even more painful. List tiles = new(4); List directions = new(4); for (var i = 0; i < Atmospherics.Directions; i++) @@ -270,7 +266,7 @@ namespace Content.Server.Doors.Systems if (airtight.AirBlockedDirection != AtmosDirection.All) tiles.Add(pos); - var gasses = _atmosSystem.GetTileMixtures(gridAtmosphere.Owner, null, tiles); + var gasses = _atmosSystem.GetTileMixtures(gridAtmosphere.Owner, xform.MapUid, tiles); if (gasses == null) return (false, false);