Arrow now flips in mirror world

This commit is contained in:
Buurazu authored and GitHub committed 2021-11-19 19:15:05 -05:00
1 parent 372863f986
commit 6b31f35aea
1 file changed
+8 -17
+8 -17
View File
@@ -374,20 +374,9 @@ function EID:printBulletPoints(description, renderPos)
end end
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
---------------------------Handle New Room-------------------------------- ---------------------------Handle New Room--------------------------------
local function IsMirror()
local level = game:GetLevel()
local id = level:GetCurrentRoomIndex()
return id >=0 and GetPtrHash(level:GetRoomByIdx(id)) == GetPtrHash(level:GetRoomByIdx(id, 1))
end
local isMirrorRoom = false local isMirrorRoom = false
function EID:onNewRoom() function EID:onNewRoom()
if game:GetLevel():GetAbsoluteStage() == LevelStage.STAGE1_2 then isMirrorRoom = game:GetLevel():GetCurrentRoom():IsMirrorWorld()
isMirrorRoom = IsMirror()
else
isMirrorRoom = false
end
end end
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom) EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
@@ -405,6 +394,11 @@ function EID:renderIndicator(entity)
end end
local repDiv = 1 local repDiv = 1
local entityPos = Isaac.WorldToScreen(entity.Position) local entityPos = Isaac.WorldToScreen(entity.Position)
local ArrowOffset = Vector(0, -35)
if entity.Variant == 100 and not entity:ToPickup():IsShopItem() then
ArrowOffset = Vector(0, -62)
end
local arrowPos = Isaac.WorldToScreen(entity.Position + ArrowOffset)
if entity:GetData() and entity:GetData()["EID_RenderOffset"] then if entity:GetData() and entity:GetData()["EID_RenderOffset"] then
entityPos = entityPos + entity:GetData()["EID_RenderOffset"] entityPos = entityPos + entity:GetData()["EID_RenderOffset"]
end end
@@ -414,6 +408,7 @@ function EID:renderIndicator(entity)
if isMirrorRoom then if isMirrorRoom then
local screenCenter = EID:getScreenSize()/2 local screenCenter = EID:getScreenSize()/2
entityPos.X = entityPos.X - (entityPos-screenCenter).X * 2 entityPos.X = entityPos.X - (entityPos-screenCenter).X * 2
arrowPos.X = arrowPos.X - (arrowPos-screenCenter).X * 2
sprite.FlipX = true sprite.FlipX = true
end end
end end
@@ -424,11 +419,7 @@ function EID:renderIndicator(entity)
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0) sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
elseif EID.Config["Indicator"] == "arrow" then elseif EID.Config["Indicator"] == "arrow" then
ArrowSprite:Update() ArrowSprite:Update()
local ArrowOffset = Vector(0, -35) ArrowSprite:Render(arrowPos, nullVector, nullVector)
if entity.Variant == 100 and not entity:ToPickup():IsShopItem() then
ArrowOffset = Vector(0, -62)
end
ArrowSprite:Render(Isaac.WorldToScreen(entity.Position + ArrowOffset), nullVector, nullVector)
else else
if EID.Config["Indicator"] == "border" then if EID.Config["Indicator"] == "border" then
local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40)) local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40))