Firelock fixes (#12542)

* Firelock fixes

* review
This commit is contained in:
Leon Friedrich
2022-11-11 17:21:01 +13:00
committed by GitHub
parent 9415f1e0b3
commit 3a0c3b02b3
4 changed files with 17 additions and 12 deletions

View File

@@ -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)

View File

@@ -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);

View File

@@ -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();
}
}
}

View File

@@ -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<Vector2i> tiles = new(4);
List<AtmosDirection> 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);