From 7e4045d274de447ae7ad24931511874a54f02491 Mon Sep 17 00:00:00 2001 From: J Date: Mon, 14 Apr 2025 04:06:36 +0000 Subject: [PATCH] Admin spring cleaning (#36190) * Cleanup warnings in administration * Job command cleanup * Reverting already implemented changes --- Content.Server/Administration/Commands/AGhostCommand.cs | 2 +- .../Administration/Commands/ForceGhostCommand.cs | 1 - .../Logs/Converters/EntityCoordinatesConverter.cs | 4 ++-- Content.Server/Administration/Managers/AdminManager.cs | 4 +--- .../Administration/Systems/AdminVerbSystem.Smites.cs | 2 +- Content.Server/Administration/Toolshed/TagCommand.cs | 6 +++--- Content.Server/Station/Commands/JobsCommand.cs | 9 +++++---- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Content.Server/Administration/Commands/AGhostCommand.cs b/Content.Server/Administration/Commands/AGhostCommand.cs index b24dbbc018..6acaadbf83 100644 --- a/Content.Server/Administration/Commands/AGhostCommand.cs +++ b/Content.Server/Administration/Commands/AGhostCommand.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using Content.Server.GameTicking; using Content.Server.Ghost; using Content.Server.Mind; diff --git a/Content.Server/Administration/Commands/ForceGhostCommand.cs b/Content.Server/Administration/Commands/ForceGhostCommand.cs index 68a77b7454..aed3102882 100644 --- a/Content.Server/Administration/Commands/ForceGhostCommand.cs +++ b/Content.Server/Administration/Commands/ForceGhostCommand.cs @@ -11,7 +11,6 @@ namespace Content.Server.Administration.Commands; [AdminCommand(AdminFlags.Admin)] public sealed class ForceGhostCommand : LocalizedEntityCommands { - [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly GameTicker _gameTicker = default!; [Dependency] private readonly SharedMindSystem _mind = default!; diff --git a/Content.Server/Administration/Logs/Converters/EntityCoordinatesConverter.cs b/Content.Server/Administration/Logs/Converters/EntityCoordinatesConverter.cs index 3de5d98a81..fb5c6a6fe5 100644 --- a/Content.Server/Administration/Logs/Converters/EntityCoordinatesConverter.cs +++ b/Content.Server/Administration/Logs/Converters/EntityCoordinatesConverter.cs @@ -1,4 +1,4 @@ -using System.Text.Json; +using System.Text.Json; using Content.Shared.Station.Components; using Robust.Shared.Map; using Robust.Shared.Map.Components; @@ -72,6 +72,6 @@ public readonly struct SerializableEntityCoordinates EntityUid = coordinates.EntityId; X = coordinates.X; Y = coordinates.Y; - MapUid = coordinates.GetMapUid(entityManager); + MapUid = entityManager.System().GetMap(coordinates); } } diff --git a/Content.Server/Administration/Managers/AdminManager.cs b/Content.Server/Administration/Managers/AdminManager.cs index 05dacdc577..59fc11f7bb 100644 --- a/Content.Server/Administration/Managers/AdminManager.cs +++ b/Content.Server/Administration/Managers/AdminManager.cs @@ -4,10 +4,8 @@ using System.Reflection; using System.Threading.Tasks; using Content.Server.Chat.Managers; using Content.Server.Database; -using Content.Server.Players; using Content.Shared.Administration; using Content.Shared.CCVar; -using Content.Shared.Info; using Content.Shared.Players; using Robust.Server.Console; using Robust.Server.Player; @@ -108,7 +106,7 @@ namespace Content.Server.Administration.Managers // The DB function handles this scenario fine, but it's worth noting. await _dbManager.UpdateAdminDeadminnedAsync(player.UserId, newState); } - catch (Exception e) + catch (Exception) { _sawmill.Error("Failed to save deadmin state to database for {Admin}", player.UserId); } diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs b/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs index 027a39dd5d..114ab943ea 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs @@ -421,7 +421,7 @@ public sealed partial class AdminVerbSystem { var xform = Transform(args.Target); var fixtures = Comp(args.Target); - _transformSystem.Unanchor(args.Target); // Just in case. + _transformSystem.Unanchor(args.Target, xform); // Just in case. _physics.SetBodyType(args.Target, BodyType.Dynamic, manager: fixtures, body: physics); _physics.SetBodyStatus(args.Target, physics, BodyStatus.InAir); _physics.WakeBody(args.Target, manager: fixtures, body: physics); diff --git a/Content.Server/Administration/Toolshed/TagCommand.cs b/Content.Server/Administration/Toolshed/TagCommand.cs index a751b85914..119578f100 100644 --- a/Content.Server/Administration/Toolshed/TagCommand.cs +++ b/Content.Server/Administration/Toolshed/TagCommand.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using Content.Shared.Administration; using Content.Shared.Tag; using Robust.Shared.Prototypes; @@ -29,10 +29,10 @@ public sealed class TagCommand : ToolshedCommand public IEnumerable With( [CommandInvocationContext] IInvocationContext ctx, [PipedArgument] IEnumerable entities, - [CommandArgument] ValueRef> tag) + [CommandArgument] ProtoId tag) { _tag ??= GetSys(); - return entities.Where(e => _tag.HasTag(e, tag.Evaluate(ctx)!)); + return entities.Where(e => _tag.HasTag(e, tag!)); } [CommandImplementation("add")] diff --git a/Content.Server/Station/Commands/JobsCommand.cs b/Content.Server/Station/Commands/JobsCommand.cs index 599a87aac6..c971a1cac3 100644 --- a/Content.Server/Station/Commands/JobsCommand.cs +++ b/Content.Server/Station/Commands/JobsCommand.cs @@ -1,8 +1,9 @@ -using System.Linq; +using System.Linq; using Content.Server.Administration; using Content.Server.Station.Systems; using Content.Shared.Administration; using Content.Shared.Roles; +using Robust.Shared.Prototypes; using Robust.Shared.Toolshed; using Robust.Shared.Toolshed.Syntax; using Robust.Shared.Toolshed.TypeParsers; @@ -30,15 +31,15 @@ public sealed class JobsCommand : ToolshedCommand => stations.SelectMany(Jobs); [CommandImplementation("job")] - public JobSlotRef Job([PipedArgument] EntityUid station, Prototype job) + public JobSlotRef Job([PipedArgument] EntityUid station, ProtoId job) { _jobs ??= GetSys(); - return new JobSlotRef(job.Value.ID, station, _jobs, EntityManager); + return new JobSlotRef(job.Id, station, _jobs, EntityManager); } [CommandImplementation("job")] - public IEnumerable Job([PipedArgument] IEnumerable stations, Prototype job) + public IEnumerable Job([PipedArgument] IEnumerable stations, ProtoId job) => stations.Select(x => Job(x, job)); [CommandImplementation("isinfinite")] -- 2.51.2