Replace calls to utils for factored out functions
This commit is contained in:
@@ -146,7 +146,13 @@ local function tryStackFabricator(character)
|
||||
-- dump(itemsOnSubmarine)
|
||||
-- MyModGlobal.DumpTable(toGet)
|
||||
|
||||
local items = utils.enqueueInventory(bagItem.OwnInventory, {}, filter)
|
||||
local items, _ = utils.enqueueAllOwnedItems({}, filter)
|
||||
-- if err then
|
||||
-- print(string.format("Error enqueueing all owned items: %s", err))
|
||||
-- return
|
||||
-- end
|
||||
-- dump(items)
|
||||
|
||||
-- MyModGlobal.DumpTable(items)
|
||||
-- TODO: This might explode... Oh well?
|
||||
local inputInventory = fabricator.item.OwnInventories[1]
|
||||
@@ -157,49 +163,6 @@ local function tryStackFabricator(character)
|
||||
end
|
||||
end
|
||||
|
||||
-- If we looked at all items we have on person and still are missing some
|
||||
-- Look at all the items on the submarine
|
||||
local hasAny = false
|
||||
for _, itemInfo in pairs(toFind) do
|
||||
if itemInfo.amount > 0 then
|
||||
hasAny = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if hasAny then
|
||||
local submarine = character.Submarine
|
||||
local found
|
||||
if not submarine then
|
||||
MyModGlobal.debugPrint("Submarine not found.")
|
||||
goto done
|
||||
end
|
||||
for item in submarine.GetItems(false) do
|
||||
if remaining == 0 then goto done end
|
||||
for i, itemInfo in pairs(toFind) do
|
||||
found = false
|
||||
for _, prefab in ipairs(itemInfo.prefabs) do
|
||||
-- MyModGlobal.debugPrint(string.format("Checking %s against %s", item.Prefab.Identifier.Value, prefab))
|
||||
if tostring(item.Prefab.Identifier.Value) == prefab then
|
||||
-- MyModGlobal.debugPrint(string.format("That'll do %s %s", item.Prefab.Identifier.Value, prefab))
|
||||
items[#items + 1] = item
|
||||
itemInfo.amount = itemInfo.amount - 1
|
||||
found = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if itemInfo.amount <= 0 then
|
||||
-- MyModGlobal.debugPrint(string.format("Removing %s from toFind", itemInfo.prefabs[1]))
|
||||
toFind[i] = nil
|
||||
remaining = remaining - 1
|
||||
end
|
||||
if found then break end
|
||||
end
|
||||
end
|
||||
|
||||
::done::
|
||||
end
|
||||
|
||||
local slot = -1
|
||||
local previous = nil
|
||||
for _, item in ipairs(items) do
|
||||
|
||||
Reference in New Issue
Block a user