diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs index 53006482c68..df1f84dee84 100644 --- a/Content.Client/Input/ContentContexts.cs +++ b/Content.Client/Input/ContentContexts.cs @@ -79,11 +79,32 @@ public static void SetupContexts(IInputContextContainer contexts) human.AddFunction(ContentKeyFunctions.OpenInventoryMenu); human.AddFunction(ContentKeyFunctions.SmartEquipBackpack); human.AddFunction(ContentKeyFunctions.SmartEquipBelt); + human.AddFunction(ContentKeyFunctions.SmartEquipPocket1); + human.AddFunction(ContentKeyFunctions.SmartEquipPocket2); + human.AddFunction(ContentKeyFunctions.SmartEquipSuitStorage); human.AddFunction(ContentKeyFunctions.SmartEquipWallet); // Frontier + // Mono Edit + human.AddFunction(ContentKeyFunctions.SmartEquipID); + human.AddFunction(ContentKeyFunctions.SmartEquipShoes); + human.AddFunction(ContentKeyFunctions.SmartEquipOuterClothing); + human.AddFunction(ContentKeyFunctions.EquipBackpack); + human.AddFunction(ContentKeyFunctions.EquipBelt); + human.AddFunction(ContentKeyFunctions.EquipPocket1); + human.AddFunction(ContentKeyFunctions.EquipPocket2); + human.AddFunction(ContentKeyFunctions.EquipSuitStorage); + human.AddFunction(ContentKeyFunctions.EquipWallet); + human.AddFunction(ContentKeyFunctions.EquipID); + // Mono End human.AddFunction(ContentKeyFunctions.OpenBackpack); human.AddFunction(ContentKeyFunctions.OpenBelt); human.AddFunction(ContentKeyFunctions.ToggleStanding); // EE human.AddFunction(ContentKeyFunctions.ToggleCrawlingUnder); // EE + // Mono + human.AddFunction(ContentKeyFunctions.OpenPocket1); + human.AddFunction(ContentKeyFunctions.OpenPocket2); + human.AddFunction(ContentKeyFunctions.OpenSuitStorage); + human.AddFunction(ContentKeyFunctions.OpenOuterClothing); + // Mono End human.AddFunction(ContentKeyFunctions.OpenWallet); // Frontier human.AddFunction(ContentKeyFunctions.MouseMiddle); human.AddFunction(ContentKeyFunctions.RotateObjectClockwise); diff --git a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs index 060522c4024..fbe45c609cd 100644 --- a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs +++ b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs @@ -212,9 +212,30 @@ void AddCheckBox(string checkBoxName, bool currentState, Action(); } @@ -45,22 +53,11 @@ public override void Shutdown() CommandBinds.Unregister(); } - - private void HandleSmartEquipBackpack(ICommonSession? session) - { - HandleSmartEquip(session, "back"); - } - - private void HandleSmartEquipBelt(ICommonSession? session) - { - HandleSmartEquip(session, "belt"); - } - // Frontier: smart-equip to wallet - private void HandleSmartEquipWallet(ICommonSession? session) - { - HandleSmartEquip(session, "wallet"); + // Mono, Partial Application of 2nd Argument + private StateInputCmdDelegate HandleSmartEquipPartial(string equipmentSlot) { + return (x) => HandleSmartEquip(x, equipmentSlot); } - // End Frontier: smart-equip to wallet + // Mono End private void HandleSmartEquip(ICommonSession? session, string equipmentSlot) { if (session is not { } playerSession) diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index b7a9b95563f..06218cfd267 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -168,6 +168,12 @@ public override void Initialize() .Bind(ContentKeyFunctions.OpenBackpack, InputCmdHandler.FromDelegate(HandleOpenBackpack, handle: false)) .Bind(ContentKeyFunctions.OpenBelt, InputCmdHandler.FromDelegate(HandleOpenBelt, handle: false)) .Bind(ContentKeyFunctions.OpenWallet, InputCmdHandler.FromDelegate(HandleOpenWallet, handle: false)) // Frontier + // Mono + .Bind(ContentKeyFunctions.OpenPocket1, InputCmdHandler.FromDelegate(HandleOpenPocket1, handle: false)) + .Bind(ContentKeyFunctions.OpenPocket2, InputCmdHandler.FromDelegate(HandleOpenPocket2, handle: false)) + .Bind(ContentKeyFunctions.OpenSuitStorage, InputCmdHandler.FromDelegate(HandleOpenSuitStorage, handle: false)) + .Bind(ContentKeyFunctions.OpenOuterClothing, InputCmdHandler.FromDelegate(HandleOuterClothing, handle: false)) + // Mono End .Register(); Subs.CVar(_cfg, CCVars.NestedStorage, OnNestedStorageCvar, true); @@ -1698,6 +1704,27 @@ private void HandleOpenWallet(ICommonSession? session) HandleToggleSlotUI(session, "wallet"); } // End Frontier: open wallet + // Mono Edit + private void HandleOpenPocket1(ICommonSession? session) + { + HandleToggleSlotUI(session, "pocket1"); + } + + private void HandleOpenPocket2(ICommonSession? session) + { + HandleToggleSlotUI(session, "pocket2"); + } + + private void HandleOpenSuitStorage(ICommonSession? session) + { + HandleToggleSlotUI(session, "suitstorage"); + } + + private void HandleOuterClothing(ICommonSession? session) + { + HandleToggleSlotUI(session, "outerClothing"); + } + // Mono End private void HandleToggleSlotUI(ICommonSession? session, string slot) { if (session is not { } playerSession) diff --git a/Content.Shared/_Goobstation/Interaction/BackEquipSystem.cs b/Content.Shared/_Goobstation/Interaction/BackEquipSystem.cs new file mode 100644 index 00000000000..717b373ee6b --- /dev/null +++ b/Content.Shared/_Goobstation/Interaction/BackEquipSystem.cs @@ -0,0 +1,116 @@ +// SPDX-FileCopyrightText: 2025 Ark +// SPDX-FileCopyrightText: 2025 Daniel Lenrd +// +// SPDX-License-Identifier: MPL-2.0 + +using Content.Shared.ActionBlocker; +using Content.Shared.Containers.ItemSlots; +using Content.Shared.Hands.Components; +using Content.Shared.Hands.EntitySystems; +using Content.Shared.Input; +using Content.Shared.Interaction; +using Content.Shared.Inventory; +using Content.Shared.Popups; +using Content.Shared.Storage.EntitySystems; +using Content.Shared.Whitelist; +using Robust.Shared.Containers; +using Robust.Shared.Input.Binding; +using Robust.Shared.Player; + +namespace Content.Shared._Goobstation.Interaction; + +public sealed class BackEquipSystem : EntitySystem +{ + [Dependency] private readonly SharedHandsSystem _hands = default!; + [Dependency] private readonly InventorySystem _inventory = default!; + [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; + + public override void Initialize() + { + CommandBinds.Builder + // Mono, Partial Application of 2nd Argument + .Bind(ContentKeyFunctions.EquipBackpack, InputCmdHandler.FromDelegate(HandleEquipToSlotPartial("back"), handle: false, outsidePrediction: false)) + .Bind(ContentKeyFunctions.EquipBelt, InputCmdHandler.FromDelegate(HandleEquipToSlotPartial("belt"), handle: false, outsidePrediction: false)) + .Bind(ContentKeyFunctions.EquipPocket1, InputCmdHandler.FromDelegate(HandleEquipToSlotPartial("pocket1"), handle: false, outsidePrediction: false)) + .Bind(ContentKeyFunctions.EquipPocket2, InputCmdHandler.FromDelegate(HandleEquipToSlotPartial("pocket2"), handle: false, outsidePrediction: false)) + .Bind(ContentKeyFunctions.EquipSuitStorage, InputCmdHandler.FromDelegate(HandleEquipToSlotPartial("suitstorage"), handle: false, outsidePrediction: false)) + .Bind(ContentKeyFunctions.EquipWallet, InputCmdHandler.FromDelegate(HandleEquipToSlotPartial("wallet"), handle: false, outsidePrediction: false)) + .Bind(ContentKeyFunctions.EquipID, InputCmdHandler.FromDelegate(HandleEquipToSlotPartial("id"), handle: false, outsidePrediction: false)) + // Mono End + .Register(); + } + + public override void Shutdown() + { + base.Shutdown(); + + CommandBinds.Unregister(); + } + // Mono, Partial Application of 2nd Argument + private StateInputCmdDelegate HandleEquipToSlotPartial(string equipmentSlot) { + return (x) => HandleEquipToSlot(x, equipmentSlot); + } + // Mono End + private void HandleEquipToSlot(ICommonSession? session, string equipmentSlot) + { + 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, equipmentSlot, inventory)) + { + _popup.PopupClient(Loc.GetString("smart-equip-missing-equipment-slot", ("slotName", equipmentSlot)), + 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, equipmentSlot, out var slotEntity); + var emptyEquipmentSlotString = Loc.GetString("smart-equip-empty-equipment-slot", ("slotName", equipmentSlot)); + if (slotEntity is not { } slotItem) + { + if (handItem == null) + { + _popup.PopupClient(emptyEquipmentSlotString, uid, uid); + return; + } + + if (!_inventory.CanEquip(uid, handItem.Value, equipmentSlot, out var reason)) + { + _popup.PopupClient(Loc.GetString(reason), uid, uid); + return; + } + + _hands.TryDrop(uid, hands.ActiveHand, handsComp: hands); + _inventory.TryEquip(uid, handItem.Value, equipmentSlot, predicted: true, checkDoafter: true); + return; + } + if (handItem != null) + return; + + if (!_inventory.CanUnequip(uid, equipmentSlot, out var inventoryReason)) + { + _popup.PopupClient(Loc.GetString(inventoryReason), uid, uid); + return; + } + _inventory.TryUnequip(uid, equipmentSlot, inventory: inventory, predicted: true, checkDoafter: true); + _hands.TryPickup(uid, slotItem, handsComp: hands); + } +} diff --git a/Resources/Locale/en-US/_Mono/escape-menu/ui/options-menu.ftl b/Resources/Locale/en-US/_Mono/escape-menu/ui/options-menu.ftl new file mode 100644 index 00000000000..62ee3ffaf9d --- /dev/null +++ b/Resources/Locale/en-US/_Mono/escape-menu/ui/options-menu.ftl @@ -0,0 +1,21 @@ +## Controls menu + +ui-options-function-smart-equip-pocket1 = Smart-equip to 1st pocket +ui-options-function-smart-equip-pocket2 = Smart-equip to 2nd pocket +ui-options-function-smart-equip-suit-storage = Smart-equip to shoulder +ui-options-function-smart-equip-id = Smart-equip to PDA slot +ui-options-function-smart-equip-shoes = Smart-equip to boots +ui-options-function-smart-equip-outer-clothing = Smart-equip to armor storage + +ui-options-function-equip-backpack = Quick-equip to backpack +ui-options-function-equip-belt = Quick-equip to belt +ui-options-function-equip-suit-storage = Quick-equip to shoulder +ui-options-function-equip-pocket1 = Quick-equip to 1st pocket +ui-options-function-equip-pocket2 = Quick-equip to 2nd pocket +ui-options-function-equip-id = Quick-equip to PDA slot +ui-options-function-equip-wallet = Quick-equip to wallet + +ui-options-function-open-pocket1 = Open 1st pocket +ui-options-function-open-pocket2 = Open 2nd pocket +ui-options-function-open-suit-storage = Open shoulder storage +ui-options-function-open-outer-clothing = Open armor storage diff --git a/Resources/keybinds.yml b/Resources/keybinds.yml index e4318ea0349..e01ceb61775 100644 --- a/Resources/keybinds.yml +++ b/Resources/keybinds.yml @@ -1,4 +1,54 @@ -version: 1 # Not used right now, whatever. +# SPDX-FileCopyrightText: 2018 Pieter-Jan Briers +# SPDX-FileCopyrightText: 2020 Clyybber +# SPDX-FileCopyrightText: 2020 DamianX +# SPDX-FileCopyrightText: 2020 Exp +# SPDX-FileCopyrightText: 2020 Hugal31 +# SPDX-FileCopyrightText: 2020 Paul Ritter +# SPDX-FileCopyrightText: 2020 Peter Wedder +# SPDX-FileCopyrightText: 2020 Vera Aguilera Puerto +# SPDX-FileCopyrightText: 2020 Vince +# SPDX-FileCopyrightText: 2020 derek +# SPDX-FileCopyrightText: 2020 moneyl +# SPDX-FileCopyrightText: 2021 Acruid +# SPDX-FileCopyrightText: 2021 E F R +# SPDX-FileCopyrightText: 2021 Radrark +# SPDX-FileCopyrightText: 2021 Radrark +# SPDX-FileCopyrightText: 2021 Swept +# SPDX-FileCopyrightText: 2021 chairbender +# SPDX-FileCopyrightText: 2021 ike709 +# SPDX-FileCopyrightText: 2022 DrSmugleaf +# SPDX-FileCopyrightText: 2022 Jezithyr +# SPDX-FileCopyrightText: 2022 Michael Phillips +# SPDX-FileCopyrightText: 2022 eclips_e +# SPDX-FileCopyrightText: 2022 metalgearsloth +# SPDX-FileCopyrightText: 2022 mirrorcult +# SPDX-FileCopyrightText: 2023 08A +# SPDX-FileCopyrightText: 2023 Aexolott +# SPDX-FileCopyrightText: 2023 Kara +# SPDX-FileCopyrightText: 2023 Leon Friedrich +# SPDX-FileCopyrightText: 2023 Miro Kavaliou +# SPDX-FileCopyrightText: 2023 Nemanja +# SPDX-FileCopyrightText: 2023 ShadowCommander +# SPDX-FileCopyrightText: 2023 Skye +# SPDX-FileCopyrightText: 2023 Vasilis The Pikachu +# SPDX-FileCopyrightText: 2023 Visne +# SPDX-FileCopyrightText: 2024 Brandon Hu +# SPDX-FileCopyrightText: 2024 JIPDawg +# SPDX-FileCopyrightText: 2024 Julian Giebel +# SPDX-FileCopyrightText: 2024 Morb +# SPDX-FileCopyrightText: 2024 Winkarst +# SPDX-FileCopyrightText: 2024 Wrexbe (Josh) +# SPDX-FileCopyrightText: 2024 deltanedas +# SPDX-FileCopyrightText: 2024 slarticodefast +# SPDX-FileCopyrightText: 2024 wafehling +# SPDX-FileCopyrightText: 2025 Ark +# SPDX-FileCopyrightText: 2025 Daniel Lenrd +# SPDX-FileCopyrightText: 2025 ScyronX +# SPDX-FileCopyrightText: 2025 Whatstone +# +# SPDX-License-Identifier: MPL-2.0 + +version: 1 # Not used right now, whatever. binds: - function: UIClick type: State @@ -270,6 +320,23 @@ binds: type: State key: E mod1: Shift +- function: SmartEquipPocket1 + type: State + key: G # Mono: G