Fix use-in-hand interactions (#7085)
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
using Content.Client.Items.Components;
|
||||
using Content.Shared.Item;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Client.Clothing
|
||||
{
|
||||
@@ -17,6 +14,9 @@ namespace Content.Client.Clothing
|
||||
[DataField("femaleMask")]
|
||||
public FemaleClothingMask FemaleMask { get; } = FemaleClothingMask.UniformFull;
|
||||
|
||||
[DataField("quickEquip")]
|
||||
public bool QuickEquip = true;
|
||||
|
||||
public string? InSlot;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Shared.Interaction.Events;
|
||||
|
||||
namespace Content.Client.Inventory
|
||||
{
|
||||
@@ -67,9 +68,19 @@ namespace Content.Client.Inventory
|
||||
SubscribeLocalEvent<ClientInventoryComponent, DidEquipEvent>(OnDidEquip);
|
||||
SubscribeLocalEvent<ClientInventoryComponent, DidUnequipEvent>(OnDidUnequip);
|
||||
|
||||
SubscribeLocalEvent<ClothingComponent, UseInHandEvent>(OnUseInHand);
|
||||
|
||||
_config.OnValueChanged(CCVars.HudTheme, UpdateHudTheme);
|
||||
}
|
||||
|
||||
private void OnUseInHand(EntityUid uid, ClothingComponent component, UseInHandEvent args)
|
||||
{
|
||||
if (args.Handled || !component.QuickEquip)
|
||||
return;
|
||||
|
||||
QuickEquip(uid, component, args);
|
||||
}
|
||||
|
||||
private void OnDidUnequip(EntityUid uid, ClientInventoryComponent component, DidUnequipEvent args)
|
||||
{
|
||||
UpdateComponentUISlot(uid, args.Slot, null, component);
|
||||
|
||||
Reference in New Issue
Block a user