Added feature to allow icon backgrounds.
Added VirtuesCollectibleX icons
This commit is contained in:
1 parent
3a6b675280
commit
b9f217eae3
3 files changed
+26
-8
No files matched your search
+16
-6
@@ -1169,6 +1169,7 @@ end
|
||||
---@return EID_Icon?
|
||||
function EID:createItemIconObject(str)
|
||||
local item = nil
|
||||
local backgroundImage = ""
|
||||
local subTypeIdentifier = 0
|
||||
|
||||
-- Check for {{Item#.##.###}} markup; easiest way to handle it is to just call this function again
|
||||
@@ -1183,7 +1184,16 @@ function EID:createItemIconObject(str)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Add background image to Icon, if the keyword can be found in the markup string
|
||||
for keyword, imagePath in pairs(EID.MarkupBackgroundKeywords) do
|
||||
if string.find(str, keyword) then
|
||||
str = string.gsub(str, keyword, "")
|
||||
backgroundImage = imagePath
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
---@diagnostic disable
|
||||
local collID,numReplace = string.gsub(str, "Collectible", "")
|
||||
if numReplace > 0 and collID ~= "" and tonumber(collID) ~= nil then
|
||||
@@ -1206,19 +1216,19 @@ function EID:createItemIconObject(str)
|
||||
return {"Pills", tonumber(pillID % 2048)-1, 9, 8, 0, 1, EID.CardPillSprite}
|
||||
end
|
||||
---@diagnostic enable
|
||||
|
||||
if item == nil then
|
||||
return nil
|
||||
end
|
||||
if dynamicSpriteCache[str] then
|
||||
return dynamicSpriteCache[str]
|
||||
if dynamicSpriteCache[backgroundImage .. str] then
|
||||
return dynamicSpriteCache[backgroundImage .. str]
|
||||
else
|
||||
local spriteDummy = Sprite()
|
||||
spriteDummy:Load("gfx/eid_inline_icons.anm2", true)
|
||||
spriteDummy:ReplaceSpritesheet(0, backgroundImage)
|
||||
spriteDummy:ReplaceSpritesheet(1, item.GfxFileName)
|
||||
spriteDummy:LoadGraphics()
|
||||
local newDynamicSprite = {"ItemIcon", subTypeIdentifier, 11, 8, -2, -2, spriteDummy}
|
||||
dynamicSpriteCache[str] = newDynamicSprite
|
||||
local newDynamicSprite = { "ItemIcon", subTypeIdentifier, 11, 8, -2, -2, spriteDummy }
|
||||
dynamicSpriteCache[backgroundImage .. str] = newDynamicSprite
|
||||
return newDynamicSprite
|
||||
end
|
||||
end
|
||||
|
||||
@@ -975,6 +975,12 @@ EID.RoomShapeToMarkup = { "{{Room}}", "{{RoomSmallHorizontal}}", "{{RoomSmallVer
|
||||
EID.RoomTypeToMarkup = { "{{Room}}", "{{Shop}}", "{{ErrorRoom}}", "{{TreasureRoom}}", "{{BossRoom}}", "{{MiniBoss}}", "{{SecretRoom}}", "{{SuperSecretRoom}}", "{{ArcadeRoom}}", "{{CursedRoom}}", "{{ChallengeRoom}}", "{{Library}}", "{{SacrificeRoom}}", "{{DevilRoom}}", "{{AngelRoom}}", "{{LadderRoom}}", "{{Room}}" --[[boss rush]], "{{IsaacsRoom}}", "{{BarrenRoom}}", "{{ChestRoom}}", "{{DiceRoom}}", "{{Shop}}", "{{Room}}", --[[Black Market / Greed Exit]] "{{Planetarium}}", "{{Teleporter}}","{{Teleporter}}", "{{Room}}", "{{Room}}" --[[Blue Key rooms]], "{{UltraSecretRoom}}" }
|
||||
EID.ItemPoolTypeToMarkup = { [0] = "{{ItemPoolTreasure}}", "{{ItemPoolShop}}", "{{ItemPoolBoss}}", "{{ItemPoolDevil}}", "{{ItemPoolAngel}}", "{{ItemPoolSecret}}", "{{ItemPoolLibrary}}", "{{ItemPoolShellGame}}", "{{ItemPoolGoldenChest}}", "{{ItemPoolRedChest}}", "{{ItemPoolBeggar}}", "{{ItemPoolDemonBeggar}}", "{{ItemPoolCurse}}", "{{ItemPoolKeyMaster}}", "{{ItemPoolBombBum}}", "{{ItemPoolMomsChest}}", "{{ItemPoolGreedTreasure}}", "{{ItemPoolGreedShop}}", "{{ItemPoolGreedBoss}}", "{{ItemPoolGreedDevil}}", "{{ItemPoolGreedAngel}}", "{{ItemPoolGreedCurse}}", "{{ItemPoolGreedSecret}}", "{{ItemPoolCraneGame}}", "{{ItemPoolUltraSecret}}", "{{ItemPoolBatteryBum}}", "{{ItemPoolPlanetarium}}", "{{ItemPoolOldChest}}", "{{ItemPoolBabyShop}}", "{{ItemPoolWoodenChest}}", "{{ItemPoolRottenBeggar}}"}
|
||||
|
||||
-- Background icon markup substrings
|
||||
EID.MarkupBackgroundKeywords = {
|
||||
["Virtues"] = "gfx/ui/hud_bookofvirtues.png",
|
||||
}
|
||||
|
||||
|
||||
-- additional offset of the textbox to the entity position. Only applies in local description mode.
|
||||
-- If a function returns a value, it will be used as the offset
|
||||
EID.LocalModePositionOffset = {
|
||||
|
||||
Reference in new issue
Block a user