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);
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);
AddButton(ContentKeyFunctions.Drop);
AddButton(ContentKeyFunctions.ExamineEntity);
AddButton(ContentKeyFunctions.SwapHands);
+ AddButton(ContentKeyFunctions.SwapHandsReverse);
AddButton(ContentKeyFunctions.MoveStoredItem);
AddButton(ContentKeyFunctions.RotateStoredItem);
AddButton(ContentKeyFunctions.SaveItemLocation);
.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<SharedHandsSystem>();
}
}
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;
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);
}
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";
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
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
- function: SwapHands
type: State
key: X
+- function: SwapHandsReverse
+ type: State
+ key: X
+ mod1: Shift
- function: MoveStoredItem
type: State
key: MouseLeft