diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index f694b26320..321690f428 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -1,6 +1,3 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Linq; using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.Items; using Content.Server.GameObjects.Components.Items.Storage; @@ -20,6 +17,9 @@ using Robust.Shared.Localization; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Players; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Linq; using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines; namespace Content.Server.GameObjects.EntitySystems @@ -27,7 +27,6 @@ namespace Content.Server.GameObjects.EntitySystems [UsedImplicitly] internal sealed class HandsSystem : EntitySystem { - private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons /// @@ -37,6 +36,7 @@ namespace Content.Server.GameObjects.EntitySystems SubscribeLocalEvent(HandleContainerModified); SubscribeLocalEvent(HandleContainerModified); + SubscribeLocalEvent(HandleExamined); CommandBinds.Builder .Bind(ContentKeyFunctions.SwapHands, InputCmdHandler.FromDelegate(HandleSwapHands)) @@ -53,9 +53,6 @@ namespace Content.Server.GameObjects.EntitySystems { base.Shutdown(); - UnsubscribeLocalEvent(); - UnsubscribeLocalEvent(); - CommandBinds.Unregister(); } @@ -67,6 +64,15 @@ namespace Content.Server.GameObjects.EntitySystems } } + //TODO: Actually shows all items/clothing/etc. + private void HandleExamined(EntityUid uid, HandsComponent component, ExaminedEvent args) + { + foreach (var inhand in component.GetAllHeldItems()) + { + args.Message.AddText($"\n{Loc.GetString("comp-hands-examine", ("user", component.Owner), ("item", inhand.Owner))}"); + } + } + private static bool TryGetAttachedComponent(IPlayerSession? session, [NotNullWhen(true)] out T? component) where T : Component { @@ -154,7 +160,7 @@ namespace Content.Server.GameObjects.EntitySystems private bool HandleThrowItem(ICommonSession? session, EntityCoordinates coords, EntityUid uid) { - var playerEnt = ((IPlayerSession?)session)?.AttachedEntity; + var playerEnt = ((IPlayerSession?) session)?.AttachedEntity; if (playerEnt == null || !playerEnt.IsValid()) return false; @@ -180,7 +186,7 @@ namespace Content.Server.GameObjects.EntitySystems } else { - var splitStack = new StackSplitEvent() {Amount = 1, SpawnPosition = playerEnt.Transform.Coordinates}; + var splitStack = new StackSplitEvent() { Amount = 1, SpawnPosition = playerEnt.Transform.Coordinates }; RaiseLocalEvent(throwEnt.Uid, splitStack); if (splitStack.Result == null) diff --git a/Resources/Locale/en-US/components/hands-component.ftl b/Resources/Locale/en-US/components/hands-component.ftl new file mode 100644 index 0000000000..0e1816f4a0 --- /dev/null +++ b/Resources/Locale/en-US/components/hands-component.ftl @@ -0,0 +1,4 @@ +### HandComponent stuff + +# Examine text after when they're holding something (in-hand) +comp-hands-examine = { CAPITALIZE(SUBJECT($user)) } { CONJUGATE-BE($user) } holding a { $item }.