From c233a723d531555bf4b0775ff0a1b1b2902bae18 Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Sun, 8 Sep 2024 23:34:18 +0200 Subject: [PATCH] Added EID:IsItemHidden() and fixed alt path item descriptions not visible despite it being enabled in the config --- features/eid_api.lua | 20 ++++++++++++++++++ main.lua | 48 +++++++++++++++++--------------------------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/features/eid_api.lua b/features/eid_api.lua index ad9aedb2..b58a39a0 100644 --- a/features/eid_api.lua +++ b/features/eid_api.lua @@ -2493,3 +2493,23 @@ function EID:CreateDescriptionTableIfMissing(tableName, language) EID.descriptions[language][tableName] = {} end end + +-- returns true if the given pedestal-entity is hidden (questionmark sprite) +function EID:IsItemHidden(entity) + if EID:getEntityData(entity, "EID_DontHide") == true then + return false + end + -- Repentogon check (does not account for curse of blind), + -- with expection for alt path item descriptions when config option is enabled + if REPENTOGON and entity:ToPickup():IsBlind() and not (not EID.Config["DisableOnAltPath"] and EID:IsAltChoice(entity)) then + return true + end + + if (EID.Config["DisableOnCurse"] and EID:hasCurseBlind() and not entity:ToPickup().Touched and not EID.isDeathCertRoom) + or (EID.Config["HideUncollectedItemDescriptions"] and EID:requiredForCollectionPage(entity.SubType)) + or (EID.Config["DisableOnAltPath"] and not entity:ToPickup().Touched and EID:IsAltChoice(entity)) + or (EID.Config["DisableOnAprilFoolsChallenge"] and game.Challenge == Challenge.CHALLENGE_APRILS_FOOL) then + return true + end + return false +end \ No newline at end of file diff --git a/main.lua b/main.lua index 6c36e267..705149c1 100644 --- a/main.lua +++ b/main.lua @@ -1440,29 +1440,23 @@ function EID:OnRender() -- Handle Glitched Items elseif closest.Type == 5 and closest.Variant == 100 and closest.SubType > 4294960000 then - if EID:getEntityData(closest, "EID_DontHide") ~= true then - if (REPENTOGON and closest:ToPickup():IsBlind()) - or (EID:hasCurseBlind() and not closest:ToPickup().Touched and EID.Config["DisableOnCurse"] and not EID.isDeathCertRoom) - or (EID.Config["DisableOnAltPath"] and not closest:ToPickup().Touched and EID:IsAltChoice(closest)) - or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then - EID:addQuestionMarkDescription(closest) + if EID:IsItemHidden(closest) then + EID:addQuestionMarkDescription(closest) + else + local glitchedObj = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType, closest) + local glitchedName = EID.itemConfig:GetCollectible(closest.SubType).Name + local glitchedDesc = EID:getXMLDescription(closest.Type, closest.Variant, closest.SubType) + + -- force the default glitchy description if option is off + if not EID.Config["DisplayGlitchedItemInfo"] then + glitchedObj.Description = glitchedDesc + -- grab the Item Config info if we haven't created a desc for it before, or its name has changed since we did (different game session) + elseif glitchedObj.Description == glitchedDesc or glitchedObj.Name ~= glitchedName then + EID:addCollectible(closest.SubType, EID:CheckGlitchedItemConfig(closest.SubType), glitchedName) + glitchedObj = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType, closest) end + EID:addDescriptionToPrint(glitchedObj) end - - local glitchedObj = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType, closest) - local glitchedName = EID.itemConfig:GetCollectible(closest.SubType).Name - local glitchedDesc = EID:getXMLDescription(closest.Type, closest.Variant, closest.SubType) - - -- force the default glitchy description if option is off - if not EID.Config["DisplayGlitchedItemInfo"] then - glitchedObj.Description = glitchedDesc - -- grab the Item Config info if we haven't created a desc for it before, or its name has changed since we did (different game session) - elseif glitchedObj.Description == glitchedDesc or glitchedObj.Name ~= glitchedName then - EID:addCollectible(closest.SubType, EID:CheckGlitchedItemConfig(closest.SubType), glitchedName) - glitchedObj = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType, closest) - end - - EID:addDescriptionToPrint(glitchedObj) -- Handle Dice Room Floor elseif closest.Type == 1000 and closest.Variant == 76 then EID:addDescriptionToPrint(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType+1, closest)) @@ -1501,16 +1495,10 @@ function EID:OnRender() elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then --Handle Collectibles - if EID:getEntityData(closest, "EID_DontHide") ~= true then + if EID:IsItemHidden(closest) then local isHideUncollected = EID.Config["HideUncollectedItemDescriptions"] and EID:requiredForCollectionPage(closest.SubType) - if (REPENTOGON and closest:ToPickup():IsBlind()) - or isHideUncollected - or (EID:hasCurseBlind() and not closest:ToPickup().Touched and EID.Config["DisableOnCurse"] and not EID.isDeathCertRoom) - or (EID.Config["DisableOnAltPath"] and not closest:ToPickup().Touched and EID:IsAltChoice(closest)) - or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then - local description = isHideUncollected and EID:getDescriptionEntry("CollectionPageInfo") or nil - EID:addQuestionMarkDescription(closest, description) - end + local description = isHideUncollected and EID:getDescriptionEntry("CollectionPageInfo") or nil + EID:addQuestionMarkDescription(closest, description) end local descriptionObj = EID:getDescriptionObjByEntity(closest) EID:addDescriptionToPrint(descriptionObj)