diff --git a/eid_api.lua b/eid_api.lua index 5f2a89d3..8c40289e 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -102,14 +102,26 @@ function EID:getModDescription(list, id) end --Get the name of the given transformation by its ID -function EID:getTransformation(id) +function EID:getTransformationName(id) 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] end return str 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 function EID:getObjectName(objID, objType) if objType == "collectible" then diff --git a/eid_debugging.lua b/eid_debugging.lua index a5bc877b..f37eb5f9 100644 --- a/eid_debugging.lua +++ b/eid_debugging.lua @@ -1,3 +1,4 @@ +local showDebugChars = false local charsToDebug = { "!!! EID DEBUG MODE ACTIVATED !!!", -- Header "ABCDEFGHIJKLMNOPQRSTUVWXYZ", -- Caps letters @@ -19,10 +20,24 @@ local charsToDebug = { "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) - for i, v in ipairs(charsToDebug) do - local pos = Vector(EIDConfig["XPosition"] * EIDConfig["Scale"], EIDConfig["YPosition"] - 25 + ((i - 1) * 14)) - EID:renderString(v, pos, Vector(EIDConfig["Scale"], EIDConfig["Scale"]), KColor(1, 1, 1, 1, 0, 0, 0), true) - end + for i, v in ipairs(charsToDebug) do + 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) + + if not showDebugChars then + break + end + end end EID:AddCallback(ModCallbacks.MC_POST_RENDER, onDebugRender) diff --git a/main.lua b/main.lua index a1225068..54dfc976 100644 --- a/main.lua +++ b/main.lua @@ -128,23 +128,15 @@ function printDescription(desc) --Display Transformation if not (desc[2] == "0" or desc[2] == "" or desc[2] == nil) 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( - transformationText, + EID:getTransformationName(desc[2]), Vector(EIDConfig["XPosition"] + 16 * EIDConfig["Scale"], padding - 1), Vector(EIDConfig["Scale"], EIDConfig["Scale"]), EID:getTransformationColor(), false ) 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.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"]) IconSprite:Update() @@ -356,13 +348,13 @@ local function onRender(t) --Handle Trinkets if closest.Variant == PickupVariant.PICKUP_TRINKET then --Handle Collectibles - if closest.SubType <= 128 then - printTrinketDescription(trinketdescriptions[closest.SubType], "trinket") - elseif EID:getModDescription(__eidTrinketDescriptions, closest.SubType) then + if EID:getModDescription(__eidTrinketDescriptions, closest.SubType) then printTrinketDescription( {closest.SubType, EID:getModDescription(__eidTrinketDescriptions, closest.SubType)}, "trinket" ) + elseif closest.SubType <= 128 then + printTrinketDescription(trinketdescriptions[closest.SubType], "trinket") else printTrinketDescription({closest.SubType, EID.itemConfig:GetTrinket(closest.SubType).Description}) end