small code improvements
This commit is contained in:
1 parent
a120a6c693
commit
830d7b7fd6
2 files changed
+8
-6
No files matched your search
@@ -2931,15 +2931,16 @@ function EID:WatchForGlitchedCrown()
|
||||
|
||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
||||
EID.GlitchedCrownCheck[curRoomIndex] = EID.GlitchedCrownCheck[curRoomIndex] or {}
|
||||
|
||||
|
||||
for _, entity in ipairs(Isaac.FindByType(5, 100, -1, true, false)) do
|
||||
local index = entity.InitSeed..entity.Index
|
||||
-- Use InitSeed and Index to prevent any Diplopia weirdness
|
||||
EID.GlitchedCrownCheck[curRoomIndex][entity.InitSeed..entity.Index] = EID.GlitchedCrownCheck[curRoomIndex][entity.InitSeed..entity.Index] or {}
|
||||
EID.GlitchedCrownCheck[curRoomIndex][index] = EID.GlitchedCrownCheck[curRoomIndex][index] or {}
|
||||
-- Initialize the data about this pedestal showing its current item ID, if necessary
|
||||
-- in order to sort the items displayed, while also trashing items that haven't shown up in a while, keep both "initial frame seen" and "last frame seen"
|
||||
EID.GlitchedCrownCheck[curRoomIndex][entity.InitSeed..entity.Index][entity.SubType] = EID.GlitchedCrownCheck[curRoomIndex][entity.InitSeed..entity.Index][entity.SubType] or {EID.GameUpdateCount, EID.GameUpdateCount}
|
||||
EID.GlitchedCrownCheck[curRoomIndex][index][entity.SubType] = EID.GlitchedCrownCheck[curRoomIndex][index][entity.SubType] or {EID.GameUpdateCount, EID.GameUpdateCount}
|
||||
-- update the last frame seen for the pedestal's current collectible ID
|
||||
EID.GlitchedCrownCheck[curRoomIndex][entity.InitSeed..entity.Index][entity.SubType][2] = EID.GameUpdateCount
|
||||
EID.GlitchedCrownCheck[curRoomIndex][index][entity.SubType][2] = EID.GameUpdateCount
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -919,11 +919,12 @@ if EID.isRepentance then
|
||||
if not descObj.Entity or inGlitchedCrown then return descObj end
|
||||
local entity = descObj.Entity
|
||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
||||
local pedestalID = descObj.Entity.InitSeed .. descObj.Entity.Index
|
||||
|
||||
if EID.GlitchedCrownCheck[curRoomIndex] and EID.GlitchedCrownCheck[curRoomIndex][descObj.Entity.InitSeed .. descObj.Entity.Index] then
|
||||
if EID.GlitchedCrownCheck[curRoomIndex] and EID.GlitchedCrownCheck[curRoomIndex][pedestalID] then
|
||||
-- this table has collectible ID keys that define the first frame and most recent frame that that ID has been seen on this pedestal
|
||||
-- we need to filter out items that haven't been seen in a while (due to a reroll perhaps), then sort by first frame
|
||||
local pedestalID = descObj.Entity.InitSeed .. descObj.Entity.Index
|
||||
|
||||
local items = EID.GlitchedCrownCheck[curRoomIndex][pedestalID]
|
||||
local sortedItems = {}
|
||||
for id, frames in pairs(items) do
|
||||
|
||||
Reference in new issue
Block a user