This commit is contained in:
2025-03-29 19:17:12 +01:00
parent 463b979a14
commit 2dcbc9db7e

View File

@@ -1,52 +1,58 @@
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)
-- 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 bagItems = {}
-- -- local items = bagInventrory.AllItemsMod
-- -- for _, item in ipairs(items) do
-- -- ---@cast item Barotrauma.Item
-- -- bagItems[item.Name] = true
-- -- end
--
-- -- local inventoryItems = inventory.AllItemsMod
-- -- for _, item in ipairs(inventoryItems) do
-- -- if bagItems[item.Name] then
-- -- end
-- -- 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)