Fix 3000 errors
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Window;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Construction;
|
||||
@@ -24,19 +23,19 @@ namespace Content.Server.Construction.Commands
|
||||
public void Execute(IConsoleShell shell, string argsOther, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
GridId gridId;
|
||||
|
||||
switch (args.Length)
|
||||
{
|
||||
case 0:
|
||||
if (player?.AttachedEntity == null)
|
||||
if (player?.AttachedEntity is not {Valid: true} playerEntity)
|
||||
{
|
||||
shell.WriteLine("Only a player can run this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.AttachedEntity).GridID;
|
||||
gridId = entityManager.GetComponent<TransformComponent>(playerEntity).GridID;
|
||||
break;
|
||||
case 1:
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
@@ -59,17 +58,16 @@ namespace Content.Server.Construction.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
||||
if (!entityManager.EntityExists(grid.GridEntityId))
|
||||
{
|
||||
shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
var changed = 0;
|
||||
foreach (var childUid in IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEntity).ChildEntityUids)
|
||||
foreach (var child in entityManager.GetComponent<TransformComponent>(grid.GridEntityId).ChildEntities)
|
||||
{
|
||||
if (!entityManager.TryGetEntity(childUid, out var childEntity))
|
||||
if (!entityManager.EntityExists(child))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -78,27 +76,27 @@ namespace Content.Server.Construction.Commands
|
||||
|
||||
// Occluders should only count if the state of it right now is enabled.
|
||||
// This prevents issues with edge firelocks.
|
||||
if (entityManager.TryGetComponent<OccluderComponent>(childUid, out var occluder))
|
||||
if (entityManager.TryGetComponent<OccluderComponent>(child, out var occluder))
|
||||
{
|
||||
valid |= occluder.Enabled;
|
||||
}
|
||||
// low walls & grilles
|
||||
valid |= IoCManager.Resolve<IEntityManager>().HasComponent<SharedCanBuildWindowOnTopComponent>(childEntity);
|
||||
valid |= entityManager.HasComponent<SharedCanBuildWindowOnTopComponent>(child);
|
||||
// cables
|
||||
valid |= IoCManager.Resolve<IEntityManager>().HasComponent<CableComponent>(childEntity);
|
||||
valid |= entityManager.HasComponent<CableComponent>(child);
|
||||
// anything else that might need this forced
|
||||
valid |= childEntity.HasTag("ForceFixRotations");
|
||||
valid |= child.HasTag("ForceFixRotations");
|
||||
// override
|
||||
valid &= !childEntity.HasTag("ForceNoFixRotations");
|
||||
valid &= !child.HasTag("ForceNoFixRotations");
|
||||
|
||||
if (!valid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(childEntity).LocalRotation != Angle.Zero)
|
||||
if (entityManager.GetComponent<TransformComponent>(child).LocalRotation != Angle.Zero)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(childEntity).LocalRotation = Angle.Zero;
|
||||
entityManager.GetComponent<TransformComponent>(child).LocalRotation = Angle.Zero;
|
||||
changed++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user