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

@@ -1,6 +1,8 @@
using Content.Server.Atmos;
using Content.Server.Clothing.Components;
using Content.Server.Storage.Components;
using Content.Server.Temperature.Systems;
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using InventoryComponent = Content.Shared.Inventory.InventoryComponent;
@@ -17,9 +19,19 @@ namespace Content.Server.Inventory
SubscribeLocalEvent<InventoryComponent, LowPressureEvent>(RelayInventoryEvent);
SubscribeLocalEvent<InventoryComponent, ModifyChangedTemperatureEvent>(RelayInventoryEvent);
SubscribeLocalEvent<ClothingComponent, UseInHandEvent>(OnUseInHand);
SubscribeNetworkEvent<OpenSlotStorageNetworkMessage>(OnOpenSlotStorage);
}
private void OnUseInHand(EntityUid uid, ClothingComponent component, UseInHandEvent args)
{
if (args.Handled || !component.QuickEquip)
return;
QuickEquip(uid, component, args);
}
private void OnOpenSlotStorage(OpenSlotStorageNetworkMessage ev, EntitySessionEventArgs args)
{
if (args.SenderSession.AttachedEntity is not EntityUid { Valid: true } uid)