Fix use-in-hand interactions (#7085)

This commit is contained in:
Leon Friedrich
2022-03-13 04:05:11 +13:00
committed by GitHub
parent b1e719c70d
commit 865c9630bd
6 changed files with 30 additions and 12 deletions

View File

@@ -29,16 +29,11 @@ public abstract partial class InventorySystem
SubscribeLocalEvent<InventoryComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
SubscribeLocalEvent<InventoryComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
SubscribeLocalEvent<SharedItemComponent, UseInHandEvent>(OnUseInHand);
SubscribeAllEvent<UseSlotNetworkMessage>(OnUseSlot);
}
private void OnUseInHand(EntityUid uid, SharedItemComponent component, UseInHandEvent args)
protected void QuickEquip(EntityUid uid, SharedItemComponent component, UseInHandEvent args)
{
if (args.Handled || !component.QuickEquip)
return;
if (!TryComp(args.User, out InventoryComponent? inv)
|| !TryComp(args.User, out SharedHandsComponent? hands)
|| !_prototypeManager.TryIndex<InventoryTemplatePrototype>(inv.TemplateId, out var prototype))