Fixed custom transformation icons

This commit is contained in:
Wofsauge committed 2020-11-01 03:44:47 +01:00
1 parent 250385e0e9
commit b1447e1636
3 files changed
+30 -15

No files matched your search

+14 -2
View File
@@ -135,7 +135,7 @@ function EID:getDescriptionObj(objTable, objID)
local legacyModdedTransformation = nil
if objTable == "collectibles" then
legacyModdedTransformation = EID:getLegacyModDescription("transformation", objID)
legacyModdedTransformation = EID:getLegacyModDescription("transformations", objID)
end
description.Transformation = legacyModdedTransformation or tableEntry[2] or "0"
@@ -146,7 +146,6 @@ end
function EID:getTransformationName(id)
local str = "Custom"
if tonumber(id) == nil then
print("FAIL")
return id
end
return EID:getObjectName(tonumber(id) + 1, "transformations") or str
@@ -238,6 +237,19 @@ function EID:getIcon(str)
end
end
-- Returns the icon for a given transformation name or ID
function EID:getTransformationIcon(str)
if str == nil then return EID.InlineIcons["ERROR"] end
if tonumber(str) ~= nil then
str = EID.descriptions["en_us"].transformations[tonumber(str+1)]
end
local transformSprite = EID:getIcon(str:gsub(" ", ""))
if transformSprite[1] == "ERROR" then
transformSprite = EID:getIcon("CustomTransformation")
end
return transformSprite
end
-- Returns the width of a given string in Pixels
function EID:getStrWidth(str)
return EID.font:GetStringWidthUTF8(str)