The object icon can now be altered with modifiers

This commit is contained in:
Wofsauge committed 2022-04-02 03:27:59 +02:00
1 parent 37274dad55
commit e2133d935a
2 files changed
+24 -26

No files matched your search

+22 -1
View File
@@ -351,6 +351,7 @@ function EID:getDescriptionObj(Type, Variant, SubType, entity, checkModifiers)
description.ModName = tableEntry and tableEntry[4]
description.Quality = EID:getObjectQuality(description)
description.Icon = EID:getObjectIcon(description)
if checkModifiers ~= false then
for _,modifier in ipairs(EID.DescModifiers) do
@@ -1568,8 +1569,28 @@ function EID:evaluateQueuedItems()
end
end
-- Returns the quality of the described entity
function EID:getObjectQuality(descObj)
if descObj.ObjType == 5 and descObj.ObjVariant == PickupVariant.PICKUP_COLLECTIBLE then
if descObj.ObjType == 5 and descObj.ObjVariant == 100 then
return tonumber(EID.itemConfig:GetCollectible(tonumber(descObj.ObjSubType)).Quality)
end
end
-- Returns the Inline Icon definition object for a given object.
function EID:getObjectIcon(descObj)
if descObj.ObjType == 5 then
if descObj.ObjVariant == 100 then
return EID:createItemIconObject("Collectible" .. descObj.ObjSubType)
elseif descObj.ObjVariant == 350 then
return EID:createItemIconObject("Trinket" .. descObj.ObjSubType)
elseif descObj.ObjVariant == 300 then
return EID:createItemIconObject("Card" .. descObj.ObjSubType)
elseif descObj.ObjVariant == 70 then
if descObj.ObjSubType >= 2049 then
return EID:createItemIconObject("Pill" .. (descObj.ObjSubType - 2048))
end
return EID:createItemIconObject("Pill" .. descObj.ObjSubType)
end
end
end
+2 -25
View File
@@ -557,32 +557,9 @@ function EID:printDescription(desc, cachedID)
local textScale = Vector(EID.Scale, EID.Scale)
local offsetX = 0
EID.lineHeight = EID.Config["LineHeight"]
if EID.Config["ShowItemIcon"] then
local iconType = nil
local subType = desc.ObjSubType
if desc.ObjType == 5 then
if desc.ObjVariant == 100 then
iconType = "Collectible"
elseif desc.ObjVariant == 350 then
iconType = "Trinket"
elseif desc.ObjVariant == 300 then
iconType = "Card"
elseif desc.ObjVariant == 70 then
iconType = "Pill"
if subType >= 2049 then
subType = subType - 2048
end
end
end
if iconType ~= nil then
if EID.Config["ShowItemIcon"] and desc.Icon then
offsetX = offsetX + 14
EID:renderString(
"{{" .. iconType .. subType .. "}}",
renderPos + (Vector(-3, -4) * EID.Scale),
textScale,
EID:getNameColor()
)
end
EID:renderInlineIcons({{desc.Icon,0}}, renderPos.X - 3 * EID.Scale, renderPos.Y - 4 * EID.Scale)
end
--Display ItemType / Charge
local itemType = -1