Unidentified pills are now correctly displayed as unidentified, if using the mouse control feature to inspect them
This commit is contained in:
1 parent
2eeb74696e
commit
bc0551a5d5
3 files changed
+42
-12
No files matched your search
@@ -3429,3 +3429,20 @@ function EID:WriteErrorMsg(str)
|
||||
EID:WriteDebugMsg("EID ERROR: " .. str)
|
||||
end
|
||||
|
||||
--- Helper function to evaluate if a pill color is identified
|
||||
--- @param pillColor any
|
||||
--- @return boolean
|
||||
function EID:ShouldShowPillAsIdentified(pillColor)
|
||||
local identified = game:GetItemPool():IsPillIdentified(pillColor) and not EID.Config["OnlyShowPillWhenUsedAtLeastOnce"]
|
||||
if EID.isRepentance and pillColor % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD then identified = true end
|
||||
local pillEffectID = EID:getAdjustedSubtype(5, 70, pillColor)
|
||||
local wasUsed = EID:WasPillUsed(pillColor)
|
||||
|
||||
if (identified or wasUsed or EID.Config["ShowUnidentifiedPillDescriptions"]) and not EID.UnidentifyablePillEffects[pillEffectID] then
|
||||
-- show identified pill
|
||||
return true
|
||||
else
|
||||
-- show unidentified pill description
|
||||
return false
|
||||
end
|
||||
end
|
||||
+24
-5
@@ -91,28 +91,47 @@ EID.HUDElements = {
|
||||
local id = EID.player:GetCard(0)
|
||||
if id ~= 0 then return EID:getDescriptionObj(5, 300, id) end
|
||||
id = EID.player:GetPill(0)
|
||||
if id ~= 0 then return EID:getDescriptionObj(5, 70, id) end
|
||||
if id ~= 0 then
|
||||
if not EID:ShouldShowPillAsIdentified(id) then
|
||||
return { Description = "UnidentifiedPill", Entity = EID.player}
|
||||
end
|
||||
return EID:getDescriptionObj(5, 70, id) end
|
||||
return nil
|
||||
end},
|
||||
["Pocket2"] = {x = 0,y = 40, width = 30, height = 30, anchors={"BOTTOM","RIGHT"}, descriptionObj = function()
|
||||
local id = EID.player:GetCard(1)
|
||||
if id ~= 0 then return EID:getDescriptionObj(5, 300, id) end
|
||||
id = EID.player:GetPill(1)
|
||||
if id ~= 0 then return EID:getDescriptionObj(5, 70, id) end
|
||||
if id ~= 0 then
|
||||
if not EID:ShouldShowPillAsIdentified(id) then
|
||||
return { Description = "UnidentifiedPill", Entity = EID.player}
|
||||
end
|
||||
return EID:getDescriptionObj(5, 70, id)
|
||||
end
|
||||
return nil
|
||||
end},
|
||||
["Pocket3"] = {x = 0,y = 70, width = 30, height = 25, anchors={"BOTTOM","RIGHT"}, descriptionObj = function()
|
||||
local id = EID.player:GetCard(2)
|
||||
if id ~= 0 then return EID:getDescriptionObj(5, 300, id) end
|
||||
id = EID.player:GetPill(2)
|
||||
if id ~= 0 then return EID:getDescriptionObj(5, 70, id) end
|
||||
if id ~= 0 then
|
||||
if not EID:ShouldShowPillAsIdentified(id) then
|
||||
return { Description = "UnidentifiedPill", Entity = EID.player}
|
||||
end
|
||||
return EID:getDescriptionObj(5, 70, id)
|
||||
end
|
||||
return nil
|
||||
end},
|
||||
["Pocket4"] = {x = 0,y = 95, width = 30, height = 20, anchors={"BOTTOM","RIGHT"}, descriptionObj = function()
|
||||
local id = EID.player:GetCard(3)
|
||||
if id ~= 0 then return EID:getDescriptionObj(5, 300, id) end
|
||||
id = EID.player:GetPill(3)
|
||||
if id ~= 0 then return EID:getDescriptionObj(5, 70, id) end
|
||||
if id ~= 0 then
|
||||
if not EID:ShouldShowPillAsIdentified(id) then
|
||||
return { Description = "UnidentifiedPill", Entity = EID.player}
|
||||
end
|
||||
return EID:getDescriptionObj(5, 70, id)
|
||||
end
|
||||
return nil
|
||||
end}
|
||||
}
|
||||
@@ -132,7 +151,7 @@ EID.TextReplacementPairs = {
|
||||
{"\r\n", "#"}, -- Line break for long strings
|
||||
{"\n", "#"}, -- Line break for long strings
|
||||
{"\r", "#"}, -- Line break for long strings
|
||||
{"\t", ""}, -- Remove Tabs, useful for formatting logn string texts inside a file, without activating the EID markup system to control the bulletpoint icons
|
||||
{"\t", ""}, -- Remove Tabs, useful for formatting long string texts inside a file, without activating the EID markup system to control the bulletpoint icons
|
||||
{"{{Hashtag}}", "ǂ"}, -- Hashtag
|
||||
{"{{CR}}", "{{ColorReset}}"}, -- Shortcut for Color Resetting
|
||||
{"{{EthernalHeart}}", "{{EternalHeart}}"}, -- fix spelling error
|
||||
|
||||
@@ -1632,13 +1632,7 @@ function EID:OnRender()
|
||||
end
|
||||
if not wasHidden then
|
||||
local pillColor = closest.SubType
|
||||
local pool = game:GetItemPool()
|
||||
local identified = pool:IsPillIdentified(pillColor) and not EID.Config["OnlyShowPillWhenUsedAtLeastOnce"]
|
||||
if EID.isRepentance 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(pillColor)
|
||||
|
||||
if (identified or wasUsed or EID.Config["ShowUnidentifiedPillDescriptions"]) and not EID.UnidentifyablePillEffects[pillEffectID] then
|
||||
if EID:ShouldShowPillAsIdentified(pillColor) then
|
||||
-- show identified pill
|
||||
local descEntry = EID:getDescriptionObj(closest.Type, closest.Variant, pillColor, closest)
|
||||
EID:addDescriptionToPrint(descEntry)
|
||||
|
||||
Reference in new issue
Block a user