From e8ad909891292eb3363eccb81848dec8720797f9 Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Sat, 3 Sep 2022 01:18:42 +0200 Subject: [PATCH] Added feature to hide pilleffects till they are used at least once --- eid_api.lua | 10 ++++++++++ eid_config.lua | 5 +++++ eid_mcm.lua | 1 + main.lua | 5 +++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/eid_api.lua b/eid_api.lua index 407571ad..65234b16 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -1779,4 +1779,14 @@ end -- Returns true if a given entity is a grid entity function EID:IsGridEntity(entity) return entity.Type == nil +end + +-- returns true if the given pilleffect id was used at least once by the current player +function EID:WasPillUsed(pillEffectID) + local playerID = EID:getPlayerID(EID.player) + local pillsTable = EID.PlayerItemInteractions[playerID].pills + if EID.player:GetPlayerType() == 38 then + pillsTable = EID.PlayerItemInteractions[playerID].altPills or pillsTable + end + return pillsTable[tostring(pillEffectID)] ~= nil end \ No newline at end of file diff --git a/eid_config.lua b/eid_config.lua index 44caffe8..b2890674 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -245,6 +245,10 @@ EID.UserConfig = { -- REPENTANCE ONLY!!! -- Default = true ["DisplayPillInfoOptions?"] = true, + -- Keeps pilleffect descriptions unidentified, until the player has used the pill at least once in the run. + -- This ignores effects caused by PHD and False PHD + -- Default = false + ["OnlyShowPillWhenUsedAtLeastOnce"] = false, -- Toggle display of description for Pills that haven't been identified yet -- Default = false ["ShowUnidentifiedPillDescriptions"] = false, @@ -521,6 +525,7 @@ EID.DefaultConfig = { ["DisplayPillInfoShop"] = true, ["DisplayPillInfoOptions?"] = true, ["DisplayObstructedPillInfo"] = false, + ["OnlyShowPillWhenUsedAtLeastOnce"] = false, ["ShowUnidentifiedPillDescriptions"] = false, ["DisplayGlitchedItemInfo"] = debug and true or false, ["DisplaySacrificeInfo"] = true, diff --git a/eid_mcm.lua b/eid_mcm.lua index bf225a42..d012a010 100644 --- a/eid_mcm.lua +++ b/eid_mcm.lua @@ -361,6 +361,7 @@ if MCMLoaded then EID:AddBooleanSetting("General", "DisableOnAltPath", "Show Hidden Alt-Path Item", {offText = "True", onText = "False", repOnly = true, infoText = "Show the description for the blind item in Downpour/Mines/etc."}) + EID:AddBooleanSetting("General", "OnlyShowPillWhenUsedAtLeastOnce", "Show pill effect after one use", {infoText = "Keeps pilleffect descriptions unidentified, until the player has used the pill at least once in the run. This ignores effects caused by PHD and False PHD"}) EID:AddBooleanSetting("General", "ShowUnidentifiedPillDescriptions", "Show Unidentified Pill Effects") EID:AddBooleanSetting("General", "HideInBattle", "Hide in Battle", {infoText = "Hides the descriptions when in a fight"}) diff --git a/main.lua b/main.lua index e4eae386..2a30dd68 100644 --- a/main.lua +++ b/main.lua @@ -1465,11 +1465,12 @@ local function onRender(t) local pillColor = closest.SubType local pool = game:GetItemPool() - local identified = pool:IsPillIdentified(pillColor) + local identified = pool:IsPillIdentified(pillColor) and not EID.Config["OnlyShowPillWhenUsedAtLeastOnce"] if REPENTANCE and pillColor % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD then identified = true end local pillEffectID = EID:getAdjustedSubtype(closest.Type, closest.Variant, pillColor) + local wasUsed = EID:WasPillUsed(pillEffectID) - if (identified or EID.Config["ShowUnidentifiedPillDescriptions"]) and not EID.UnidentifyablePillEffects[pillEffectID] then + if (identified or wasUsed or EID.Config["ShowUnidentifiedPillDescriptions"]) and not EID.UnidentifyablePillEffects[pillEffectID] then local descEntry = EID:getDescriptionObj(closest.Type, closest.Variant, pillColor, closest) EID:addDescriptionToPrint(descEntry) else