* fixe * Save work. * Rune-aware parser. * oogh * pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests pass tests * Publicizes a lot of common generic commands, so custom toolshed envs can include them. * i think i might implode * Tests. * a * b * awa --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System.Linq;
|
|
using Content.Server.Administration;
|
|
using Content.Server.Polymorph.Systems;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.Polymorph;
|
|
using Robust.Shared.Toolshed;
|
|
using Robust.Shared.Toolshed.TypeParsers;
|
|
|
|
namespace Content.Server.Polymorph.Toolshed;
|
|
|
|
/// <summary>
|
|
/// Polymorphs the given entity(s) into the target morph.
|
|
/// </summary>
|
|
[ToolshedCommand, AdminCommand(AdminFlags.Fun)]
|
|
public sealed class PolymorphCommand : ToolshedCommand
|
|
{
|
|
private PolymorphSystem? _system;
|
|
|
|
[CommandImplementation]
|
|
public EntityUid? Polymorph(
|
|
[PipedArgument] EntityUid input,
|
|
[CommandArgument] Prototype<PolymorphPrototype> prototype
|
|
)
|
|
{
|
|
_system ??= GetSys<PolymorphSystem>();
|
|
|
|
return _system.PolymorphEntity(input, prototype.Value);
|
|
}
|
|
|
|
[CommandImplementation]
|
|
public IEnumerable<EntityUid> Polymorph(
|
|
[PipedArgument] IEnumerable<EntityUid> input,
|
|
[CommandArgument] Prototype<PolymorphPrototype> prototype
|
|
)
|
|
=> input.Select(x => Polymorph(x, prototype)).Where(x => x is not null).Select(x => (EntityUid)x!);
|
|
}
|