Fixed some issues relating to custom descriptions

This commit is contained in:
wofsauge committed 2020-09-26 19:23:32 +02:00
1 parent f4efb1b3c5
commit c1fe8f2697
3 files changed
+35 -16

No files matched your search

+14 -2
View File
@@ -102,14 +102,26 @@ function EID:getModDescription(list, id)
end end
--Get the name of the given transformation by its ID --Get the name of the given transformation by its ID
function EID:getTransformation(id) function EID:getTransformationName(id)
local str = "Custom" local str = "Custom"
if (tonumber(id) <= #transformations - 1) then if tonumber(id) == nil then
return id
elseif EID:isVanillaTransformationID(id) then
return transformations[tonumber(id) + 1] return transformations[tonumber(id) + 1]
end end
return str return str
end end
--Returns true, if the transformation has a vanilla icon
function EID:isVanillaTransformationID(id)
if tonumber(id) ~= nil then
if (tonumber(id) <= #transformations - 1) then
return true
end
end
return false
end
-- tries to get the ingame name of an item based on its ID -- tries to get the ingame name of an item based on its ID
function EID:getObjectName(objID, objType) function EID:getObjectName(objID, objType)
if objType == "collectible" then if objType == "collectible" then
+16 -1
View File
@@ -1,3 +1,4 @@
local showDebugChars = false
local charsToDebug = { local charsToDebug = {
"!!! EID DEBUG MODE ACTIVATED !!!", -- Header "!!! EID DEBUG MODE ACTIVATED !!!", -- Header
"ABCDEFGHIJKLMNOPQRSTUVWXYZ", -- Caps letters "ABCDEFGHIJKLMNOPQRSTUVWXYZ", -- Caps letters
@@ -19,10 +20,24 @@ local charsToDebug = {
"Markup roomshapes: |{{Room}}|{{RoomLongHorizontal}}|{{RoomLongThinHorizontal}}|{{RoomSmallHorizontal}}|{{RoomLBottomRight}}|{{RoomSmallVertical}}|{{RoomLBottomLeft}}|{{RoomLTopLeft}}|{{RoomL}}|{{RoomLongVertical}}|{{RoomXL}}|{{RoomLongThinVertical}}|" "Markup roomshapes: |{{Room}}|{{RoomLongHorizontal}}|{{RoomLongThinHorizontal}}|{{RoomSmallHorizontal}}|{{RoomLBottomRight}}|{{RoomSmallVertical}}|{{RoomLBottomLeft}}|{{RoomLTopLeft}}|{{RoomL}}|{{RoomLongVertical}}|{{RoomXL}}|{{RoomLongThinVertical}}|"
} }
-- Legacy Overriding descriptions
__eidItemDescriptions[1] = "\1 Overriden" -- 5.100.1 = Sad Onion
__eidTrinketDescriptions[1] = "\2 Overriden " -- 5.350.1 = swallowed penny
__eidCardDescriptions[1] = "Overriden Card description" -- 5.300.1 = the fool
__eidPillDescriptions[1] = "Test" -- Doesnt seem to work
-- Legacy add Description
__eidItemTransformations[1] = "Test Transformation"
__eidEntityDescriptions["5.10.1"] = {"Entity Name","Entity description"} -- Adds description to full red hearts
local function onDebugRender(t) local function onDebugRender(t)
for i, v in ipairs(charsToDebug) do for i, v in ipairs(charsToDebug) do
local pos = Vector(EIDConfig["XPosition"] * EIDConfig["Scale"], EIDConfig["YPosition"] - 25 + ((i - 1) * 14)) local pos = Vector(EIDConfig["XPosition"] * EIDConfig["Scale"], EIDConfig["YPosition"] - 15 + ((i - 1) * 14))
EID:renderString(v, pos, Vector(EIDConfig["Scale"], EIDConfig["Scale"]), KColor(1, 1, 1, 1, 0, 0, 0), true) EID:renderString(v, pos, Vector(EIDConfig["Scale"], EIDConfig["Scale"]), KColor(1, 1, 1, 1, 0, 0, 0), true)
if not showDebugChars then
break
end
end end
end end
EID:AddCallback(ModCallbacks.MC_POST_RENDER, onDebugRender) EID:AddCallback(ModCallbacks.MC_POST_RENDER, onDebugRender)
+5 -13
View File
@@ -128,23 +128,15 @@ function printDescription(desc)
--Display Transformation --Display Transformation
if not (desc[2] == "0" or desc[2] == "" or desc[2] == nil) then if not (desc[2] == "0" or desc[2] == "" or desc[2] == nil) then
if EIDConfig["TransformationText"] then if EIDConfig["TransformationText"] then
local transformationText = ""
if not (EID:getTransformation(desc[2]) == "Custom") then
transformationText = EID:getTransformation(desc[2])
elseif not (transformations[desc[2]]) then --Custom transformationname
transformationText = desc[2]
else
transformationText = EID:getTransformation(desc[2])
end
EID:renderString( EID:renderString(
transformationText, EID:getTransformationName(desc[2]),
Vector(EIDConfig["XPosition"] + 16 * EIDConfig["Scale"], padding - 1), Vector(EIDConfig["XPosition"] + 16 * EIDConfig["Scale"], padding - 1),
Vector(EIDConfig["Scale"], EIDConfig["Scale"]), Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
EID:getTransformationColor(), EID:getTransformationColor(),
false false
) )
end end
if EIDConfig["TransformationIcons"] and not (EID:getTransformation(desc[2]) == "Custom") then if EIDConfig["TransformationIcons"] and EID:isVanillaTransformationID(desc[2]) then
IconSprite:Play("Transformation" .. desc[2]) IconSprite:Play("Transformation" .. desc[2])
IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"]) IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
IconSprite:Update() IconSprite:Update()
@@ -356,13 +348,13 @@ local function onRender(t)
--Handle Trinkets --Handle Trinkets
if closest.Variant == PickupVariant.PICKUP_TRINKET then if closest.Variant == PickupVariant.PICKUP_TRINKET then
--Handle Collectibles --Handle Collectibles
if closest.SubType <= 128 then if EID:getModDescription(__eidTrinketDescriptions, closest.SubType) then
printTrinketDescription(trinketdescriptions[closest.SubType], "trinket")
elseif EID:getModDescription(__eidTrinketDescriptions, closest.SubType) then
printTrinketDescription( printTrinketDescription(
{closest.SubType, EID:getModDescription(__eidTrinketDescriptions, closest.SubType)}, {closest.SubType, EID:getModDescription(__eidTrinketDescriptions, closest.SubType)},
"trinket" "trinket"
) )
elseif closest.SubType <= 128 then
printTrinketDescription(trinketdescriptions[closest.SubType], "trinket")
else else
printTrinketDescription({closest.SubType, EID.itemConfig:GetTrinket(closest.SubType).Description}) printTrinketDescription({closest.SubType, EID.itemConfig:GetTrinket(closest.SubType).Description})
end end