Formatted api and main file
This commit is contained in:
1 parent
2a6d330e2c
commit
bfa6addf65
3 files changed
+156
-102
No files matched your search
+119
-55
@@ -68,18 +68,66 @@ EID.TRANSFORMATION = {
|
||||
|
||||
-- List of item Types
|
||||
EID.ItemTypeAnm2Names = {
|
||||
"null", -- 1
|
||||
"passive", -- 2
|
||||
"active", -- 3
|
||||
"familiar", -- 4
|
||||
"trinket" -- 5
|
||||
"null", -- 1
|
||||
"passive", -- 2
|
||||
"active", -- 3
|
||||
"familiar", -- 4
|
||||
"trinket" -- 5
|
||||
}
|
||||
---------------------------------------------------------------------------
|
||||
-------------------------Handle API Functions -----------------------------
|
||||
|
||||
-- Adds a description for a collectible. Optional parameters: itemName, language, transformations
|
||||
function EID:addCollectible(id, description, itemName, language, transformations)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
transformations = transformations or "0"
|
||||
EID.descriptions[language].custom["collectible_" .. id] = {id, transformations, itemName, description}
|
||||
end
|
||||
|
||||
-- Adds a description for a trinket. Optional parameters: itemName, language, transformations
|
||||
function EID:addTrinket(id, description, itemName, language, transformations)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
transformations = transformations or "0"
|
||||
EID.descriptions[language].custom["trinket_" .. id] = {id, transformations, itemName, description}
|
||||
end
|
||||
|
||||
-- Adds a description for a card/rune. Optional parameters: itemName, language, transformations
|
||||
function EID:addCard(id, description, itemName, language, transformations)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
transformations = transformations or "0"
|
||||
EID.descriptions[language].custom["card_" .. id] = {id, transformations, itemName, description}
|
||||
end
|
||||
|
||||
-- Adds a description for a pilleffect id. Optional parameters: itemName, language, transformations
|
||||
function EID:addPill(id, description, itemName, language, transformations)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
transformations = transformations or "0"
|
||||
EID.descriptions[language].custom["pill_" .. id] = {id, transformations, itemName, description}
|
||||
end
|
||||
|
||||
-- Adds a description for a pilleffect id. Optional parameters: language, transformations
|
||||
-- when subtype is -1 or empty, it will affect all subtypes of that entity
|
||||
function EID:addEntity(id, variant, subtype, entityName, description, language, transformations)
|
||||
subtype = subtype or nil
|
||||
language = language or "en_us"
|
||||
transformations = transformations or "0"
|
||||
EID.descriptions[language].custom[id .. "." .. variant .. "." .. subtype] = {
|
||||
id,
|
||||
variant,
|
||||
subtype,
|
||||
entityName,
|
||||
description,
|
||||
transformations
|
||||
}
|
||||
end
|
||||
|
||||
-- Returns if EID is displaying text right now
|
||||
function EID:isDisplayingText()
|
||||
return isDisplayingText
|
||||
return EID.isDisplayingText
|
||||
end
|
||||
|
||||
-- Returns true, if curse of blind is active
|
||||
@@ -94,7 +142,7 @@ end
|
||||
|
||||
-- returns the entity that is currently described. returns last described entity if currently not displaying text
|
||||
function EID:getLastDescribedEntity()
|
||||
return lastDescriptionEntity
|
||||
return EID.lastDescriptionEntity
|
||||
end
|
||||
|
||||
-- returns descriptions from the legacy mod descriptions if they exist
|
||||
@@ -114,8 +162,8 @@ function EID:getLegacyModDescription(objTable, id)
|
||||
end
|
||||
end
|
||||
|
||||
-- returns the specified object table in the current language.
|
||||
-- falls back to english if it doesnt exist
|
||||
-- returns the specified object table in the current language.
|
||||
-- falls back to english if it doesnt exist
|
||||
function EID:getDescriptionTable(objTable)
|
||||
return EID.descriptions[EIDConfig["Language"]][objTable] or EID.descriptions["en_us"][objTable]
|
||||
end
|
||||
@@ -123,22 +171,23 @@ end
|
||||
-- returns the description object of the specified object table translated with the current language
|
||||
-- falls back to english if the objID isnt available
|
||||
function EID:getDescriptionObj(objTable, objID)
|
||||
local tableEntry = EID.descriptions[EIDConfig["Language"]][objTable][objID] or EID.descriptions["en_us"][objTable][objID] or {}
|
||||
|
||||
local tableEntry =
|
||||
EID.descriptions[EIDConfig["Language"]][objTable][objID] or EID.descriptions["en_us"][objTable][objID] or {}
|
||||
|
||||
local description = {}
|
||||
description.ID = objID
|
||||
|
||||
|
||||
description.Name = EID:getObjectName(objID, objTable) or objTable
|
||||
|
||||
|
||||
local legacyModdedDescription = EID:getLegacyModDescription(objTable, objID)
|
||||
description.Description = legacyModdedDescription or tableEntry[4] or "MISSING DESCRIPTION"
|
||||
|
||||
|
||||
local legacyModdedTransformation = nil
|
||||
if objTable == "collectibles" then
|
||||
legacyModdedTransformation = EID:getLegacyModDescription("transformations", objID)
|
||||
end
|
||||
description.Transformation = legacyModdedTransformation or tableEntry[2] or "0"
|
||||
|
||||
|
||||
return description
|
||||
end
|
||||
|
||||
@@ -155,28 +204,28 @@ end
|
||||
function EID:getObjectName(objID, objType)
|
||||
local tableEntry = EID.descriptions[EIDConfig["Language"]][objType][objID] or EID.descriptions["en_us"][objType][objID]
|
||||
if objType == "collectibles" then
|
||||
if EIDConfig["Language"]~="en_us" and #tableEntry==4 then
|
||||
if EIDConfig["Language"] ~= "en_us" and #tableEntry == 4 then
|
||||
if tableEntry[3] ~= nil and tableEntry[3] ~= "" then
|
||||
return tableEntry[3]
|
||||
end
|
||||
end
|
||||
return EID.itemConfig:GetCollectible(objID).Name
|
||||
elseif objType == "trinkets" then
|
||||
if EIDConfig["Language"]~="en_us" and #tableEntry==3 then
|
||||
if EIDConfig["Language"] ~= "en_us" and #tableEntry == 3 then
|
||||
if tableEntry[3] ~= nil and tableEntry[3] ~= "" then
|
||||
return tableEntry[3]
|
||||
end
|
||||
end
|
||||
return EID.itemConfig:GetTrinket(objID).Name
|
||||
elseif objType == "cards" then
|
||||
if EIDConfig["Language"]~="en_us" and #tableEntry==3 then
|
||||
if EIDConfig["Language"] ~= "en_us" and #tableEntry == 3 then
|
||||
if tableEntry[3] ~= nil and tableEntry[3] ~= "" then
|
||||
return tableEntry[3]
|
||||
end
|
||||
end
|
||||
return EID.itemConfig:GetCard(objID).Name
|
||||
elseif objType == "pills" then
|
||||
if EIDConfig["Language"]~="en_us" and #tableEntry==3 then
|
||||
if EIDConfig["Language"] ~= "en_us" and #tableEntry == 3 then
|
||||
if tableEntry[3] ~= nil and tableEntry[3] ~= "" then
|
||||
return tableEntry[3]
|
||||
end
|
||||
@@ -198,7 +247,7 @@ function EID:hasDescription(entity)
|
||||
local isAllowed = false
|
||||
if EIDConfig["EnableEntityDescriptions"] then
|
||||
isAllowed = __eidEntityDescriptions[entity.Type .. "." .. entity.Variant .. "." .. entity.SubType] ~= nil
|
||||
--isAllowed = isAllowed or type(entity:GetData()["EID_Description"]) ~= type(nil)
|
||||
--isAllowed = isAllowed or type(entity:GetData()["EID_Description"]) ~= type(nil)
|
||||
end
|
||||
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and EIDConfig["DisplayItemInfo"])
|
||||
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TRINKET and EIDConfig["DisplayTrinketInfo"])
|
||||
@@ -209,7 +258,7 @@ end
|
||||
|
||||
-- Replaces shorthand-representations of a character with the internal reference
|
||||
function EID:replaceShortMarkupStrings(text)
|
||||
for _,pair in ipairs(EID.TextReplacementPairs) do
|
||||
for _, pair in ipairs(EID.TextReplacementPairs) do
|
||||
text = string.gsub(text, pair[1], pair[2])
|
||||
end
|
||||
return text
|
||||
@@ -228,8 +277,17 @@ end
|
||||
-- Returns the inlineIcon object of a given Iconstring
|
||||
-- can be used to validate an iconstring
|
||||
function EID:getIcon(str)
|
||||
if str == nil then return EID.InlineIcons["ERROR"] end
|
||||
local strTrimmed = string.gsub(str, "{{(.-)}}", function(a) return a end)
|
||||
if str == nil then
|
||||
return EID.InlineIcons["ERROR"]
|
||||
end
|
||||
local strTrimmed =
|
||||
string.gsub(
|
||||
str,
|
||||
"{{(.-)}}",
|
||||
function(a)
|
||||
return a
|
||||
end
|
||||
)
|
||||
if #strTrimmed <= #str then
|
||||
return EID.InlineIcons[strTrimmed] or EID.InlineIcons["ERROR"]
|
||||
else
|
||||
@@ -239,14 +297,16 @@ end
|
||||
|
||||
-- Returns the icon for a given transformation name or ID
|
||||
function EID:getTransformationIcon(str)
|
||||
if str == nil then return EID.InlineIcons["ERROR"] end
|
||||
if str == nil then
|
||||
return EID.InlineIcons["ERROR"]
|
||||
end
|
||||
if tonumber(str) ~= nil then
|
||||
str = EID.descriptions["en_us"].transformations[tonumber(str+1)]
|
||||
str = EID.descriptions["en_us"].transformations[tonumber(str + 1)]
|
||||
end
|
||||
local transformSprite = EID:getIcon(str:gsub(" ", ""))
|
||||
if transformSprite[1] == "ERROR" then
|
||||
transformSprite = EID:getIcon("CustomTransformation")
|
||||
end
|
||||
end
|
||||
return transformSprite
|
||||
end
|
||||
|
||||
@@ -263,7 +323,7 @@ function EID:filterIconMarkup(text, textPosX, textPosY)
|
||||
local textposition = string.find(text, word)
|
||||
local lookup = EID:getIcon(word)
|
||||
local preceedingTextWidth = EID:getStrWidth(string.sub(text, 0, textposition - 1)) * EIDConfig["Scale"]
|
||||
table.insert(spriteTable,{lookup, preceedingTextWidth})
|
||||
table.insert(spriteTable, {lookup, preceedingTextWidth})
|
||||
text = string.gsub(text, word, EID:generatePlaceholderString(lookup[3]), 1)
|
||||
end
|
||||
return text, spriteTable
|
||||
@@ -272,25 +332,21 @@ end
|
||||
--renders a list of given inline sprite objects returned by the "EID:filterIconMarkup()" function
|
||||
-- Table entry format: {EID.InlineIcons Object, Width of text preceeding the icon}
|
||||
function EID:renderInlineIcons(spriteTable, posX, posY)
|
||||
for _,sprite in ipairs(spriteTable) do
|
||||
for _, sprite in ipairs(spriteTable) do
|
||||
local Xoffset = sprite[1][5] or -1
|
||||
local Yoffset = sprite[1][6] or 0
|
||||
local spriteObj = sprite[1][7] or EID.InlineIconSprite
|
||||
spriteObj:SetFrame(sprite[1][1], sprite[1][2])
|
||||
spriteObj.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
|
||||
spriteObj.Color = Color(1,1,1,EIDConfig["Transparency"],0,0,0)
|
||||
spriteObj:Render(
|
||||
Vector((posX + sprite[2] + Xoffset), posY + Yoffset),
|
||||
Vector(0, 0),
|
||||
Vector(0, 0)
|
||||
)
|
||||
spriteObj.Color = Color(1, 1, 1, EIDConfig["Transparency"], 0, 0, 0)
|
||||
spriteObj:Render(Vector((posX + sprite[2] + Xoffset), posY + Yoffset), Vector(0, 0), Vector(0, 0))
|
||||
end
|
||||
end
|
||||
|
||||
-- Returns the icon used for the bulletpoint. It will look at the first word in the given string.
|
||||
function EID:handleBulletpointIcon(text)
|
||||
local firstWord = string.match(text, "([^%s]+)")
|
||||
if EID:getIcon(firstWord) ~= EID.InlineIcons["ERROR"] then
|
||||
if EID:getIcon(firstWord) ~= EID.InlineIcons["ERROR"] then
|
||||
return firstWord
|
||||
end
|
||||
return "\007"
|
||||
@@ -301,10 +357,17 @@ end
|
||||
function EID:getColor(str, baseKColor)
|
||||
local color = baseKColor
|
||||
local isColorMarkup = false
|
||||
if str ~= nil then
|
||||
local strTrimmed = string.gsub(str, "{{(.-)}}", function(a) return a end)
|
||||
if str ~= nil then
|
||||
local strTrimmed =
|
||||
string.gsub(
|
||||
str,
|
||||
"{{(.-)}}",
|
||||
function(a)
|
||||
return a
|
||||
end
|
||||
)
|
||||
if #strTrimmed <= #str then
|
||||
if type(EID.InlineColors[strTrimmed]) =="function" then
|
||||
if type(EID.InlineColors[strTrimmed]) == "function" then
|
||||
color = EID.InlineColors[strTrimmed](color)
|
||||
else
|
||||
color = EID.InlineColors[strTrimmed] or color
|
||||
@@ -328,15 +391,15 @@ function EID:filterColorMarkup(text, baseKColor)
|
||||
local lookup, isColor = EID:getColor(word, lastColor)
|
||||
if isColor then
|
||||
local preceedingText = string.sub(text, lastPosition, textposition - 1)
|
||||
local preceedingTextWidth = EID:getStrWidth(preceedingText)*EIDConfig["Scale"]
|
||||
local preceedingTextWidth = EID:getStrWidth(preceedingText) * EIDConfig["Scale"]
|
||||
lastPosition = textposition
|
||||
table.insert(textPartsTable,{preceedingText, lastColor, preceedingTextWidth})
|
||||
table.insert(textPartsTable, {preceedingText, lastColor, preceedingTextWidth})
|
||||
lastColor = lookup
|
||||
text = string.gsub(text, word, "", 1)
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(textPartsTable,{string.sub(text, lastPosition), lastColor, 0})
|
||||
|
||||
table.insert(textPartsTable, {string.sub(text, lastPosition), lastColor, 0})
|
||||
return textPartsTable
|
||||
end
|
||||
|
||||
@@ -349,12 +412,12 @@ function EID:fitTextToWidth(str, textboxWidth)
|
||||
for word in string.gmatch(str, "([^%s]+)") do
|
||||
local colorFiltered = EID:filterColorMarkup(word, EID:getTextColor())
|
||||
local filteredWord = ""
|
||||
for _,filtered in ipairs(colorFiltered) do
|
||||
filteredWord = filteredWord..filtered[1]
|
||||
for _, filtered in ipairs(colorFiltered) do
|
||||
filteredWord = filteredWord .. filtered[1]
|
||||
end
|
||||
local strFiltered, spriteTable = EID:filterIconMarkup(filteredWord, 0, 0)
|
||||
local wordLength = EID:getStrWidth(strFiltered)
|
||||
|
||||
|
||||
if curLength + wordLength <= textboxWidth or curLength < 12 then
|
||||
text = text .. word .. " "
|
||||
curLength = curLength + wordLength
|
||||
@@ -382,17 +445,18 @@ function EID:renderString(str, position, scale, kcolor)
|
||||
EID:renderInlineIcons(spriteTable, position.X, position.Y)
|
||||
EID.font:DrawStringScaledUTF8(strFiltered, position.X + offsetX, position.Y, scale.X, scale.Y, textPart[2], 0, false)
|
||||
offsetX = offsetX + textPart[3]
|
||||
end
|
||||
end
|
||||
return textPartsTable[#textPartsTable][2]
|
||||
end
|
||||
|
||||
-- Interpolates between 2 KColors with a given fraction.
|
||||
-- Interpolates between 2 KColors with a given fraction.
|
||||
function EID:interpolateColors(kColor1, kColor2, fraction)
|
||||
local t = KColor(
|
||||
(kColor2.Red-kColor1.Red)*fraction+kColor1.Red,
|
||||
(kColor2.Green-kColor1.Green)*fraction+kColor1.Green,
|
||||
(kColor2.Blue-kColor1.Blue)*fraction+kColor1.Blue,
|
||||
(kColor2.Alpha-kColor1.Alpha)*fraction+kColor1.Alpha,
|
||||
local t =
|
||||
KColor(
|
||||
(kColor2.Red - kColor1.Red) * fraction + kColor1.Red,
|
||||
(kColor2.Green - kColor1.Green) * fraction + kColor1.Green,
|
||||
(kColor2.Blue - kColor1.Blue) * fraction + kColor1.Blue,
|
||||
(kColor2.Alpha - kColor1.Alpha) * fraction + kColor1.Alpha,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
@@ -402,11 +466,11 @@ end
|
||||
|
||||
-- Creates a copy of a KColor object. This prevents overwriting existing
|
||||
function EID:copyKColor(colorObj)
|
||||
return KColor(colorObj.Red,colorObj.Green,colorObj.Blue,colorObj.Alpha,0,0,0)
|
||||
return KColor(colorObj.Red, colorObj.Green, colorObj.Blue, colorObj.Alpha, 0, 0, 0)
|
||||
end
|
||||
|
||||
-- Compares two KColors. Returns true if they are equal
|
||||
function EID:areColorsEqual(c1,c2)
|
||||
function EID:areColorsEqual(c1, c2)
|
||||
return c1.Red == c2.Red and c1.Green == c2.Green and c1.Blue == c2.Blue and c1.Alpha == c2.Alpha
|
||||
end
|
||||
|
||||
@@ -460,4 +524,4 @@ function EID:getErrorColor()
|
||||
0,
|
||||
0
|
||||
)
|
||||
end
|
||||
end
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
local showDebugChars = false
|
||||
local showDebugChars = true
|
||||
local charsToDebug = {
|
||||
"!!! EID DEBUG MODE ACTIVATED !!!", -- Header
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 1234567890", -- Basic chars
|
||||
|
||||
@@ -2,9 +2,9 @@ EID = RegisterMod("External Item Descriptions", 1)
|
||||
EID.itemConfig = Isaac.GetItemConfig()
|
||||
EID.descriptions = {} -- Table that holds all translation strings
|
||||
|
||||
EID.isDisplayingText = false
|
||||
EID.lastDescriptionEntity = nil
|
||||
local lineHeight = 11
|
||||
local isDisplayingText = false
|
||||
local lastDescriptionEntity = nil
|
||||
local hideDescToggle = false
|
||||
EID.sacrificeCounter = 1
|
||||
|
||||
@@ -26,7 +26,7 @@ require("mod_config_menu")
|
||||
--languages
|
||||
require("descriptions.ab+.en_us")
|
||||
require("descriptions.ab+.en_us_detailed")
|
||||
require("descriptions.ab+.bul") -- WIP
|
||||
require("descriptions.ab+.bul") -- WIP
|
||||
require("descriptions.ab+.fr")
|
||||
--require("descriptions.ab+.pl") -- WIP
|
||||
require("descriptions.ab+.pt")
|
||||
@@ -87,7 +87,7 @@ end
|
||||
function printDescription(desc)
|
||||
local padding = posY()
|
||||
local itemType = -1
|
||||
if tonumber(desc.ID)~=nil then
|
||||
if tonumber(desc.ID) ~= nil then
|
||||
itemType = EID.itemConfig:GetCollectible(tonumber(desc.ID)).Type or -1
|
||||
end
|
||||
--Display ItemType / Charge
|
||||
@@ -99,19 +99,11 @@ function printDescription(desc)
|
||||
EID.IconSprite:Play(EID.ItemTypeAnm2Names[itemType])
|
||||
EID.IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
|
||||
EID.IconSprite:Update()
|
||||
EID.IconSprite:Render(
|
||||
Vector(EIDConfig["XPosition"], padding + offsetY),
|
||||
Vector(0, 0),
|
||||
Vector(0, 0)
|
||||
)
|
||||
EID.IconSprite:Render(Vector(EIDConfig["XPosition"], padding + offsetY), Vector(0, 0), Vector(0, 0))
|
||||
if itemType == 3 then -- Display Charge
|
||||
EID.IconSprite:Play(EID.itemConfig:GetCollectible(desc.ID).MaxCharges)
|
||||
EID.IconSprite:Update()
|
||||
EID.IconSprite:Render(
|
||||
Vector(EIDConfig["XPosition"], padding + offsetY),
|
||||
Vector(0, 0),
|
||||
Vector(0, 0)
|
||||
)
|
||||
EID.IconSprite:Render(Vector(EIDConfig["XPosition"], padding + offsetY), Vector(0, 0), Vector(0, 0))
|
||||
end
|
||||
if not EIDConfig["ShowItemName"] then
|
||||
padding = padding + lineHeight * EIDConfig["Scale"]
|
||||
@@ -152,7 +144,7 @@ function printDescription(desc)
|
||||
local iconSprite = transformSprite[7] or EID.InlineIconSprite
|
||||
iconSprite:Play(transformSprite[1])
|
||||
iconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
|
||||
iconSprite.Color = Color(1,1,1,EIDConfig["Transparency"],0,0,0)
|
||||
iconSprite.Color = Color(1, 1, 1, EIDConfig["Transparency"], 0, 0, 0)
|
||||
iconSprite:Render(
|
||||
Vector(EIDConfig["XPosition"] + iconOffsetX * EIDConfig["Scale"], padding + iconOffsetY * EIDConfig["Scale"]),
|
||||
Vector(0, 0),
|
||||
@@ -160,7 +152,7 @@ function printDescription(desc)
|
||||
)
|
||||
end
|
||||
if EIDConfig["TransformationText"] then
|
||||
local textOffsetY = math.min(0,(iconHeight-9))/4
|
||||
local textOffsetY = math.min(0, (iconHeight - 9)) / 4
|
||||
EID:renderString(
|
||||
transformationName,
|
||||
Vector(EIDConfig["XPosition"] + iconWidth + 4, padding + textOffsetY),
|
||||
@@ -173,10 +165,10 @@ function printDescription(desc)
|
||||
end
|
||||
end
|
||||
end
|
||||
printBulletPoints(desc.Description, padding)
|
||||
EID:printBulletPoints(desc.Description, padding)
|
||||
end
|
||||
|
||||
function printBulletPoints(description, padding)
|
||||
function EID:printBulletPoints(description, padding)
|
||||
local textboxWidth = tonumber(EIDConfig["TextboxWidth"]) * 4
|
||||
description = EID:replaceShortMarkupStrings(description)
|
||||
for line in string.gmatch(description, "([^#]+)") do
|
||||
@@ -184,21 +176,18 @@ function printBulletPoints(description, padding)
|
||||
local textColor = EID:getTextColor()
|
||||
for i, lineToPrint in ipairs(formatedLines) do
|
||||
-- render bulletpoint
|
||||
local posX = EIDConfig["XPosition"]
|
||||
local posX = EIDConfig["XPosition"]
|
||||
if i == 1 then
|
||||
local bpIcon = EID:handleBulletpointIcon(lineToPrint)
|
||||
if EID:getIcon(bpIcon) ~= EID.InlineIcons["ERROR"] then
|
||||
lineToPrint = string.gsub(lineToPrint, bpIcon .. " ", "")
|
||||
end
|
||||
|
||||
textColor = EID:renderString(bpIcon, Vector(posX, padding), Vector(EIDConfig["Scale"], EIDConfig["Scale"]), textColor)
|
||||
textColor =
|
||||
EID:renderString(bpIcon, Vector(posX, padding), Vector(EIDConfig["Scale"], EIDConfig["Scale"]), textColor)
|
||||
end
|
||||
textColor = EID:renderString(
|
||||
lineToPrint,
|
||||
Vector(posX + 12, padding),
|
||||
Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
|
||||
textColor
|
||||
)
|
||||
textColor =
|
||||
EID:renderString(lineToPrint, Vector(posX + 12, padding), Vector(EIDConfig["Scale"], EIDConfig["Scale"]), textColor)
|
||||
padding = padding + lineHeight * EIDConfig["Scale"]
|
||||
end
|
||||
end
|
||||
@@ -207,7 +196,7 @@ end
|
||||
---------------------------------------------------------------------------
|
||||
---------------------------Handle Rendering--------------------------------
|
||||
|
||||
function renderQuestionMark()
|
||||
function EID:renderQuestionMark()
|
||||
IconSprite:Play("CurseOfBlind")
|
||||
IconSprite.Scale = Vector(EIDConfig["Scale"], EIDConfig["Scale"])
|
||||
IconSprite:Update()
|
||||
@@ -221,7 +210,7 @@ function renderQuestionMark()
|
||||
end
|
||||
end
|
||||
|
||||
function renderIndicator(entity)
|
||||
function EID:renderIndicator(entity)
|
||||
if EIDConfig["Indicator"] == "blink" then
|
||||
local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40))
|
||||
entity:SetColor(Color(1, 1, 1, 1, c, c, c), 1, 1, false, false)
|
||||
@@ -258,7 +247,7 @@ end
|
||||
---------------------------On Render Function------------------------------
|
||||
|
||||
local function onRender(t)
|
||||
isDisplayingText = false
|
||||
EID.isDisplayingText = false
|
||||
local player = Isaac.GetPlayer(0)
|
||||
local closest = nil
|
||||
local closestDice = nil
|
||||
@@ -292,7 +281,7 @@ local function onRender(t)
|
||||
Game():GetRoom():GetType() == RoomType.ROOM_DICE and EIDConfig["DisplayDiceInfo"] and type(closestDice) ~= type(nil)
|
||||
then
|
||||
printDescription(EID:getDescriptionObj("dice", closestDice.SubType + 1))
|
||||
renderIndicator(closestDice)
|
||||
EID:renderIndicator(closestDice)
|
||||
end
|
||||
return
|
||||
end
|
||||
@@ -300,42 +289,44 @@ local function onRender(t)
|
||||
if closest == nil then
|
||||
return
|
||||
end
|
||||
lastDescriptionEntity = closest
|
||||
isDisplayingText = true
|
||||
EID.lastDescriptionEntity = closest
|
||||
EID.isDisplayingText = true
|
||||
|
||||
--Handle Indicators
|
||||
renderIndicator(closest)
|
||||
EID:renderIndicator(closest)
|
||||
--
|
||||
|
||||
--Handle Entities (specific)
|
||||
--[[ if EIDConfig["EnableEntityDescriptions"] and type(closest:GetData()["EID_Description"]) ~= type(nil) then
|
||||
--[[ if EIDConfig["EnableEntityDescriptions"] and type(closest:GetData()["EID_Description"]) ~= type(nil) then
|
||||
printTrinketDescription({closest.Type, closest:GetData()["EID_Description"]}, "custom")
|
||||
return
|
||||
end
|
||||
]]--
|
||||
--Handle Entities (omni)
|
||||
]] --Handle Entities (omni)
|
||||
local objIDString = closest.Type .. "." .. closest.Variant .. "." .. closest.SubType
|
||||
local tableEntry = EID.descriptions[EIDConfig["Language"]]["custom"][objIDString]
|
||||
or EID.descriptions["en_us"]["custom"][objIDString] or EID:getLegacyModDescription("custom", objIDString) or nil
|
||||
if EIDConfig["EnableEntityDescriptions"] and tableEntry~=nil then
|
||||
local tableEntry =
|
||||
EID.descriptions[EIDConfig["Language"]]["custom"][objIDString] or EID.descriptions["en_us"]["custom"][objIDString] or
|
||||
EID:getLegacyModDescription("custom", objIDString) or
|
||||
nil
|
||||
if EIDConfig["EnableEntityDescriptions"] and tableEntry ~= nil then
|
||||
printDescription(EID:getDescriptionObj("custom", objIDString))
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
--Handle Trinkets
|
||||
if closest.Variant == PickupVariant.PICKUP_TRINKET then
|
||||
printDescription(EID:getDescriptionObj("trinkets", closest.SubType))
|
||||
--Handle Collectibles
|
||||
printDescription(EID:getDescriptionObj("trinkets", closest.SubType))
|
||||
elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then
|
||||
--Handle Cards & Runes
|
||||
if EID:hasCurseBlind() and EIDConfig["DisableOnCurse"] then
|
||||
renderQuestionMark()
|
||||
EID:renderQuestionMark()
|
||||
return
|
||||
end
|
||||
printDescription(EID:getDescriptionObj("collectibles", closest.SubType))
|
||||
--Handle Cards & Runes
|
||||
elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then
|
||||
--Handle Pills
|
||||
if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayCardInfoShop"] then
|
||||
renderQuestionMark()
|
||||
EID:renderQuestionMark()
|
||||
return
|
||||
end
|
||||
printDescription(EID:getDescriptionObj("cards", closest.SubType))
|
||||
@@ -353,10 +344,9 @@ local function onRender(t)
|
||||
Vector(0, 0)
|
||||
)
|
||||
end
|
||||
--Handle Pills
|
||||
elseif closest.Variant == PickupVariant.PICKUP_PILL then
|
||||
if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayPillInfoShop"] then
|
||||
renderQuestionMark()
|
||||
EID:renderQuestionMark()
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user