fix Flip with non 1x1 rooms
This commit is contained in:
1 parent
df2f7db809
commit
6cedeb4a1b
1 file changed
+9
-9
@@ -186,7 +186,7 @@ EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, EID.onNewFloor)
|
|||||||
|
|
||||||
function EID:onSacrificeDamage(_, _, flags, source)
|
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
|
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
|
if EID.sacrificeCounter[curRoomIndex] == nil then
|
||||||
EID.sacrificeCounter[curRoomIndex] = 1
|
EID.sacrificeCounter[curRoomIndex] = 1
|
||||||
end
|
end
|
||||||
@@ -280,7 +280,7 @@ if REPENTANCE then
|
|||||||
-- (it also watches for item rerolls to fill the new entity's GetData)
|
-- (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
|
-- POST_NEW_ROOM then handles putting the result in the entity's GetData
|
||||||
local curFrame = Isaac.GetFrameCount()
|
local curFrame = Isaac.GetFrameCount()
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
|
||||||
if curFrame == lastGetItemResult[2] then
|
if curFrame == lastGetItemResult[2] then
|
||||||
if initialItemNext then lastGetItemResult[1] = selectedCollectible
|
if initialItemNext then lastGetItemResult[1] = selectedCollectible
|
||||||
elseif flipItemNext and lastGetItemResult[1] then
|
elseif flipItemNext and lastGetItemResult[1] then
|
||||||
@@ -316,7 +316,7 @@ if REPENTANCE then
|
|||||||
flipItemNext = true
|
flipItemNext = true
|
||||||
lastGetItemResult[4] = entity.InitSeed
|
lastGetItemResult[4] = entity.InitSeed
|
||||||
|
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
|
||||||
local gridPos = game:GetRoom():GetGridIndex(entity.Position)
|
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)
|
-- 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
|
-- 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.
|
-- 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
|
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 gridPos = game:GetRoom():GetGridIndex(entity.Position)
|
||||||
local flipEntry = EID.flipItemPositions[curRoomIndex] and EID.flipItemPositions[curRoomIndex][entity.InitSeed]
|
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)
|
-- 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
|
-- also, reload our descriptions due to transformation progress changing upon Flip
|
||||||
EID.ForceRefreshCache = true
|
EID.ForceRefreshCache = true
|
||||||
lastFrameGridChecked = Isaac.GetFrameCount()
|
lastFrameGridChecked = Isaac.GetFrameCount()
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
|
||||||
if EID.flipItemPositions[curRoomIndex] then
|
if EID.flipItemPositions[curRoomIndex] then
|
||||||
local pedestals = Isaac.FindByType(5, 100, -1, true, false)
|
local pedestals = Isaac.FindByType(5, 100, -1, true, false)
|
||||||
for _, pedestal in ipairs(pedestals) do
|
for _, pedestal in ipairs(pedestals) do
|
||||||
@@ -737,7 +737,7 @@ EID.isDeathCertRoom = false
|
|||||||
if REPENTANCE then
|
if REPENTANCE then
|
||||||
function EID:AssignFlipItems()
|
function EID:AssignFlipItems()
|
||||||
EID.flipMaxIndex = -1
|
EID.flipMaxIndex = -1
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
|
||||||
if EID.flipItemPositions[curRoomIndex] then
|
if EID.flipItemPositions[curRoomIndex] then
|
||||||
local pedestals = Isaac.FindByType(5, 100, -1, true, false)
|
local pedestals = Isaac.FindByType(5, 100, -1, true, false)
|
||||||
for _, pedestal in ipairs(pedestals) do
|
for _, pedestal in ipairs(pedestals) do
|
||||||
@@ -766,7 +766,7 @@ end
|
|||||||
function EID:onNewRoom()
|
function EID:onNewRoom()
|
||||||
EID.RecentlyTouchedItems = {}
|
EID.RecentlyTouchedItems = {}
|
||||||
|
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
|
||||||
preHourglassStatus = {}
|
preHourglassStatus = {}
|
||||||
|
|
||||||
preHourglassStatus.SacrificeCounter = EID.sacrificeCounter[curRoomIndex]
|
preHourglassStatus.SacrificeCounter = EID.sacrificeCounter[curRoomIndex]
|
||||||
@@ -774,7 +774,7 @@ end
|
|||||||
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom)
|
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom)
|
||||||
|
|
||||||
function EID:WatchForGlowingHourglass()
|
function EID:WatchForGlowingHourglass()
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomIndex()
|
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
|
||||||
EID.sacrificeCounter[curRoomIndex] = preHourglassStatus.SacrificeCounter
|
EID.sacrificeCounter[curRoomIndex] = preHourglassStatus.SacrificeCounter
|
||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.WatchForGlowingHourglass, CollectibleType.COLLECTIBLE_GLOWING_HOUR_GLASS)
|
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
|
-- 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 (#EID.descriptionsToPrint == 0 or playerNearSacrificeSpikes) or EID.Config["DisplayAllNearby"] then
|
||||||
if game:GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"] 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 curCounter = EID.sacrificeCounter[curRoomIndex] or 1
|
||||||
local sacrificeDesc = EID:getDescriptionObj(-999, -1, curCounter)
|
local sacrificeDesc = EID:getDescriptionObj(-999, -1, curCounter)
|
||||||
EID:addDescriptionToPrint(sacrificeDesc, playerNearSacrificeSpikes and 1 or nil)
|
EID:addDescriptionToPrint(sacrificeDesc, playerNearSacrificeSpikes and 1 or nil)
|
||||||
|
|||||||
Reference in new issue
Block a user