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
+13 -22
+13 -22
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
-- Linux
EID.modPath = os.getenv("HOME") .. "/.local/share/binding of isaac afterbirth+ mods/"..modfolder.."/"
else
for str in string.gmatch(userPath, "([^/]+)") do
if str ~="AppData" then
newPath = newPath..str.."/"
else
break
end end
end
EID.modPath = newPath.."Documents/My Games/Binding of Isaac Afterbirth+ Mods/"..modfolder.."/"
end
else
--use some very hacky trickery to get the path to this mod --use some very hacky trickery to get the path to this mod
local _, err = pcall(require, "") local _, err = pcall(require, "")
local _, basePathStart = string.find(err, "no file '", 1) local _, basePathStart = string.find(err, "no file '", 1)
local _, modPathStart = string.find(err, "no file '", basePathStart) local _, modPathStart = string.find(err, "no file '", basePathStart)
local modPathEnd, _ = string.find(err, ".lua'", modPathStart) local modPathEnd, _ = string.find(err, ".lua'", modPathStart)
EID.modPath = string.sub(err, modPathStart + 1, modPathEnd - 1) local modPath = string.sub(err, modPathStart+1, modPathEnd-1)
modPath = string.gsub(modPath, "\\", "/")
modPath = string.gsub(modPath, "//", "/")
modPath = string.gsub(modPath, ":/", ":\\")
return modPath
end end
EID.modPath = string.gsub(EID.modPath, "\\", "/") EID.modPath = GetCurrentModPath()
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,8 +365,10 @@ end
---------------------------Handle New Room-------------------------------- ---------------------------Handle New Room--------------------------------
local isMirrorRoom = false local isMirrorRoom = false
function EID:onNewRoom() function EID:onNewRoom()
if REPENTANCE then
isMirrorRoom = game:GetLevel():GetCurrentRoom():IsMirrorWorld() 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)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
---------------------------Handle Rendering-------------------------------- ---------------------------Handle Rendering--------------------------------