Nullable grid Uid (#8798)

This commit is contained in:
Leon Friedrich
2022-06-20 12:14:35 +12:00
committed by GitHub
parent ef41cd5aa8
commit fa4c6f63f8
82 changed files with 318 additions and 242 deletions

View File

@@ -30,7 +30,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
return;
// If we can't find any ports, cancel the anchoring.
if(!FindGasPortIn(transform.GridEntityId, transform.Coordinates, out _))
if(!FindGasPortIn(transform.GridUid, transform.Coordinates, out _))
args.Cancel();
}
@@ -50,15 +50,13 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
}
}
private bool FindGasPortIn(EntityUid gridId, EntityCoordinates coordinates, [NotNullWhen(true)] out GasPortComponent? port)
private bool FindGasPortIn(EntityUid? gridId, EntityCoordinates coordinates, [NotNullWhen(true)] out GasPortComponent? port)
{
port = null;
if (!gridId.IsValid())
if (!_mapManager.TryGetGrid(gridId, out var grid))
return false;
var grid = _mapManager.GetGrid(gridId);
foreach (var entityUid in grid.GetLocal(coordinates))
{
if (EntityManager.TryGetComponent<GasPortComponent>(entityUid, out port))