mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 00:27:59 +00:00
* Reapply "Nubody Merge" (#5807) This reverts commitd62f7cef10. * Revert "Nubody Merge (#5670)" This reverts commitb465cfb3fd. * Revert "IPC fibers (#4968)" This reverts commitc2b42211f0. * Revert "IPC Polymorph fix (#4545)" This reverts commitfa03d8c655. * Revert "fix IPC not having humanoid emotes (#4445)" This reverts commit216fdf999f. * Revert "ipc heat/cold (#4306)" This reverts commitfafd5cf816. * Revert "ipc cables (#4283)" This reverts commit54958039a1. * Revert "feat: ipcs now have dynamic power draw based off movement speed (#3917)" This reverts commit71e8b7e64b. * Revert "fix ipcs not being able to disarm (#3374)" This reverts commit764c4dcf54. * Revert "make steel heal caustic for ipcs (#3206)" This reverts commit450ac82550. * Revert "add missing ipc survival boxes (#3065)" This reverts commit888c9cdb00. * Revert "make borgs use ipc repairing (#3064)" This reverts commitf77a49dd0b. * Revert "Update hud.yml to add ipcs to diagnostic hud (#3019)" This reverts commit7220643531. * Revert "Tweak IPCs (#2979)" This reverts commit98b47476de. * Revert "fix nukies ipc test fail (#2957)" This reverts commit4a1acbf863. * Revert "fix ipc nukies not getting comms (#2884)" This reverts commit8a2254770e. * Revert "fix ipc encryption key mispredict (#2879)" This reverts commitf08726efc1. * Revert "Merge pull request #2800 from Spielern/port-ipc" This reverts commit822fa4312c, reversing changes made tofe4c23c702. * Remove and Fix rest of IPC Hangons causing crashes * Integration test Errors * Expand migration file with removed IPC stuff * IPC Leg was found and migrated to naught * Revert "Merge pull request #2542 from deltanedas/shitmed-ops" This reverts commit83a8002922, reversing changes made tobaa89b0052. * Revert "Set up surgical augments infrastructure & add tool panel augments (#3059)" This reverts commita40f0be6fd. * Revert "Psionic Prosthetics (#4689)" This reverts commit2679bb238a. * Revert "Add surgical cleanliness and sanitation (#2847)" This reverts commit64565ba4f7. * Remove unremoved mentions * Revert "Add autoclave to easily sanitize large amounts of items and faster (#2933)" This reverts commitd0da90fa2e. * Shit Med Removed * Remove _ShitMed Folders and fix Errors in Console * Add OrganAnimalBrain into the mirgraiton file * Heads no Input Mover * Monke * Full migration file I guess * oops * shiv state fix * Restore accidental deleted recipe * Forgot one flt mention * Fix more issues * Comment out Damage Visual for motorkind for now * Motorkind... * Commenting stuff out for now * thought there'd be more of this to gut --------- Co-authored-by: Janet Blackquill <uhhadd@gmail.com>
122 lines
4.9 KiB
C#
122 lines
4.9 KiB
C#
using Content.Server.Administration;
|
|
using Content.Server.Body.Systems;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.Body.Components;
|
|
using Content.Shared.Body.Part;
|
|
using Robust.Shared.Console;
|
|
|
|
namespace Content.Server.Body.Commands
|
|
{
|
|
[AdminCommand(AdminFlags.Fun)]
|
|
public sealed class AttachBodyPartCommand : IConsoleCommand
|
|
{
|
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
|
|
|
public string Command => "attachbodypart";
|
|
public string Description => "Attaches a body part to you or someone else.";
|
|
public string Help => $"{Command} <partEntityUid> / {Command} <entityUid> <partEntityUid>";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
var player = shell.Player;
|
|
|
|
EntityUid bodyId;
|
|
EntityUid? partUid;
|
|
|
|
switch (args.Length)
|
|
{
|
|
case 1:
|
|
if (player == null)
|
|
{
|
|
shell.WriteLine($"You need to specify an entity to attach the part to if you aren't a player.\n{Help}");
|
|
return;
|
|
}
|
|
|
|
if (player.AttachedEntity == null)
|
|
{
|
|
shell.WriteLine($"You need to specify an entity to attach the part to if you aren't attached to an entity.\n{Help}");
|
|
return;
|
|
}
|
|
|
|
if (!NetEntity.TryParse(args[0], out var partNet) || !_entManager.TryGetEntity(partNet, out partUid))
|
|
{
|
|
shell.WriteLine($"{args[0]} is not a valid entity uid.");
|
|
return;
|
|
}
|
|
|
|
bodyId = player.AttachedEntity.Value;
|
|
|
|
break;
|
|
case 2:
|
|
if (!NetEntity.TryParse(args[0], out var entityNet) || !_entManager.TryGetEntity(entityNet, out var entityUid))
|
|
{
|
|
shell.WriteLine($"{args[0]} is not a valid entity uid.");
|
|
return;
|
|
}
|
|
|
|
if (!NetEntity.TryParse(args[1], out partNet) || !_entManager.TryGetEntity(partNet, out partUid))
|
|
{
|
|
shell.WriteLine($"{args[1]} is not a valid entity uid.");
|
|
return;
|
|
}
|
|
|
|
if (!_entManager.EntityExists(entityUid))
|
|
{
|
|
shell.WriteLine($"{entityUid} is not a valid entity.");
|
|
return;
|
|
}
|
|
|
|
bodyId = entityUid.Value;
|
|
break;
|
|
default:
|
|
shell.WriteLine(Help);
|
|
return;
|
|
}
|
|
|
|
if (!_entManager.TryGetComponent(bodyId, out BodyComponent? body))
|
|
{
|
|
shell.WriteLine($"Entity {_entManager.GetComponent<MetaDataComponent>(bodyId).EntityName} with uid {bodyId} does not have a {nameof(BodyComponent)}.");
|
|
return;
|
|
}
|
|
|
|
if (!_entManager.EntityExists(partUid))
|
|
{
|
|
shell.WriteLine($"{partUid} is not a valid entity.");
|
|
return;
|
|
}
|
|
|
|
if (!_entManager.TryGetComponent(partUid, out BodyPartComponent? part))
|
|
{
|
|
shell.WriteLine($"Entity {_entManager.GetComponent<MetaDataComponent>(partUid.Value).EntityName} with uid {args[0]} does not have a {nameof(BodyPartComponent)}.");
|
|
return;
|
|
}
|
|
|
|
var bodySystem = _entManager.System<BodySystem>();
|
|
if (bodySystem.BodyHasChild(bodyId, partUid.Value, body, part))
|
|
{
|
|
shell.WriteLine($"Body part {_entManager.GetComponent<MetaDataComponent>(partUid.Value).EntityName} with uid {partUid} is already attached to entity {_entManager.GetComponent<MetaDataComponent>(bodyId).EntityName} with uid {bodyId}");
|
|
return;
|
|
}
|
|
|
|
var slotId = $"AttachBodyPartVerb-{partUid}";
|
|
|
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
|
if (body.RootContainer.ContainedEntity != null)
|
|
{
|
|
bodySystem.AttachPartToRoot(bodyId, partUid.Value, body, part);
|
|
}
|
|
else
|
|
{
|
|
var (rootPartId, rootPart) = bodySystem.GetRootPartOrNull(bodyId, body)!.Value;
|
|
if (!bodySystem.TryCreatePartSlotAndAttach(rootPartId, slotId, partUid.Value, part.PartType, rootPart, part))
|
|
{
|
|
shell.WriteError($"Could not create slot {slotId} on entity {_entManager.ToPrettyString(bodyId)}");
|
|
return;
|
|
}
|
|
}
|
|
|
|
shell.WriteLine($"Attached part {_entManager.ToPrettyString(partUid.Value)} to {_entManager.ToPrettyString(bodyId)}");
|
|
}
|
|
}
|
|
}
|