Rep patch: Locked recipes no longer ignore unlock status

This commit is contained in:
Buurazu authored and GitHub committed 2022-03-21 21:24:52 -04:00
1 parent 30bab0bdb3
commit 27fad7d0c2
1 file changed
+9 -4
+9 -4
View File
@@ -358,10 +358,15 @@ function EID:calculateBagOfCrafting(componentsTable)
table.sort(components) table.sort(components)
local componentsAsString = table.concat(components, ",") local componentsAsString = table.concat(components, ",")
-- Check the fixed recipes. Currently, the fixed recipes ignore item unlock status -- Check the fixed recipes
local fixedRecipeResult = nil
local cacheResult = CraftingFixedRecipes[componentsAsString] local cacheResult = CraftingFixedRecipes[componentsAsString]
if cacheResult ~= nil then if cacheResult ~= nil then
return cacheResult, cacheResult if EID:isCollectibleUnlockedAnyPool(cacheResult) then
return cacheResult, cacheResult
else
fixedRecipeResult = cacheResult
end
end end
-- Check the recipes already calculated for this seed -- Check the recipes already calculated for this seed
cacheResult = calculatedRecipes[componentsAsString] cacheResult = calculatedRecipes[componentsAsString]
@@ -453,9 +458,9 @@ function EID:calculateBagOfCrafting(componentsTable)
end end
--When the first crafting result is an achievement locked item, this process gets repeated a second time to choose a new result --When the first crafting result is an achievement locked item, this process gets repeated a second time to choose a new result
--That 2nd pick could also be achievement locked but we're ignoring that... --That 2nd pick could also be achievement locked but we're ignoring that...
local firstOption = nil local firstOption = fixedRecipeResult
while true do while true do
local t = nextFloat() -- number between 0 and 1 local t = nextFloat() -- random number between 0 and 1
local target = t * totalWeight -- number between 0 and total weight of possible results local target = t * totalWeight -- number between 0 and total weight of possible results
for k,v in ipairs(itemWeights) do for k,v in ipairs(itemWeights) do
target = target - v target = target - v