diff --git a/Content.Client/Clothing/ClothingComponent.cs b/Content.Client/Clothing/ClothingComponent.cs index 0a775c87b7..1ead482b3c 100644 --- a/Content.Client/Clothing/ClothingComponent.cs +++ b/Content.Client/Clothing/ClothingComponent.cs @@ -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; } diff --git a/Content.Client/Inventory/ClientInventorySystem.cs b/Content.Client/Inventory/ClientInventorySystem.cs index d923da9ddf..2ce5fadbef 100644 --- a/Content.Client/Inventory/ClientInventorySystem.cs +++ b/Content.Client/Inventory/ClientInventorySystem.cs @@ -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(OnDidEquip); SubscribeLocalEvent(OnDidUnequip); + SubscribeLocalEvent(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); diff --git a/Content.Server/Clothing/Components/ClothingComponent.cs b/Content.Server/Clothing/Components/ClothingComponent.cs index 93db5d6e58..629e4597eb 100644 --- a/Content.Server/Clothing/Components/ClothingComponent.cs +++ b/Content.Server/Clothing/Components/ClothingComponent.cs @@ -16,6 +16,9 @@ namespace Content.Server.Clothing.Components [DataField("HeatResistance")] private int _heatResistance = 323; + [DataField("quickEquip")] + public bool QuickEquip = true; + [ViewVariables(VVAccess.ReadWrite)] public int HeatResistance => _heatResistance; } diff --git a/Content.Server/Inventory/ServerInventorySystem.cs b/Content.Server/Inventory/ServerInventorySystem.cs index 15d5f72aaf..9adaf9fbe3 100644 --- a/Content.Server/Inventory/ServerInventorySystem.cs +++ b/Content.Server/Inventory/ServerInventorySystem.cs @@ -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(RelayInventoryEvent); SubscribeLocalEvent(RelayInventoryEvent); + SubscribeLocalEvent(OnUseInHand); + SubscribeNetworkEvent(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) diff --git a/Content.Shared/Inventory/InventorySystem.Equip.cs b/Content.Shared/Inventory/InventorySystem.Equip.cs index 8aeb082f15..81c9d0eb0b 100644 --- a/Content.Shared/Inventory/InventorySystem.Equip.cs +++ b/Content.Shared/Inventory/InventorySystem.Equip.cs @@ -29,16 +29,11 @@ public abstract partial class InventorySystem SubscribeLocalEvent(OnEntInserted); SubscribeLocalEvent(OnEntRemoved); - SubscribeLocalEvent(OnUseInHand); - SubscribeAllEvent(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(inv.TemplateId, out var prototype)) diff --git a/Content.Shared/Item/SharedItemComponent.cs b/Content.Shared/Item/SharedItemComponent.cs index ba86a95f54..a54f00d55e 100644 --- a/Content.Shared/Item/SharedItemComponent.cs +++ b/Content.Shared/Item/SharedItemComponent.cs @@ -15,9 +15,6 @@ namespace Content.Shared.Item { [Dependency] private readonly IEntityManager _entMan = default!; - [DataField("quickEquip")] - public bool QuickEquip = true; - /// /// How much big this item is. ///