diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs index 639f326f7f..5b7614780b 100644 --- a/Content.Client/Input/ContentContexts.cs +++ b/Content.Client/Input/ContentContexts.cs @@ -56,6 +56,7 @@ namespace Content.Client.Input human.AddFunction(EngineKeyFunctions.MoveRight); human.AddFunction(EngineKeyFunctions.Walk); human.AddFunction(ContentKeyFunctions.SwapHands); + human.AddFunction(ContentKeyFunctions.SwapHandsReverse); human.AddFunction(ContentKeyFunctions.Drop); human.AddFunction(ContentKeyFunctions.UseItemInHand); human.AddFunction(ContentKeyFunctions.AltUseItemInHand); @@ -100,6 +101,7 @@ namespace Content.Client.Input aghost.AddFunction(EngineKeyFunctions.MoveRight); aghost.AddFunction(EngineKeyFunctions.Walk); aghost.AddFunction(ContentKeyFunctions.SwapHands); + aghost.AddFunction(ContentKeyFunctions.SwapHandsReverse); aghost.AddFunction(ContentKeyFunctions.Drop); aghost.AddFunction(ContentKeyFunctions.UseItemInHand); aghost.AddFunction(ContentKeyFunctions.AltUseItemInHand); diff --git a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs index d934d331fb..9ef3def541 100644 --- a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs +++ b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs @@ -181,6 +181,7 @@ namespace Content.Client.Options.UI.Tabs AddButton(ContentKeyFunctions.Drop); AddButton(ContentKeyFunctions.ExamineEntity); AddButton(ContentKeyFunctions.SwapHands); + AddButton(ContentKeyFunctions.SwapHandsReverse); AddButton(ContentKeyFunctions.MoveStoredItem); AddButton(ContentKeyFunctions.RotateStoredItem); AddButton(ContentKeyFunctions.SaveItemLocation); diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Interactions.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Interactions.cs index 3b22917fe8..6e383cd69c 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Interactions.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Interactions.cs @@ -31,6 +31,7 @@ public abstract partial class SharedHandsSystem : EntitySystem .Bind(ContentKeyFunctions.UseItemInHand, InputCmdHandler.FromDelegate(HandleUseItem, handle: false, outsidePrediction: false)) .Bind(ContentKeyFunctions.AltUseItemInHand, InputCmdHandler.FromDelegate(HandleAltUseInHand, handle: false, outsidePrediction: false)) .Bind(ContentKeyFunctions.SwapHands, InputCmdHandler.FromDelegate(SwapHandsPressed, handle: false, outsidePrediction: false)) + .Bind(ContentKeyFunctions.SwapHandsReverse, InputCmdHandler.FromDelegate(SwapHandsReversePressed, handle: false, outsidePrediction: false)) .Bind(ContentKeyFunctions.Drop, new PointerInputCmdHandler(DropPressed)) .Register(); } @@ -79,6 +80,16 @@ public abstract partial class SharedHandsSystem : EntitySystem } private void SwapHandsPressed(ICommonSession? session) + { + SwapHands(session, false); + } + + private void SwapHandsReversePressed(ICommonSession? session) + { + SwapHands(session, true); + } + + private void SwapHands(ICommonSession? session, bool reverse) { if (!TryComp(session?.AttachedEntity, out HandsComponent? component)) return; @@ -89,8 +100,9 @@ public abstract partial class SharedHandsSystem : EntitySystem if (component.ActiveHand == null || component.Hands.Count < 2) return; - var newActiveIndex = component.SortedHands.IndexOf(component.ActiveHand.Name) + 1; - var nextHand = component.SortedHands[newActiveIndex % component.Hands.Count]; + var currentIndex = component.SortedHands.IndexOf(component.ActiveHand.Name); + var newActiveIndex = (currentIndex + (reverse ? -1 : 1) + component.Hands.Count) % component.Hands.Count; + var nextHand = component.SortedHands[newActiveIndex]; TrySetActiveHand(session.AttachedEntity.Value, nextHand, component); } diff --git a/Content.Shared/Input/ContentKeyFunctions.cs b/Content.Shared/Input/ContentKeyFunctions.cs index 76f30646b0..f10c99af2f 100644 --- a/Content.Shared/Input/ContentKeyFunctions.cs +++ b/Content.Shared/Input/ContentKeyFunctions.cs @@ -35,6 +35,7 @@ namespace Content.Shared.Input public static readonly BoundKeyFunction OpenBelt = "OpenBelt"; public static readonly BoundKeyFunction OpenAHelp = "OpenAHelp"; public static readonly BoundKeyFunction SwapHands = "SwapHands"; + public static readonly BoundKeyFunction SwapHandsReverse = "SwapHandsReverse"; public static readonly BoundKeyFunction MoveStoredItem = "MoveStoredItem"; public static readonly BoundKeyFunction RotateStoredItem = "RotateStoredItem"; public static readonly BoundKeyFunction SaveItemLocation = "SaveItemLocation"; diff --git a/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl b/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl index 357f551bc4..779f23ed93 100644 --- a/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl +++ b/Resources/Locale/en-US/escape-menu/ui/options-menu.ftl @@ -151,6 +151,7 @@ ui-options-function-alt-activate-item-in-world = Alternative activate item in wo ui-options-function-drop = Drop item ui-options-function-examine-entity = Examine ui-options-function-swap-hands = Swap hands +ui-options-function-swap-hands-reverse = Swap hands (other direction) ui-options-function-move-stored-item = Move stored item ui-options-function-rotate-stored-item = Rotate stored item ui-options-function-save-item-location = Save item location @@ -227,16 +228,16 @@ ui-options-function-hotbar7 = Hotbar slot 7 ui-options-function-hotbar8 = Hotbar slot 8 ui-options-function-hotbar9 = Hotbar slot 9 ui-options-function-hotbar0 = Hotbar slot 0 -ui-options-function-hotbarshift1 = Hotbar slot Shift+1 -ui-options-function-hotbarshift2 = Hotbar slot Shift+2 -ui-options-function-hotbarshift3 = Hotbar slot Shift+3 -ui-options-function-hotbarshift4 = Hotbar slot Shift+4 -ui-options-function-hotbarshift5 = Hotbar slot Shift+5 -ui-options-function-hotbarshift6 = Hotbar slot Shift+6 -ui-options-function-hotbarshift7 = Hotbar slot Shift+7 -ui-options-function-hotbarshift8 = Hotbar slot Shift+8 -ui-options-function-hotbarshift9 = Hotbar slot Shift+9 -ui-options-function-hotbarshift0 = Hotbar slot Shift+0 +ui-options-function-hotbar-shift1 = Hotbar slot Shift+1 +ui-options-function-hotbar-shift2 = Hotbar slot Shift+2 +ui-options-function-hotbar-shift3 = Hotbar slot Shift+3 +ui-options-function-hotbar-shift4 = Hotbar slot Shift+4 +ui-options-function-hotbar-shift5 = Hotbar slot Shift+5 +ui-options-function-hotbar-shift6 = Hotbar slot Shift+6 +ui-options-function-hotbar-shift7 = Hotbar slot Shift+7 +ui-options-function-hotbar-shift8 = Hotbar slot Shift+8 +ui-options-function-hotbar-shift9 = Hotbar slot Shift+9 +ui-options-function-hotbar-shift0 = Hotbar slot Shift+0 ui-options-function-loadout1 = Hotbar Loadout 1 ui-options-function-loadout2 = Hotbar Loadout 2 ui-options-function-loadout3 = Hotbar Loadout 3 diff --git a/Resources/keybinds.yml b/Resources/keybinds.yml index 8d4df5b92f..5c480fdc6d 100644 --- a/Resources/keybinds.yml +++ b/Resources/keybinds.yml @@ -163,6 +163,10 @@ binds: - function: SwapHands type: State key: X +- function: SwapHandsReverse + type: State + key: X + mod1: Shift - function: MoveStoredItem type: State key: MouseLeft