Add custom mod icon + custom mod name

This commit is contained in:
Valentin Lampriere committed 2022-01-14 11:29:43 +01:00
1 parent fc477adc4f
commit 66b8c307ba
4 files changed
+34 -18

No files matched your search

+8 -1
View File
@@ -49,7 +49,6 @@ EID.ItemTypeAnm2Names = {
"familiar", -- 4
"trinket" -- 5
}
EID.MODS = { }
---------------------------------------------------------------------------
-------------------------Handle API Functions -----------------------------
@@ -1010,3 +1009,11 @@ end
function EID:getErrorColor()
return EID:getColor(EID.Config["ErrorColor"], EID.InlineColors["ColorEIDError"])
end
function EID:addModIndicatorName(newName)
EID.ModIndicator[EID._currentMod].Name = newName
end
function EID:addModIndicatorIcon(iconMarkup)
EID.ModIndicator[EID._currentMod].Icon = iconMarkup
end
+4 -4
View File
@@ -131,9 +131,9 @@ EID.UserConfig = {
-- REPENTANCE ONLY!!!
-- Default = true
["ShowQuality"] = true,
-- Display mod name for modded items
-- Default = true
["ShowModName"] = true,
-- Set the mod indicator display
-- Default = "Both"
["ModIndicatorDisplay"] = "Both",
-------TRANSFORMATIONS---------
@@ -354,7 +354,7 @@ EID.DefaultConfig = {
["DisplayTrinketInfo"] = true,
["ItemNameColor"] = "ColorEIDObjName",
["ShowQuality"] = true,
["ShowModName"] = true,
["ModIndicatorDisplay"] = "Both",
["ShowObjectID"] = false,
["TransformationText"] = true,
["TransformationIcons"] = true,
+13 -3
View File
@@ -57,11 +57,15 @@ local hudBBSprite = Sprite()
hudBBSprite:Load("gfx/eid_transform_icons.anm2", true)
hudBBSprite:Play("boundingBox")
EID._currentMod = ""
EID.ModIndicator = { }
-- Overwriting "RegisterMod" to track which mods are loading
-- Useful to associate items to mods
EID._currentMod = ""
local OldRegisterMod = RegisterMod
RegisterMod = function (modName, apiVersion)
EID._currentMod = modName
EID.ModIndicator[modName] = { Name = modName, Icon = nil }
return OldRegisterMod(modName, apiVersion)
end
@@ -370,9 +374,15 @@ function EID:printDescription(desc)
curName = curName.." - {{Quality"..quality.."}}"
end
if EID.Config["ShowModName"] and desc.ModName then
curName = curName .. " {{ColorWhite}}" .. desc.ModName
if desc.ModName then
if EID.Config["ModIndicatorDisplay"] == "Both" or EID.Config["ModIndicatorDisplay"] == "Name only" then
curName = curName .. " {{ColorWhite}}" .. EID.ModIndicator[desc.ModName].Name
end
if EID.Config["ModIndicatorDisplay"] == "Both" or EID.Config["ModIndicatorDisplay"] == "Icon only" and EID.ModIndicator[desc.ModName].Icon then
curName = curName .. "{{".. EID.ModIndicator[desc.ModName].Icon .."}}"
end
end
print(EID.Config["ModIndicatorDisplay"])
EID:renderString(
curName,
+9 -10
View File
@@ -1184,24 +1184,23 @@ if MCMLoaded then
}
)
end
-------Mod name for modded items---------
-------Mod indicator for modded items---------
local modIndicatorDisplays = {"Both","Name only","Icon only", "None"}
MCM.AddSetting(
"EID",
"Visuals",
{
Type = ModConfigMenu.OptionType.BOOLEAN,
Type = ModConfigMenu.OptionType.NUMBER,
CurrentSetting = function()
return EID.Config["ShowModName"]
return AnIndexOf(modIndicatorDisplays, EID.Config["ModIndicatorDisplay"])
end,
Minimum = 1,
Maximum = #modIndicatorDisplays,
Display = function()
local onOff = "False"
if EID.Config["ShowModName"] then
onOff = "True"
end
return "Display mod name: " .. onOff
return "Mod indicator displayed for: " .. EID.Config["ModIndicatorDisplay"]
end,
OnChange = function(currentBool)
EID.Config["ShowModName"] = currentBool
OnChange = function(currentNum)
EID.Config["ModIndicatorDisplay"] = modIndicatorDisplays[currentNum]
end
}
)