Adds hands examine text (#4160)
* Adds hands examine text. * Cleans the code * Fixes? * Update Resources/Locale/en-US/components/hands-component.ftl Thankies ❤ Co-authored-by: mirrorcult <notzombiedude@gmail.com> * Put it under handcontainer and shutdown Co-authored-by: mirrorcult <notzombiedude@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -37,6 +36,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
|
||||
SubscribeLocalEvent<EntRemovedFromContainerMessage>(HandleContainerModified);
|
||||
SubscribeLocalEvent<EntInsertedIntoContainerMessage>(HandleContainerModified);
|
||||
SubscribeLocalEvent<HandsComponent, ExaminedEvent>(HandleExamined);
|
||||
|
||||
CommandBinds.Builder
|
||||
.Bind(ContentKeyFunctions.SwapHands, InputCmdHandler.FromDelegate(HandleSwapHands))
|
||||
@@ -53,9 +53,6 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
UnsubscribeLocalEvent<EntRemovedFromContainerMessage>();
|
||||
UnsubscribeLocalEvent<EntInsertedIntoContainerMessage>();
|
||||
|
||||
CommandBinds.Unregister<HandsSystem>();
|
||||
}
|
||||
|
||||
@@ -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<T>(IPlayerSession? session, [NotNullWhen(true)] out T? component)
|
||||
where T : Component
|
||||
{
|
||||
|
||||
4
Resources/Locale/en-US/components/hands-component.ftl
Normal file
4
Resources/Locale/en-US/components/hands-component.ftl
Normal file
@@ -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 }.
|
||||
Reference in New Issue
Block a user