fix Flip with non 1x1 rooms

This commit is contained in:
wakaba (aka. 미카) committed 2022-06-20 14:32:38 +09:00
1 parent df2f7db809
commit 6cedeb4a1b
1 file changed
+9 -9
+9 -9
View File
@@ -186,7 +186,7 @@ EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, EID.onNewFloor)
function EID:onSacrificeDamage(_, _, flags, source)
if EID.Config["DisplaySacrificeInfo"] and game:GetRoom():GetType() == RoomType.ROOM_SACRIFICE and source.Type == 0 and flags & DamageFlag.DAMAGE_SPIKES == DamageFlag.DAMAGE_SPIKES then
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
if EID.sacrificeCounter[curRoomIndex] == nil then
EID.sacrificeCounter[curRoomIndex] = 1
end
@@ -280,7 +280,7 @@ if REPENTANCE then
-- (it also watches for item rerolls to fill the new entity's GetData)
-- POST_NEW_ROOM then handles putting the result in the entity's GetData
local curFrame = Isaac.GetFrameCount()
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
if curFrame == lastGetItemResult[2] then
if initialItemNext then lastGetItemResult[1] = selectedCollectible
elseif flipItemNext and lastGetItemResult[1] then
@@ -316,7 +316,7 @@ if REPENTANCE then
flipItemNext = true
lastGetItemResult[4] = entity.InitSeed
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
local gridPos = game:GetRoom():GetGridIndex(entity.Position)
-- Update a Flip item's init seed after D6 rerolls or using Flip (aka Grid Index didn't change, Init Seed did)
@@ -343,7 +343,7 @@ if REPENTANCE then
-- Only pedestals with indexes that were present at room load can be flip pedestals
-- Fixes shop restock machines and Diplopia... mostly. At least while you're in the room.
if entity:GetData()["EID_FlipItemID"] and entity.Index > EID.flipMaxIndex then
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
local gridPos = game:GetRoom():GetGridIndex(entity.Position)
local flipEntry = EID.flipItemPositions[curRoomIndex] and EID.flipItemPositions[curRoomIndex][entity.InitSeed]
-- only wipe the data if the grid index matches (so Diplopia pedestals don't)
@@ -358,7 +358,7 @@ if REPENTANCE then
-- also, reload our descriptions due to transformation progress changing upon Flip
EID.ForceRefreshCache = true
lastFrameGridChecked = Isaac.GetFrameCount()
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
if EID.flipItemPositions[curRoomIndex] then
local pedestals = Isaac.FindByType(5, 100, -1, true, false)
for _, pedestal in ipairs(pedestals) do
@@ -737,7 +737,7 @@ EID.isDeathCertRoom = false
if REPENTANCE then
function EID:AssignFlipItems()
EID.flipMaxIndex = -1
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
if EID.flipItemPositions[curRoomIndex] then
local pedestals = Isaac.FindByType(5, 100, -1, true, false)
for _, pedestal in ipairs(pedestals) do
@@ -766,7 +766,7 @@ end
function EID:onNewRoom()
EID.RecentlyTouchedItems = {}
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
preHourglassStatus = {}
preHourglassStatus.SacrificeCounter = EID.sacrificeCounter[curRoomIndex]
@@ -774,7 +774,7 @@ end
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom)
function EID:WatchForGlowingHourglass()
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
EID.sacrificeCounter[curRoomIndex] = preHourglassStatus.SacrificeCounter
end
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.WatchForGlowingHourglass, CollectibleType.COLLECTIBLE_GLOWING_HOUR_GLASS)
@@ -1503,7 +1503,7 @@ local function onRender(t)
-- it will be last priority for the main spot if DisplayAllNearby is on and we aren't near them
if (#EID.descriptionsToPrint == 0 or playerNearSacrificeSpikes) or EID.Config["DisplayAllNearby"] then
if game:GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"] then
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
local curCounter = EID.sacrificeCounter[curRoomIndex] or 1
local sacrificeDesc = EID:getDescriptionObj(-999, -1, curCounter)
EID:addDescriptionToPrint(sacrificeDesc, playerNearSacrificeSpikes and 1 or nil)