Remove Explicit GridId References (#8315)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Acruid
2022-06-11 18:54:41 -07:00
committed by GitHub
parent 846321cebb
commit 4f9be42f40
131 changed files with 531 additions and 588 deletions

View File

@@ -1,8 +1,7 @@
using Content.Server.Administration;
using Content.Server.Administration;
using Content.Server.Atmos.Components;
using Content.Shared.Administration;
using Robust.Shared.Console;
using Robust.Shared.Map;
namespace Content.Server.Atmos.Commands
{
@@ -21,39 +20,29 @@ namespace Content.Server.Atmos.Commands
return;
}
if (!int.TryParse(args[0], out var id))
{
shell.WriteLine($"{args[0]} is not a valid integer.");
return;
}
var gridId = new GridId(id);
var mapMan = IoCManager.Resolve<IMapManager>();
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
{
shell.WriteLine($"{gridId} is not a valid grid id.");
return;
}
var entMan = IoCManager.Resolve<IEntityManager>();
if (!entMan.EntityExists(gridComp.GridEntityId))
if (EntityUid.TryParse(args[0], out var euid))
{
shell.WriteLine("Failed to get grid entity.");
shell.WriteError($"Failed to parse euid '{args[0]}'.");
return;
}
if (entMan.HasComponent<IAtmosphereComponent>(gridComp.GridEntityId))
if (!entMan.HasComponent<IMapGridComponent>(euid))
{
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return;
}
if (entMan.HasComponent<IAtmosphereComponent>(euid))
{
shell.WriteLine("Grid already has an atmosphere.");
return;
}
entMan.AddComponent<UnsimulatedGridAtmosphereComponent>(gridComp.GridEntityId);
entMan.AddComponent<UnsimulatedGridAtmosphereComponent>(euid);
shell.WriteLine($"Added unsimulated atmosphere to grid {id}.");
shell.WriteLine($"Added unsimulated atmosphere to grid {euid}.");
}
}