diff --git a/Content.Server/Body/Commands/AddHandCommand.cs b/Content.Server/Body/Commands/AddHandCommand.cs index a28b07ef57..4d2805333a 100644 --- a/Content.Server/Body/Commands/AddHandCommand.cs +++ b/Content.Server/Body/Commands/AddHandCommand.cs @@ -1,12 +1,13 @@ using System.Linq; using Content.Server.Administration; using Content.Server.Body.Systems; +using Content.Server.Hands.Systems; using Content.Shared.Administration; using Content.Shared.Body.Components; using Content.Shared.Body.Part; +using Content.Shared.Hands.Components; using Robust.Shared.Console; using Robust.Shared.Prototypes; -using Robust.Shared.Random; namespace Content.Server.Body.Commands { @@ -15,9 +16,9 @@ namespace Content.Server.Body.Commands { [Dependency] private readonly IEntityManager _entManager = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!; - [Dependency] private readonly IRobustRandom _random = default!; private static readonly EntProtoId DefaultHandPrototype = "LeftHandHuman"; + private static int _handIdAccumulator; public string Command => "addhand"; public string Description => "Adds a hand to your entity."; @@ -114,9 +115,17 @@ namespace Content.Server.Body.Commands if (!_entManager.TryGetComponent(entity, out BodyComponent? body) || body.RootContainer.ContainedEntity == null) { - var text = $"You have no body{(_random.Prob(0.2f) ? " and you must scream." : ".")}"; + var location = _entManager.GetComponentOrNull(hand)?.Symmetry switch + { + BodyPartSymmetry.None => HandLocation.Middle, + BodyPartSymmetry.Left => HandLocation.Left, + BodyPartSymmetry.Right => HandLocation.Right, + _ => HandLocation.Right + }; + _entManager.DeleteEntity(hand); - shell.WriteLine(text); + // You have no body and you must scream. + _entManager.System().AddHand(entity, $"{hand}-cmd-{_handIdAccumulator++}", location); return; }