Added sorting to the modded bag of crafting itempool generator

This commit is contained in:
Wofsauge committed 2022-01-04 23:17:36 +01:00
1 parent 75610f2cab
commit 2764d677f5
1 file changed
+9 -1
+9 -1
View File
@@ -509,11 +509,19 @@ local function GameStartCrafting()
for i=1,EID.XMLMaxItemID do itemPool:AddRoomBlacklist(i) end
local collID = itemPool:GetCollectible(poolNum, false, 1, 25)
local idsToAdd = {}
while collID ~= 25 do
table.insert(CraftingItemPools[poolNum+1], {collID, 1.0})
table.insert(idsToAdd, {collID, 1.0})
itemPool:AddRoomBlacklist(collID)
collID = itemPool:GetCollectible(poolNum, false, 1, 25)
end
-- sort ids since thats the most likely way people add items to the itempool
table.sort(idsToAdd, function (a,b)
return a[1] < b[1]
end)
for _,v in ipairs(idsToAdd) do
table.insert(CraftingItemPools[poolNum+1], v)
end
itemPool:ResetRoomBlacklist()
end