Files
tbd-station-14/Content.Server/Polymorph/Toolshed/UnpolymorphCommand.cs
AJCM-git b8f0ed3975 Cleanups PolymorphSystem/Components/Prototypes (#23721)
* Cleanups PolymorphSystem

* forgot this

* Nah

* Fix test

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2024-02-01 23:17:02 +11:00

29 lines
867 B
C#

using System.Linq;
using Content.Server.Administration;
using Content.Server.Polymorph.Systems;
using Content.Shared.Administration;
using Robust.Shared.Toolshed;
namespace Content.Server.Polymorph.Toolshed;
/// <summary>
/// Undoes a polymorph, reverting the target to it's original form.
/// </summary>
[ToolshedCommand, AdminCommand(AdminFlags.Fun)]
public sealed class UnpolymorphCommand : ToolshedCommand
{
private PolymorphSystem? _system;
[CommandImplementation]
public EntityUid? Unpolymorph([PipedArgument] EntityUid input)
{
_system ??= GetSys<PolymorphSystem>();
return _system.Revert(input);
}
[CommandImplementation]
public IEnumerable<EntityUid> Unpolymorph([PipedArgument] IEnumerable<EntityUid> input)
=> input.Select(Unpolymorph).Where(x => x is not null).Select(x => (EntityUid)x!);
}