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
+13 -16
+13 -16
View File
@@ -441,6 +441,7 @@ function EID:printDescription(desc)
local textScale = Vector(EID.Scale, EID.Scale) local textScale = Vector(EID.Scale, EID.Scale)
local renderPos = EID:getTextPosition() local renderPos = EID:getTextPosition()
local offsetX = 0 local offsetX = 0
EID.lineHeight = EID.Config["LineHeight"]
if EID.Config["ShowItemIcon"] then if EID.Config["ShowItemIcon"] then
local iconType = nil local iconType = nil
local subType = desc.ObjSubType local subType = desc.ObjSubType
@@ -809,6 +810,7 @@ function EID:onGameUpdate()
EID:setPlayer() EID:setPlayer()
--Fix Overlapping Pedestals --Fix Overlapping Pedestals
-- PERFORMANCENOTE move this to a post pickup init or something
local curPositions = {} local curPositions = {}
for _, entity in ipairs(Isaac.FindByType(5, 100, -1, true, false)) do for _, entity in ipairs(Isaac.FindByType(5, 100, -1, true, false)) do
local pos = entity.Position local pos = entity.Position
@@ -843,8 +845,11 @@ function EID:onGameUpdate()
end end
if EID.pathCheckerEntity == nil then 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 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: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.EntityCollisionClass = EntityCollisionClass.ENTCOLL_NONE
EID.pathCheckerEntity.Visible = false EID.pathCheckerEntity.Visible = false
EID.hasValidWalkingpath = false EID.hasValidWalkingpath = false
@@ -918,8 +923,6 @@ local function onRender(t)
EID.isDisplaying = false EID.isDisplaying = false
EID:setPlayer() 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 if Input.IsButtonTriggered(EID.Config["HideKey"], 0) or Input.IsButtonTriggered(EID.Config["HideButton"], EID.player.ControllerIndex) then
EID.isHidden = not EID.isHidden EID.isHidden = not EID.isHidden
end end
@@ -1062,16 +1065,12 @@ local function onRender(t)
EID:printDescription(glitchedObj) EID:printDescription(glitchedObj)
return return
end -- Handle Dice Room Floor
elseif closest.Type == 1000 and closest.Variant == 76 then
if closest.Type == 1000 and closest.Variant == 76 then
EID:printDescription(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType+1, closest)) EID:printDescription(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType+1, closest))
return 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.CraneItemType[tostring(closest.InitSeed)] then
if EID:getEntityData(closest, "EID_DontHide") ~= true 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 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 EID.absorbedSpindown = false
if isSave then if isSave then
EID.BagItems = savedEIDConfig["BagContent"] EID.BagItems = savedEIDConfig["BagContent"] or {}
EID.bagOfCraftingRoomQueries = savedEIDConfig["BagFloorContent"] EID.bagOfCraftingRoomQueries = savedEIDConfig["BagFloorContent"] or {}
EID.CraneItemType = savedEIDConfig["CraneItemType"] EID.CraneItemType = savedEIDConfig["CraneItemType"] or {}
EID.absorbedSpindown = savedEIDConfig["AbsorbedSpindownDice"] EID.absorbedSpindown = savedEIDConfig["AbsorbedSpindownDice"] or false
-- turn list back into dict because json cant save dict indices. -- turn list back into dict because json cant save dict indices.
local flipItemTable = {} local flipItemTable = {}
@@ -1241,7 +1240,6 @@ if EID.MCMLoaded or REPENTANCE then
EID.isHidden = EID.Config["InitiallyHidden"] EID.isHidden = EID.Config["InitiallyHidden"]
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
EID.Scale = EID.Config["Scale"] EID.Scale = EID.Config["Scale"]
EID.lineHeight = EID.Config["LineHeight"]
EID:fixDefinedFont() EID:fixDefinedFont()
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt") EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
@@ -1275,7 +1273,6 @@ if EID.MCMLoaded or REPENTANCE then
end end
EID.Config["FlipItemPositions"] = flipItemTable or {} EID.Config["FlipItemPositions"] = flipItemTable or {}
end end
EID.Config["LineHeight"] = EID.lineHeight
EID.SaveData(EID, json.encode(EID.Config)) EID.SaveData(EID, json.encode(EID.Config))
EID:hidePermanentText() EID:hidePermanentText()
EID.itemUnlockStates[CollectibleType.COLLECTIBLE_CUBE_OF_MEAT] = nil EID.itemUnlockStates[CollectibleType.COLLECTIBLE_CUBE_OF_MEAT] = nil