53 lines
1.4 KiB
Lua
53 lines
1.4 KiB
Lua
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 not character then
|
|
print("No character found")
|
|
return
|
|
end
|
|
local inventory = character.Inventory
|
|
if not inventory then
|
|
print("No inventory found")
|
|
return
|
|
end
|
|
|
|
local bagSlotIndex = inventory.FindLimbSlot(InvSlotType.Bag)
|
|
if bagSlotIndex < 0 then
|
|
print("No bag slot found")
|
|
return
|
|
end
|
|
|
|
local bagItem = inventory.GetItemAt(bagSlotIndex)
|
|
if not bagItem then
|
|
print("No bag item found")
|
|
return
|
|
end
|
|
local bagInventrory = bagItem.OwnInventory
|
|
if not bagInventrory then
|
|
print("No bag inventory found")
|
|
return
|
|
end
|
|
|
|
local items = bagInventrory.AllItemsMod
|
|
for _, item in ipairs(items) do
|
|
---@cast item Barotrauma.Item
|
|
print(item.Name)
|
|
print(item.Tags)
|
|
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)
|