Fix EIDConfig["YPosition"] not working
`posY` was changed into a function to dynamically return the position. `modifiedPosY` was introduced for when the code detects the player has the school bag and needs to move the hud down.
This commit is contained in:
1 parent
ba85601491
commit
75b98a89ad
1 file changed
+14
-11
@@ -125,11 +125,14 @@ end
|
|||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
---------------------------Printing Functions------------------------------
|
---------------------------Printing Functions------------------------------
|
||||||
local itemTypes= {"null","passive","active","familiar","trinket"}
|
local itemTypes= {"null","passive","active","familiar","trinket"}
|
||||||
local posY=EIDConfig["YPosition"]
|
local modifiedPosY = false -- When the player has the schoolbag it changes
|
||||||
|
local function posY()
|
||||||
|
return modifiedPosY ~= false and modifiedPosY or EIDConfig["YPosition"]
|
||||||
|
end
|
||||||
|
|
||||||
function printDescription(desc)
|
function printDescription(desc)
|
||||||
local Description = desc[3]
|
local Description = desc[3]
|
||||||
local padding = posY
|
local padding = posY()
|
||||||
local itemType = itemConfig:GetCollectible(desc[1]).Type
|
local itemType = itemConfig:GetCollectible(desc[1]).Type
|
||||||
|
|
||||||
--Display ItemType / Charge
|
--Display ItemType / Charge
|
||||||
@@ -188,7 +191,7 @@ end
|
|||||||
|
|
||||||
function printTrinketDescription(desc,typ)
|
function printTrinketDescription(desc,typ)
|
||||||
local Description = desc[2]
|
local Description = desc[2]
|
||||||
local padding = posY
|
local padding = posY()
|
||||||
--Display Itemname
|
--Display Itemname
|
||||||
if EIDConfig["ShowItemName"] then
|
if EIDConfig["ShowItemName"] then
|
||||||
local name= ""
|
local name= ""
|
||||||
@@ -271,8 +274,8 @@ function renderQuestionMark()
|
|||||||
IconSprite:Play("CurseOfBlind")
|
IconSprite:Play("CurseOfBlind")
|
||||||
IconSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"])
|
IconSprite.Scale = Vector(EIDConfig["Scale"],EIDConfig["Scale"])
|
||||||
IconSprite:Update()
|
IconSprite:Update()
|
||||||
IconSprite:Render(Vector(EIDConfig["XPosition"]+5*EIDConfig["Scale"],posY+5*EIDConfig["Scale"]), Vector(0,0), Vector(0,0))
|
IconSprite:Render(Vector(EIDConfig["XPosition"]+5*EIDConfig["Scale"],posY()+5*EIDConfig["Scale"]), Vector(0,0), Vector(0,0))
|
||||||
if Isaac.GetPlayer(0):HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG)then posY =EIDConfig["YPosition"] -30 end
|
if Isaac.GetPlayer(0):HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG)then modifiedPosY =EIDConfig["YPosition"] -30 end
|
||||||
end
|
end
|
||||||
|
|
||||||
function renderIndicator(entity)
|
function renderIndicator(entity)
|
||||||
@@ -422,7 +425,7 @@ local function onRender(t)
|
|||||||
CardSprite:Update()
|
CardSprite:Update()
|
||||||
local offsetX = 0
|
local offsetX = 0
|
||||||
if EIDConfig["ShowItemName"] then offsetX = 10 end
|
if EIDConfig["ShowItemName"] then offsetX = 10 end
|
||||||
CardSprite:Render(Vector(EIDConfig["XPosition"]-9*EIDConfig["Scale"],posY+(12+offsetX)*EIDConfig["Scale"]), Vector(0,0), Vector(0,0))
|
CardSprite:Render(Vector(EIDConfig["XPosition"]-9*EIDConfig["Scale"],posY()+(12+offsetX)*EIDConfig["Scale"]), Vector(0,0), Vector(0,0))
|
||||||
else
|
else
|
||||||
printTrinketDescription({closest.SubType,itemConfig:GetCard(closest.SubType).Description})
|
printTrinketDescription({closest.SubType,itemConfig:GetCard(closest.SubType).Description})
|
||||||
end
|
end
|
||||||
@@ -440,20 +443,20 @@ local function onRender(t)
|
|||||||
elseif pillEffect < 47 then
|
elseif pillEffect < 47 then
|
||||||
printTrinketDescription(pillDescriptions[pillEffect+1],"pill")
|
printTrinketDescription(pillDescriptions[pillEffect+1],"pill")
|
||||||
else
|
else
|
||||||
Isaac.RenderScaledText(EIDConfig["ErrorMessage"], EIDConfig["XPosition"], posY,EIDConfig["Scale"],EIDConfig["Scale"], EIDConfig["ErrorColor"][1] , EIDConfig["ErrorColor"][2], EIDConfig["ErrorColor"][3], EIDConfig["Transparency"])
|
Isaac.RenderScaledText(EIDConfig["ErrorMessage"], EIDConfig["XPosition"], posY(),EIDConfig["Scale"],EIDConfig["Scale"], EIDConfig["ErrorColor"][1] , EIDConfig["ErrorColor"][2], EIDConfig["ErrorColor"][3], EIDConfig["Transparency"])
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Isaac.RenderScaledText(unidentifiedPillMessage, EIDConfig["XPosition"], posY,EIDConfig["Scale"],EIDConfig["Scale"], EIDConfig["ErrorColor"][1] , EIDConfig["ErrorColor"][2], EIDConfig["ErrorColor"][3], EIDConfig["Transparency"])
|
Isaac.RenderScaledText(unidentifiedPillMessage, EIDConfig["XPosition"], posY(),EIDConfig["Scale"],EIDConfig["Scale"], EIDConfig["ErrorColor"][1] , EIDConfig["ErrorColor"][2], EIDConfig["ErrorColor"][3], EIDConfig["Transparency"])
|
||||||
end
|
end
|
||||||
local pillsprite = closest:GetSprite()
|
local pillsprite = closest:GetSprite()
|
||||||
pillsprite.Scale = Vector(EIDConfig["Scale"]*0.75,EIDConfig["Scale"]*0.75)
|
pillsprite.Scale = Vector(EIDConfig["Scale"]*0.75,EIDConfig["Scale"]*0.75)
|
||||||
pillsprite:Update()
|
pillsprite:Update()
|
||||||
local offsetX = 0
|
local offsetX = 0
|
||||||
if EIDConfig["ShowItemName"] and (identified or EIDConfig["ShowUnidentifiedPillDescriptions"]) then offsetX = 10 end
|
if EIDConfig["ShowItemName"] and (identified or EIDConfig["ShowUnidentifiedPillDescriptions"]) then offsetX = 10 end
|
||||||
pillsprite:Render(Vector(EIDConfig["XPosition"]+2*EIDConfig["Scale"],posY+(11+offsetX)*EIDConfig["Scale"]), Vector(0,0), Vector(0,0))
|
pillsprite:Render(Vector(EIDConfig["XPosition"]+2*EIDConfig["Scale"],posY()+(11+offsetX)*EIDConfig["Scale"]), Vector(0,0), Vector(0,0))
|
||||||
pillsprite.Scale = Vector(1,1)
|
pillsprite.Scale = Vector(1,1)
|
||||||
end
|
end
|
||||||
if player:HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG)then posY =EIDConfig["YPosition"] +30 end
|
if player:HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG)then modifiedPosY =EIDConfig["YPosition"] +30 end
|
||||||
end
|
end
|
||||||
|
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender)
|
EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender)
|
||||||
@@ -486,4 +489,4 @@ local json = require("json")
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, SaveGame)
|
EID:AddCallback(ModCallbacks.MC_PRE_GAME_EXIT, SaveGame)
|
||||||
|
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user