From 2764d677f55a53aa2a4421dd3b082fb53d649327 Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Tue, 4 Jan 2022 23:17:36 +0100 Subject: [PATCH] Added sorting to the modded bag of crafting itempool generator --- eid_bagofcrafting.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eid_bagofcrafting.lua b/eid_bagofcrafting.lua index ef833211..d8a1057e 100644 --- a/eid_bagofcrafting.lua +++ b/eid_bagofcrafting.lua @@ -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