From 653c8f77a5d1292302feb9b58a10a5e3f201d10c Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sat, 29 Mar 2025 18:16:21 +0100 Subject: [PATCH] Update --- Quick Swap Hand~Bag/Lua/Autorun/init.lua | 21 +++++++++++++++++++++ Quick Swap Hand~Bag/filelist.xml | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 Quick Swap Hand~Bag/Lua/Autorun/init.lua create mode 100644 Quick Swap Hand~Bag/filelist.xml diff --git a/Quick Swap Hand~Bag/Lua/Autorun/init.lua b/Quick Swap Hand~Bag/Lua/Autorun/init.lua new file mode 100644 index 0000000..5d9c408 --- /dev/null +++ b/Quick Swap Hand~Bag/Lua/Autorun/init.lua @@ -0,0 +1,21 @@ +if not CLIENT then return end + +Hook.Add("keyUpdate", "quickswap_bag~hand", function() + if not PlayerInput.KeyHit(Keys.LeftAlt) then return end + if GUI.KeyboardDispatcher.Subscriber then return end + local character = Character.Controlled; if character == nil then return end + local inventory = character.Inventory; if inventory == nil then return end + local bagSlotIndex = inventory.FindLimbSlot(InvSlotType.Bag); if bagSlotIndex < 0 then return end + for handItem in character.HeldItems do + if inventory.TryPutItem(handItem, bagSlotIndex, true, false, character) then + return + end + end + local bagItem = inventory.GetItemAt(bagSlotIndex); if bagItem == nil then return end + for _, handSlotType in ipairs { InvSlotType.LeftHand, InvSlotType.RightHand } do + local handSlotIndex = inventory.FindLimbSlot(handSlotType) + if handSlotIndex >= 0 then + if inventory.TryPutItem(bagItem, handSlotIndex, true, false, character) then return end + end + end +end) diff --git a/Quick Swap Hand~Bag/filelist.xml b/Quick Swap Hand~Bag/filelist.xml new file mode 100644 index 0000000..0011e36 --- /dev/null +++ b/Quick Swap Hand~Bag/filelist.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file