Added helper function to print errors in console and log
This commit is contained in:
1 parent
9597058ecc
commit
43e9e66bf2
3 files changed
+37
-25
No files matched your search
+20
-8
@@ -142,7 +142,7 @@ function EID:addCollectible(id, description, itemName, language)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
if id == -1 then
|
||||
print("EID Error: Trying to add collectible description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
EID:WriteErrorMsg("Trying to add collectible description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
end
|
||||
local modName = EID._currentMod
|
||||
@@ -161,7 +161,7 @@ function EID:addTrinket(id, description, itemName, language)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
if id == -1 then
|
||||
print("EID Error: Trying to add trinket description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
EID:WriteErrorMsg("Trying to add trinket description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
end
|
||||
EID:CreateDescriptionTableIfMissing("custom", language)
|
||||
@@ -177,7 +177,7 @@ function EID:addCharacterInfo(characterId, description, playerName, language)
|
||||
playerName = playerName or "Modded Character"
|
||||
language = language or "en_us"
|
||||
if characterId == -1 then
|
||||
print("EID Error: Trying to add character description to id = -1, which is not allowed! (Name: "..tostring(playerName).."; Description: "..tostring(description)..")")
|
||||
EID:WriteErrorMsg("Trying to add character description to id = -1, which is not allowed! (Name: "..tostring(playerName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
end
|
||||
EID:CreateDescriptionTableIfMissing("CharacterInfo", language)
|
||||
@@ -229,7 +229,7 @@ function EID:addCard(id, description, itemName, language)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
if id == -1 then
|
||||
print("EID Error: Trying to add card description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
EID:WriteErrorMsg("Trying to add card description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
end
|
||||
EID:CreateDescriptionTableIfMissing("custom", language)
|
||||
@@ -259,7 +259,7 @@ function EID:addPill(id, description, itemName, language)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
if id == -1 then
|
||||
print("EID Error: Trying to add pill description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
EID:WriteErrorMsg("Trying to add pill description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
end
|
||||
EID:CreateDescriptionTableIfMissing("pills", language)
|
||||
@@ -281,7 +281,7 @@ function EID:addHorsePill(id, description, itemName, language)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
if id == -1 then
|
||||
print("EID Error: Trying to add horsepill description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
EID:WriteErrorMsg("Trying to add horsepill description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
end
|
||||
EID:CreateDescriptionTableIfMissing("horsepills", language)
|
||||
@@ -308,7 +308,7 @@ function EID:addBirthright(characterId, description, playerName, language)
|
||||
playerName = playerName or nil
|
||||
language = language or "en_us"
|
||||
if characterId == -1 then
|
||||
print("EID Error: Trying to add Birthright description to id = -1, which is not allowed! (Name: "..tostring(characterId).."; Description: "..tostring(description)..")")
|
||||
EID:WriteErrorMsg("Trying to add Birthright description to id = -1, which is not allowed! (Name: "..tostring(characterId).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
end
|
||||
EID:CreateDescriptionTableIfMissing("birthright", language)
|
||||
@@ -557,7 +557,7 @@ function EID:loadFont(fontFileName)
|
||||
EID.font:SetMissingCharacter(2)
|
||||
---@diagnostic enable
|
||||
if not EID.font:IsLoaded() then
|
||||
Isaac.DebugString("EID - ERROR: Could not load font from '" .. EID.modPath .. "resources/font/default.fnt" .. "'")
|
||||
EID:WriteErrorMsg("Could not load font from '" .. EID.modPath .. "resources/font/default.fnt" .. "'")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
@@ -3179,3 +3179,15 @@ function EID:HasPathToPosition(startPos, endPos)
|
||||
-- return true if it has a path
|
||||
return pathfinderObj:GetPath() ~= nil
|
||||
end
|
||||
|
||||
---Prints a message in both the console and the Log file, to make important messages from EID stand out everywhere
|
||||
---@param str string
|
||||
function EID:WriteDebugMsg(str)
|
||||
print(str)
|
||||
Isaac.DebugString(str)
|
||||
end
|
||||
---Prints an error message in both the console and the Log file, to make important messages from EID stand out everywhere
|
||||
---@param str string
|
||||
function EID:WriteErrorMsg(str)
|
||||
EID:WriteDebugMsg("EID ERROR: " .. str)
|
||||
end
|
||||
Reference in new issue
Block a user