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