From 5dd2b0671152b64be5e1017665a20847f0f28d9d Mon Sep 17 00:00:00 2001 From: IngvarJackal Date: Sun, 24 May 2026 00:07:24 +0200 Subject: [PATCH] add suitstorage shortcut --- Content.Client/Input/ContentContexts.cs | 1 + .../Options/UI/Tabs/KeyRebindTab.xaml.cs | 1 + Content.Shared/Input/ContentKeyFunctions.cs | 1 + .../Interaction/SmartEquipSystem.cs | 66 +++++++++++++++++++ Resources/keybinds.yml | 4 ++ 5 files changed, 73 insertions(+) diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs index 03d43736e65..ed225dc906e 100644 --- a/Content.Client/Input/ContentContexts.cs +++ b/Content.Client/Input/ContentContexts.cs @@ -81,6 +81,7 @@ public static void SetupContexts(IInputContextContainer contexts) human.AddFunction(ContentKeyFunctions.SmartEquipBackpack); human.AddFunction(ContentKeyFunctions.SmartEquipBelt); human.AddFunction(ContentKeyFunctions.SmartEquipWallet); // Frontier + human.AddFunction(ContentKeyFunctions.SmartEquipSuitStorage); // Hardlight human.AddFunction(ContentKeyFunctions.OpenBackpack); human.AddFunction(ContentKeyFunctions.OpenBelt); human.AddFunction(ContentKeyFunctions.ToggleStanding); // EE diff --git a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs index 3c418231a65..158884e8fbd 100644 --- a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs +++ b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs @@ -213,6 +213,7 @@ void AddCheckBox(string checkBoxName, bool currentState, Action(); } @@ -61,6 +62,71 @@ private void HandleSmartEquipWallet(ICommonSession? session) HandleSmartEquip(session, "wallet"); } // End Frontier: smart-equip to wallet + + // Hardlight: smart-equip to suit storage + // Uses direct equip/unequip only — skipping storage and item-slot cases so guns don't eject their magazine. + private void HandleSmartEquipSuitStorage(ICommonSession? session) + { + if (session is not { } playerSession) + return; + + if (playerSession.AttachedEntity is not { Valid: true } uid || !Exists(uid)) + return; + + if (!TryComp(uid, out var hands) || hands.ActiveHand == null) + return; + + var handItem = hands.ActiveHand.HeldEntity; + + if (!_actionBlocker.CanInteract(uid, handItem)) + return; + + if (!TryComp(uid, out var inventory) || !_inventory.HasSlot(uid, "suitstorage", inventory)) + { + _popup.PopupClient(Loc.GetString("smart-equip-missing-equipment-slot", ("slotName", "suitstorage")), uid, uid); + return; + } + + if (handItem != null && !_hands.CanDropHeld(uid, hands.ActiveHand)) + { + _popup.PopupClient(Loc.GetString("smart-equip-cant-drop"), uid, uid); + return; + } + + _inventory.TryGetSlotEntity(uid, "suitstorage", out var slotEntity); + + if (slotEntity is not { } slotItem) + { + if (handItem == null) + { + _popup.PopupClient(Loc.GetString("smart-equip-empty-equipment-slot", ("slotName", "suitstorage")), uid, uid); + return; + } + + if (!_inventory.CanEquip(uid, handItem.Value, "suitstorage", out var reason)) + { + _popup.PopupClient(Loc.GetString(reason), uid, uid); + return; + } + + _hands.TryDrop(uid, hands.ActiveHand, handsComp: hands); + _inventory.TryEquip(uid, handItem.Value, "suitstorage", predicted: true, checkDoafter: true); + return; + } + + if (handItem != null) + return; + + if (!_inventory.CanUnequip(uid, "suitstorage", out var inventoryReason)) + { + _popup.PopupClient(Loc.GetString(inventoryReason), uid, uid); + return; + } + + _inventory.TryUnequip(uid, "suitstorage", inventory: inventory, predicted: true, checkDoafter: true); + _hands.TryPickup(uid, slotItem, handsComp: hands); + } + // End Hardlight: smart-equip to suit storage private void HandleSmartEquip(ICommonSession? session, string equipmentSlot) { if (session is not { } playerSession) diff --git a/Resources/keybinds.yml b/Resources/keybinds.yml index b5b4e39f8a9..afb2af4cae5 100644 --- a/Resources/keybinds.yml +++ b/Resources/keybinds.yml @@ -272,6 +272,10 @@ binds: type: State key: B mod1: Shift +- function: SmartEquipSuitStorage + type: State + key: F + mod1: Shift - function: SmartEquipBelt type: State key: E