The Binding of Isaac: Rebirth

The Binding of Isaac: Rebirth

True SpiderMod NEW
Stlkngne 15 Jun, 2021 @ 2:30am
Mirror Dimension
Here's one way to tell if you're in the mirror dimension:

local mod = RegisterMod('zTest2', 1) local isMirrorDimension = false -- In the mirror dimension, shootingX at rest shows up as -0.0 instead of 0.0 function mod:testRender() local player = Game():GetPlayer(0) local leftValue = Input.GetActionValue(ButtonAction.ACTION_SHOOTLEFT, player.ControllerIndex) local rightValue = Input.GetActionValue(ButtonAction.ACTION_SHOOTRIGHT, player.ControllerIndex) local shootingX = player:GetShootingInput().X local sx = (leftValue * -1) + rightValue if (shootingX < 0 and sx > 0) or (shootingX > 0 and sx < 0) or tostring(shootingX) == '-0.0' then isMirrorDimension = true else isMirrorDimension = false end Isaac.RenderText('isMirrorDimension: ' .. tostring(isMirrorDimension), 50, 30, 1, 1, 1, 255) end mod:AddCallback(ModCallbacks.MC_POST_RENDER, mod.testRender)

Another (slightly more fragile) way is to subscribe to MC_POST_NEW_ROOM and pay attention to the room index. If you move to a new room on downpoor/dross 2 and the room index stays the same then you've gone through the mirror.

It also looks like there's a related open issue here: https://github.com/Meowlala/RepentanceAPIIssueTracker/issues/182
< >
Showing 1-6 of 6 comments
Stlkngne 17 Jun, 2021 @ 11:39pm 
Here's an updated example that seems to position things correctly in the mirror dimension:
local mod = RegisterMod('zTest2', 1) local isMirrorDimension = false -- In the mirror dimension, shootingX at rest shows up as -0.0 instead of 0.0 function mod:testRender() local player = Game():GetPlayer(0) local leftValue = Input.GetActionValue(ButtonAction.ACTION_SHOOTLEFT, player.ControllerIndex) local rightValue = Input.GetActionValue(ButtonAction.ACTION_SHOOTRIGHT, player.ControllerIndex) local shootingX = player:GetShootingInput().X local sx = (leftValue * -1) + rightValue if (shootingX < 0 and sx > 0) or (shootingX > 0 and sx < 0) or tostring(shootingX) == '-0.0' then isMirrorDimension = true else isMirrorDimension = false end local wtrp320x280 = Isaac.WorldToRenderPosition(Vector(320, 280)) -- center pos normal room, WorldToRenderPosition makes this work in large rooms too local screenpos = Isaac.WorldToScreen(player.Position) if isMirrorDimension then Isaac.RenderText('hello', wtrp320x280.X*2 - screenpos.X, screenpos.Y, 1, 1, 1, 1) else Isaac.RenderText('hello', screenpos.X, screenpos.Y, 1, 1, 1, 1) end end mod:AddCallback(ModCallbacks.MC_POST_RENDER, mod.testRender)

It seemed to work when I hacked it into this mod's code.
Teathling  [developer] 18 Jun, 2021 @ 2:16am 
Thank you very much for the potential fix I don't really know how you added this to my code do you mind showing me?
Stlkngne 18 Jun, 2021 @ 7:58pm 
The first step is to figure out if you're in the mirror dimension:
local isMirrorDimension = false local player = Game():GetPlayer(0) local leftValue = Input.GetActionValue(ButtonAction.ACTION_SHOOTLEFT, player.ControllerIndex) local rightValue = Input.GetActionValue(ButtonAction.ACTION_SHOOTRIGHT, player.ControllerIndex) local shootingX = player:GetShootingInput().X local sx = (leftValue * -1) + rightValue if (shootingX < 0 and sx > 0) or (shootingX > 0 and sx < 0) or tostring(shootingX) == '-0.0' then isMirrorDimension = true else isMirrorDimension = false end
This was based off of the github link above.

When you draw something to the screen in the mirror dimension you need to invert the X value in some way. I tried a bunch of different things, but this was the only value I found that was consistent in all room types. I assume it has something to do with how the mirroring is implemented.
local wtrp320x280 = Isaac.WorldToRenderPosition(Vector(320, 280)) -- center pos normal room, WorldToRenderPosition makes this work in large rooms too

In the mirror dimension, instead of using the X value directly, you subtract it like so:
wtrp320x280.X*2 - yourObject.X

An example from your code would be changing this from
trueSpiderModFontHealthBar:DrawStringScaled("|", screenpos.X - ((healthPercent * TRUESPIDERMODSettings["HealthBarLength"] - preventOversizedHB) * 2), screenpos.Y + (screenOffset.Y * 0.75), (healthPercent * TRUESPIDERMODSettings["HealthBarLength"] - preventOversizedHB) + bossHP, TRUESPIDERMODSettings["HealthBarWidth"] + bossHP, KColor(1, 0, 0, vulAlpha * TRUESPIDERMODSettings["HealthBarOpacity"]), 0, true)

to
trueSpiderModFontHealthBar:DrawStringScaled("|", wtrp320x280.X*2 - screenpos.X - ((healthPercent * TRUESPIDERMODSettings["HealthBarLength"] - preventOversizedHB) * 2), screenpos.Y + (screenOffset.Y * 0.75), (healthPercent * TRUESPIDERMODSettings["HealthBarLength"] - preventOversizedHB) + bossHP, TRUESPIDERMODSettings["HealthBarWidth"] + bossHP, KColor(1, 0, 0, vulAlpha * TRUESPIDERMODSettings["HealthBarOpacity"]), 0, true)

I haven't tried with all of your settings, so this might need to be tweaked a little.

All of this appears to be needed if you're within MC_POST_RENDER.

I noticed some of your code uses MC_POST_EFFECT_RENDER which doesn't seem to need this workaround. It positions things correctly, but mirrored, if in the mirror dimension. That might be something else to explore.
Last edited by Stlkngne; 18 Jun, 2021 @ 8:16pm
Stlkngne 15 Jan, 2022 @ 5:38pm 
Room now has an "IsMirrorWorld" method to check if you're in the mirror dimension. You can check how I made use of it in my "5 Second Challenge" mod.
Stlkngne 26 Mar, 2022 @ 5:19am 
Here's an actual fix.

On line 400 there's this:
local screenpos = Isaac.WorldToScreen(entity.Position)

On the next line, add this:
if REPENTANCE then if game:GetRoom():IsMirrorWorld() then screenpos.X = Isaac.WorldToRenderPosition(Vector(320, 280)).X*2 - screenpos.X end end
Teathling  [developer] 8 May, 2022 @ 3:41am 
Originally posted by Stlkngne:
Here's an actual fix.

On line 400 there's this:
local screenpos = Isaac.WorldToScreen(entity.Position)

On the next line, add this:
if REPENTANCE then if game:GetRoom():IsMirrorWorld() then screenpos.X = Isaac.WorldToRenderPosition(Vector(320, 280)).X*2 - screenpos.X end end
thanks for the help update has been released sorry for the delay
< >
Showing 1-6 of 6 comments
Per page: 1530 50