Fix loaded data being nil, fix weird line height saving

This commit is contained in:
Buurazu authored and GitHub committed 2022-01-21 05:15:44 -05:00
1 parent b9423cdaa4
commit ac877a6589
1 file changed
+17 -20
+17 -20
View File
@@ -441,6 +441,7 @@ function EID:printDescription(desc)
local textScale = Vector(EID.Scale, EID.Scale)
local renderPos = EID:getTextPosition()
local offsetX = 0
EID.lineHeight = EID.Config["LineHeight"]
if EID.Config["ShowItemIcon"] then
local iconType = nil
local subType = desc.ObjSubType
@@ -809,6 +810,7 @@ function EID:onGameUpdate()
EID:setPlayer()
--Fix Overlapping Pedestals
-- PERFORMANCENOTE move this to a post pickup init or something
local curPositions = {}
for _, entity in ipairs(Isaac.FindByType(5, 100, -1, true, false)) do
local pos = entity.Position
@@ -843,8 +845,11 @@ function EID:onGameUpdate()
end
if EID.pathCheckerEntity == nil then
EID.pathCheckerEntity = game:Spawn(17, 3169, EID.player.Position, nullVector, EID.player ,0 , 4354) -- Spawns the EID Helper entity with seed that doesnt spawn rewards
-- Spawns an Ultra Greed Door and makes it invisible and intangible (not fully tested yet)
--EID.pathCheckerEntity = game:Spawn(294, 0, EID.player.Position, nullVector, EID.player, 0, 0)
EID.pathCheckerEntity:ClearEntityFlags(EntityFlag.FLAG_APPEAR)
EID.pathCheckerEntity:AddEntityFlags (EntityFlag.FLAG_PERSISTENT | EntityFlag.FLAG_NO_STATUS_EFFECTS | EntityFlag.FLAG_NO_SPRITE_UPDATE | EntityFlag.FLAG_HIDE_HP_BAR | EntityFlag.FLAG_NO_DEATH_TRIGGER)
EID.pathCheckerEntity:AddEntityFlags (EntityFlag.FLAG_PERSISTENT | EntityFlag.FLAG_NO_STATUS_EFFECTS | EntityFlag.FLAG_NO_SPRITE_UPDATE | EntityFlag.FLAG_HIDE_HP_BAR | EntityFlag.FLAG_NO_DEATH_TRIGGER | EntityFlag.FLAG_FRIENDLY)
if REPENTANCE then EID.pathCheckerEntity:AddEntityFlags(EntityFlag.FLAG_NO_QUERY) end
EID.pathCheckerEntity.EntityCollisionClass = EntityCollisionClass.ENTCOLL_NONE
EID.pathCheckerEntity.Visible = false
EID.hasValidWalkingpath = false
@@ -852,7 +857,7 @@ function EID:onGameUpdate()
EID.pathCheckerEntity = nil
else
EID.pathCheckerEntity.Position = EID.player.Position
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos ( EID.lastDescriptionEntity.Position, false )
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos(EID.lastDescriptionEntity.Position, false)
EID.pathfindingTo = EID.lastDescriptionEntity
end
end
@@ -864,7 +869,7 @@ EID:AddCallback(ModCallbacks.MC_POST_UPDATE, EID.onGameUpdate)
function EID:updatePathfinding()
if not EID.pathCheckerEntity or not EID.lastDescriptionEntity then return end
EID.pathCheckerEntity.Position = EID.player.Position
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos ( EID.lastDescriptionEntity.Position, false )
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos(EID.lastDescriptionEntity.Position, false)
EID.pathfindingTo = EID.lastDescriptionEntity
end
@@ -918,8 +923,6 @@ local function onRender(t)
EID.isDisplaying = false
EID:setPlayer()
--Keyboard hide keys are 32+, controller hide keys have their own option now so don't allow controller inputs in it
if EID.Config["HideKey"] < 32 then EID.Config["HideKey"] = -1 end
if Input.IsButtonTriggered(EID.Config["HideKey"], 0) or Input.IsButtonTriggered(EID.Config["HideButton"], EID.player.ControllerIndex) then
EID.isHidden = not EID.isHidden
end
@@ -1047,7 +1050,7 @@ local function onRender(t)
return
end
--Handle Glitched Items
-- Handle Glitched Items
if closest.Type == 5 and closest.Variant == 100 and closest.SubType > 4294960000 then
local glitchedObj = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType)
local glitchedDesc = EID:getXMLDescription(closest.Type, closest.Variant, closest.SubType)
@@ -1062,16 +1065,12 @@ local function onRender(t)
EID:printDescription(glitchedObj)
return
end
if closest.Type == 1000 and closest.Variant == 76 then
-- Handle Dice Room Floor
elseif closest.Type == 1000 and closest.Variant == 76 then
EID:printDescription(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType+1, closest))
return
end
if closest.Type == 6 and closest.Variant == 16 then
--Handle Crane Game
-- Handle Crane Game
elseif closest.Type == 6 and closest.Variant == 16 then
if EID.CraneItemType[tostring(closest.InitSeed)] then
if EID:getEntityData(closest, "EID_DontHide") ~= true then
if (EID:hasCurseBlind() and EID.Config["DisableOnCurse"]) or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then
@@ -1197,10 +1196,10 @@ if EID.MCMLoaded or REPENTANCE then
EID.absorbedSpindown = false
if isSave then
EID.BagItems = savedEIDConfig["BagContent"]
EID.bagOfCraftingRoomQueries = savedEIDConfig["BagFloorContent"]
EID.CraneItemType = savedEIDConfig["CraneItemType"]
EID.absorbedSpindown = savedEIDConfig["AbsorbedSpindownDice"]
EID.BagItems = savedEIDConfig["BagContent"] or {}
EID.bagOfCraftingRoomQueries = savedEIDConfig["BagFloorContent"] or {}
EID.CraneItemType = savedEIDConfig["CraneItemType"] or {}
EID.absorbedSpindown = savedEIDConfig["AbsorbedSpindownDice"] or false
-- turn list back into dict because json cant save dict indices.
local flipItemTable = {}
@@ -1241,7 +1240,6 @@ if EID.MCMLoaded or REPENTANCE then
EID.isHidden = EID.Config["InitiallyHidden"]
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
EID.Scale = EID.Config["Scale"]
EID.lineHeight = EID.Config["LineHeight"]
EID:fixDefinedFont()
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
@@ -1275,7 +1273,6 @@ if EID.MCMLoaded or REPENTANCE then
end
EID.Config["FlipItemPositions"] = flipItemTable or {}
end
EID.Config["LineHeight"] = EID.lineHeight
EID.SaveData(EID, json.encode(EID.Config))
EID:hidePermanentText()
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_CUBE_OF_MEAT] = nil