Update
This commit is contained in:
21
Quick Swap Hand~Bag/Lua/Autorun/init.lua
Normal file
21
Quick Swap Hand~Bag/Lua/Autorun/init.lua
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user