Bag of Crafting: Curse of Maze room switch is now properly handled in pickup tracker

This commit is contained in:
Wofsauge committed 2023-06-30 23:44:11 +02:00
1 parent 0a378e5b1b
commit 27862c5e6a
2 files changed
+34 -7

No files matched your search

+33 -7
View File
@@ -503,8 +503,8 @@ local function calcHeldItems()
end
local function calcFloorItems()
EID.BoC.FloorQuery = {}
for _,v in pairs(EID.BoC.RoomQueries) do
for _,v1 in ipairs(v) do
for _,roomQuery in pairs(EID.BoC.RoomQueries) do
for _,v1 in ipairs(roomQuery[1]) do
table.insert(EID.BoC.FloorQuery, v1)
end
end
@@ -696,9 +696,9 @@ local function combinations(arr, length, startPos, tempResult, randResults, newR
coroutine.yield()
coTimer = Isaac.GetTime()
end
local length = length or 8
local startPos = startPos or 1
local tempResult = tempResult or {}
length = length or 8
startPos = startPos or 1
tempResult = tempResult or {}
if (length == 0) then
local resultString = table.concat(tempResult,",")
if (randResults[resultString] == nil) then
@@ -880,6 +880,32 @@ local function RecipeCrunchCoroutine()
EID.RefreshBagTextbox = true
end
function EID:BOCHandleCurseOfMaze()
-- switches tracked room contents when rooms are switched by curse of maze
if game:GetLevel():GetCurses() & LevelCurse.CURSE_OF_MAZE ~= LevelCurse.CURSE_OF_MAZE then
return
end
local rooms = game:GetLevel():GetRooms()
local changedRooms = {}
for i = 0, rooms.Size - 1 do
local roomDesc = rooms:Get(i)
if roomDesc and roomDesc.Data then
local savedRoomContent = EID.BoC.RoomQueries[roomDesc.ListIndex .. ""]
if not savedRoomContent then
EID.BoC.RoomQueries[roomDesc.ListIndex .. ""] = { {}, roomDesc.Data.Variant }
end
if savedRoomContent and savedRoomContent[2] ~= roomDesc.Data.Variant then
table.insert(changedRooms, roomDesc.ListIndex)
end
end
end
if #changedRooms >= 2 then
local temp = EID.BoC.RoomQueries[changedRooms[2] .. ""]
EID.BoC.RoomQueries[changedRooms[2] .. ""] = EID.BoC.RoomQueries[changedRooms[1] .. ""]
EID.BoC.RoomQueries[changedRooms[1] .. ""] = temp
end
end
local prevOffset = 0
-- Called 60 times a second so we can read input properly
function EID:handleBagOfCraftingUpdating()
@@ -1015,13 +1041,13 @@ function EID:handleBagOfCraftingRendering(ignoreRefreshRate)
end
end
end
EID.BoC.RoomQueries[curRoomIndex..""] = roomItems
EID.BoC.RoomQueries[curRoomIndex .. ""] = { roomItems, game:GetLevel():GetCurrentRoomDesc().Data.Variant }
EID.BoC.CurrentPickupCount = #pickups
calcHeldItems()
calcFloorItems()
EID.RefreshBagTextbox = true
else
roomItems = EID.BoC.RoomQueries[curRoomIndex..""] or {}
roomItems = EID.BoC.RoomQueries[curRoomIndex .. ""] and EID.BoC.RoomQueries[curRoomIndex .. ""][1] or {}
end
itemQuery = {}
+1
View File
@@ -764,6 +764,7 @@ if EID.isRepentance then
local level = game:GetLevel()
EID.isMirrorRoom = level:GetCurrentRoom():IsMirrorWorld()
EID.isDeathCertRoom = EID:GetDimension(level) == 2
EID:BOCHandleCurseOfMaze()
-- Handle Flip Item
initialItemNext = false