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;
///
/// Undoes a polymorph, reverting the target to it's original form.
///
[ToolshedCommand, AdminCommand(AdminFlags.Fun)]
public sealed class UnpolymorphCommand : ToolshedCommand
{
private PolymorphSystem? _system;
[CommandImplementation]
public EntityUid? Unpolymorph([PipedArgument] EntityUid input)
{
_system ??= GetSys();
return _system.Revert(input);
}
[CommandImplementation]
public IEnumerable Unpolymorph([PipedArgument] IEnumerable input)
=> input.Select(Unpolymorph).Where(x => x is not null).Select(x => (EntityUid)x!);
}