Added function to add custom Entity Icons
This commit is contained in:
1 parent
034b9e453d
commit
8678c6beab
2 files changed
+12
No files matched your search
+11
@@ -1578,7 +1578,13 @@ function EID:getObjectQuality(descObj)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the Inline Icon definition object for a given object.
|
-- Returns the Inline Icon definition object for a given object.
|
||||||
|
EID.ObjectIcon = {}
|
||||||
function EID:getObjectIcon(descObj)
|
function EID:getObjectIcon(descObj)
|
||||||
|
-- custom object icon
|
||||||
|
if EID.ObjectIcon[descObj.ObjType.."."..descObj.ObjVariant.."."..descObj.ObjSubType] then
|
||||||
|
return EID.ObjectIcon[descObj.ObjType.."."..descObj.ObjVariant.."."..descObj.ObjSubType]
|
||||||
|
end
|
||||||
|
|
||||||
if descObj.ObjType == 5 then
|
if descObj.ObjType == 5 then
|
||||||
if descObj.ObjVariant == 100 then
|
if descObj.ObjVariant == 100 then
|
||||||
return EID:createItemIconObject("Collectible" .. descObj.ObjSubType)
|
return EID:createItemIconObject("Collectible" .. descObj.ObjSubType)
|
||||||
@@ -1594,3 +1600,8 @@ function EID:getObjectIcon(descObj)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Adds an EID Icon to an Object
|
||||||
|
function EID:AddIconToObject(eType, eVariant, eSubType, iconName)
|
||||||
|
EID.ObjectIcon[eType.."."..eVariant.."."..eSubType] = EID.InlineIcons[iconName]
|
||||||
|
end
|
||||||
@@ -125,6 +125,7 @@ local dummySprite2 = Sprite()
|
|||||||
dummySprite2:Load("gfx/eid_inline_icons.anm2", true)
|
dummySprite2:Load("gfx/eid_inline_icons.anm2", true)
|
||||||
-- add animated icon using api function (Make sure to create new Sprite Obj when using animated icons. Reuse objects when only using static icons)
|
-- add animated icon using api function (Make sure to create new Sprite Obj when using animated icons. Reuse objects when only using static icons)
|
||||||
EID:addIcon("TestIcon", "hearts", -1, 9, 9, -1, 0, dummySprite2)
|
EID:addIcon("TestIcon", "hearts", -1, 9, 9, -1, 0, dummySprite2)
|
||||||
|
EID:AddIconToObject(5, 100, 1, "TestIcon")
|
||||||
|
|
||||||
|
|
||||||
-- add icon directly
|
-- add icon directly
|
||||||
|
|||||||
Reference in new issue
Block a user