Improved "Unidentified Pill"-info rendering
This commit is contained in:
1 parent
fc7c9d5605
commit
0ced81f7e3
2 files changed
+23
-12
No files matched your search
@@ -1214,13 +1214,14 @@ function EID:filterIconMarkup(text, renderBulletPointIcon)
|
||||
end
|
||||
|
||||
---Renders a list of given inline sprite objects returned by the "EID:filterIconMarkup()" function
|
||||
---@param spriteTable [EID_Icon, integer, fun(spriteObj:Sprite)?][]
|
||||
---@param spriteTable [EID_Icon, integer?, fun(spriteObj:Sprite)?][]
|
||||
---@param posX integer
|
||||
---@param posY integer
|
||||
function EID:renderInlineIcons(spriteTable, posX, posY)
|
||||
for _, sprite in ipairs(spriteTable) do
|
||||
local Xoffset = sprite[1][5] or -1
|
||||
local Yoffset = sprite[1][6] or 0
|
||||
local additionalXOffset = sprite[2] or 0
|
||||
local spriteObj = (type(sprite[1][7]) == "function" and sprite[1][7]()) or sprite[1][7] or EID.InlineIconSprite
|
||||
if sprite[1][2] >= 0 then
|
||||
spriteObj:SetFrame(sprite[1][1], sprite[1][2])
|
||||
@@ -1230,7 +1231,7 @@ function EID:renderInlineIcons(spriteTable, posX, posY)
|
||||
spriteObj:Update()
|
||||
end
|
||||
|
||||
EID:renderIcon(spriteObj, posX + sprite[2] + Xoffset * EID.Scale, posY + Yoffset * EID.Scale, sprite[3], sprite[1][1], sprite[1][2])
|
||||
EID:renderIcon(spriteObj, posX + additionalXOffset + Xoffset * EID.Scale, posY + Yoffset * EID.Scale, sprite[3], sprite[1][1], sprite[1][2])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -602,7 +602,7 @@ function EID:printDescription(desc, cachedID)
|
||||
EID.lineHeight = EID.Config["LineHeight"]
|
||||
if EID.Config["ShowItemIcon"] and desc.Icon then
|
||||
offsetX = offsetX + 14
|
||||
EID:renderInlineIcons({{desc.Icon,0}}, renderPos.X - 3 * EID.Scale, renderPos.Y - 4 * EID.Scale)
|
||||
EID:renderInlineIcons({{desc.Icon}}, renderPos.X - 3 * EID.Scale, renderPos.Y - 4 * EID.Scale)
|
||||
end
|
||||
|
||||
--Display ItemType / Charge
|
||||
@@ -683,7 +683,7 @@ function EID:printDescription(desc, cachedID)
|
||||
local transformLineHeight = EID.lineHeight
|
||||
if EID.Config["TransformationIcons"] then
|
||||
transformLineHeight = math.max(EID.lineHeight, transformSprite[4])
|
||||
EID:renderInlineIcons({{transformSprite,0}}, renderPos.X, renderPos.Y)
|
||||
EID:renderInlineIcons({{transformSprite}}, renderPos.X, renderPos.Y)
|
||||
end
|
||||
if EID.Config["TransformationText"] or EID.Config["TransformationProgress"] then
|
||||
local transformationName = ""
|
||||
@@ -832,30 +832,40 @@ function EID:renderUnidentifiedPill(entity)
|
||||
if alwaysUseLocalMode then return false
|
||||
else alwaysUseLocalMode = true end
|
||||
end
|
||||
EID.isDisplaying = true
|
||||
|
||||
local pillColor = entity.SubType
|
||||
if pillColor >= 2049 then
|
||||
pillColor = pillColor - 2048
|
||||
end
|
||||
local pos = EID:getTextPosition()
|
||||
local renderPos = EID:getTextPosition()
|
||||
local textScale = Vector(EID.Scale, EID.Scale)
|
||||
local offsetX = 0
|
||||
if EID.CachingDescription then
|
||||
table.insert(EID.CachedStrings, {})
|
||||
table.insert(EID.CachedIcons, {})
|
||||
table.insert(EID.CachedRenderPoses, Vector(pos.X, pos.Y))
|
||||
table.insert(EID.CachedRenderPoses, Vector(renderPos.X, renderPos.Y))
|
||||
end
|
||||
|
||||
local descriptionObj = EID:getDescriptionObj(entity.Type, entity.Variant, entity.SubType, entity, false)
|
||||
descriptionObj.Name = EID:getDescriptionEntry("unidentifiedPill")
|
||||
descriptionObj.Description = ""
|
||||
descriptionObj.ShowWhenUnidentified = false
|
||||
descriptionObj = EID:applyDescriptionModifier(descriptionObj, -999)
|
||||
|
||||
if EID.Config["ShowItemIcon"] then
|
||||
descriptionObj.Name = "{{Pill"..pillColor.."}} "..descriptionObj.Name
|
||||
if EID.Config["ShowItemIcon"] and descriptionObj.Icon then
|
||||
offsetX = offsetX + 14
|
||||
EID:renderInlineIcons({{descriptionObj.Icon}}, renderPos.X - 3 * EID.Scale, renderPos.Y - 4 * EID.Scale)
|
||||
EID:renderInlineIcons({{EID.InlineIcons["SecretRoom"]}}, renderPos.X + 1 * EID.Scale, renderPos.Y - 4 * EID.Scale)
|
||||
end
|
||||
EID:renderString(descriptionObj.Name, pos + Vector(0,-1), Vector(EID.Scale, EID.Scale), EID:getErrorColor())
|
||||
EID:renderString(
|
||||
EID:getDescriptionEntry("unidentifiedPill"),
|
||||
renderPos + (Vector(offsetX, -3) * EID.Scale),
|
||||
textScale,
|
||||
EID:getErrorColor()
|
||||
)
|
||||
if EID.Config["ShowItemDescription"] and descriptionObj.ShowWhenUnidentified then
|
||||
pos.Y = pos.Y + EID.lineHeight * EID.Scale
|
||||
EID:printBulletPoints(descriptionObj.Description, pos)
|
||||
renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale
|
||||
EID:printBulletPoints(descriptionObj.Description, renderPos)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user