change font loading for --luadebug

This commit is contained in:
Buurazu authored and GitHub committed 2021-11-19 23:41:07 -05:00
1 parent 6dbb6f5b98
commit 8969ef3652
1 file changed
+21 -30
+21 -30
View File
@@ -88,36 +88,25 @@ local nullVector = Vector(0,0)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
------------------------------- Load Font --------------------------------- ------------------------------- Load Font ---------------------------------
local isluadebug, os = pcall(require,"os")
local modfolder ='external item descriptions_836319872' --release mod folder name local modfolder ='external item descriptions_836319872' --release mod folder name
if isluadebug then
local userPath = os.tmpname() local function GetCurrentModPath()
userPath = string.gsub(userPath, "\\", "/") if debug then
local newPath = "" return string.sub(debug.getinfo(GetCurrentModPath).source,2) .. "/../"
if not string.find(userPath, "AppData") then end
-- Linux --use some very hacky trickery to get the path to this mod
EID.modPath = os.getenv("HOME") .. "/.local/share/binding of isaac afterbirth+ mods/"..modfolder.."/" local _, err = pcall(require, "")
else local _, basePathStart = string.find(err, "no file '", 1)
for str in string.gmatch(userPath, "([^/]+)") do local _, modPathStart = string.find(err, "no file '", basePathStart)
if str ~="AppData" then local modPathEnd, _ = string.find(err, ".lua'", modPathStart)
newPath = newPath..str.."/" local modPath = string.sub(err, modPathStart+1, modPathEnd-1)
else modPath = string.gsub(modPath, "\\", "/")
break modPath = string.gsub(modPath, "//", "/")
end modPath = string.gsub(modPath, ":/", ":\\")
end
EID.modPath = newPath.."Documents/My Games/Binding of Isaac Afterbirth+ Mods/"..modfolder.."/" return modPath
end end
else EID.modPath = GetCurrentModPath()
--use some very hacky trickery to get the path to this mod
local _, err = pcall(require, "")
local _, basePathStart = string.find(err, "no file '", 1)
local _, modPathStart = string.find(err, "no file '", basePathStart)
local modPathEnd, _ = string.find(err, ".lua'", modPathStart)
EID.modPath = string.sub(err, modPathStart + 1, modPathEnd - 1)
end
EID.modPath = string.gsub(EID.modPath, "\\", "/")
EID.modPath = string.gsub(EID.modPath, "//", "/")
EID.modPath = string.gsub(EID.modPath, ":/", ":\\")
EID.font = Font() -- init font object EID.font = Font() -- init font object
local fontFile = EID.Config["FontType"] or "default" local fontFile = EID.Config["FontType"] or "default"
@@ -376,7 +365,9 @@ end
---------------------------Handle New Room-------------------------------- ---------------------------Handle New Room--------------------------------
local isMirrorRoom = false local isMirrorRoom = false
function EID:onNewRoom() function EID:onNewRoom()
isMirrorRoom = game:GetLevel():GetCurrentRoom():IsMirrorWorld() if REPENTANCE then
isMirrorRoom = game:GetLevel():GetCurrentRoom():IsMirrorWorld()
end
end end
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom) EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------