Decouple interactions from hands, cleanup old events, add new fears (#28393)

* ok basic shit

* second part

* pretend it isn't real it can't hurt you.

* 👁️ 👁️

* shadowcommander review
This commit is contained in:
Nemanja
2024-05-31 16:26:19 -04:00
committed by GitHub
parent c4291920a6
commit a1a8f04036
72 changed files with 312 additions and 165 deletions

View File

@@ -3,6 +3,7 @@ using Content.Shared.Examine;
using Content.Shared.Hands.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Input;
using Content.Shared.Interaction;
using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Localizations;
using Robust.Shared.Input.Binding;
@@ -23,6 +24,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
SubscribeAllEvent<RequestMoveHandItemEvent>(HandleMoveItemFromHand);
SubscribeAllEvent<RequestHandAltInteractEvent>(HandleHandAltInteract);
SubscribeLocalEvent<HandsComponent, GetUsedEntityEvent>(OnGetUsedEntity);
SubscribeLocalEvent<HandsComponent, ExaminedEvent>(HandleExamined);
CommandBinds.Builder
@@ -181,6 +183,18 @@ public abstract partial class SharedHandsSystem : EntitySystem
return true;
}
private void OnGetUsedEntity(EntityUid uid, HandsComponent component, ref GetUsedEntityEvent args)
{
if (args.Handled)
return;
// TODO: this pattern is super uncommon, but it might be worth changing GetUsedEntityEvent to be recursive.
if (TryComp<VirtualItemComponent>(component.ActiveHandEntity, out var virtualItem))
args.Used = virtualItem.BlockingEntity;
else
args.Used = component.ActiveHandEntity;
}
//TODO: Actually shows all items/clothing/etc.
private void HandleExamined(EntityUid examinedUid, HandsComponent handsComp, ExaminedEvent args)
{