Don't move ammo out of tools and weapons from main bar
This commit is contained in:
@@ -364,7 +364,9 @@ local function tryBuildItemTree(inventory)
|
||||
end
|
||||
|
||||
-- Function to quickly stack items from inventory to containers
|
||||
local inventorySlotsToStack = {}
|
||||
-- 6 and 7 are hands
|
||||
-- 9..18 are main slots
|
||||
local inventorySlotsToStack = { 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }
|
||||
local function quickStackItems(character)
|
||||
if not character then
|
||||
debugPrint("No character found")
|
||||
@@ -387,7 +389,37 @@ local function quickStackItems(character)
|
||||
itemTree = sortItemtreeBySlots(itemTree)
|
||||
local toMove = {}
|
||||
|
||||
-- toMove = enqueueInventory(inventory, toMove)
|
||||
for i, slot in ipairs(inventory.slots) do
|
||||
if #slot.items > 0 then
|
||||
local item = slot.items[1]
|
||||
local identifier = item.Prefab.Identifier.Value
|
||||
print(string.format("Item at slot %d is %s", i, identifier))
|
||||
end
|
||||
end
|
||||
|
||||
for _, slotid in ipairs(inventorySlotsToStack) do
|
||||
debugPrint("Processing inventory slot: " .. slotid)
|
||||
local slot = inventory.slots[slotid]
|
||||
if #slot.items > 0 then
|
||||
local item = slot.items[1]
|
||||
local tags = item.Prefab.Tags
|
||||
local shouldSuss = true
|
||||
for tag in tags do
|
||||
if tag.value:find("tool") or tag.value:find("weapon") then
|
||||
debugPrint("Item is a tool or weapon, skipping")
|
||||
shouldSuss = false
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if shouldSuss then
|
||||
local before = #toMove
|
||||
toMove = enqueueSlot(slot, toMove)
|
||||
local after = #toMove
|
||||
debugPrint("Enqueued " .. after - before .. " items from the inventory slot " .. slotid)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local openContainers = getOpenContainers()
|
||||
for _, container in ipairs(openContainers) do
|
||||
|
||||
Reference in New Issue
Block a user