diff --git a/Zframework/bg.lua b/Zframework/bg.lua index c8d60c27..908c98b2 100644 --- a/Zframework/bg.lua +++ b/Zframework/bg.lua @@ -9,16 +9,9 @@ local BG={ discard=NULL, } ---Load Background files from SOURCE ONLY -for _,v in next,love.filesystem.getDirectoryItems("parts/backgrounds")do - if love.filesystem.getRealDirectory("parts/backgrounds/"..v)~=SAVEDIR then - local name=v:sub(1,-5) - BGlist[name]=require("parts/backgrounds/"..name) - else - LOG.print("Dangerous file : %SAVE%/parts/backgrounds/"..v) - end +function BG.add(name,bg) + BGlist[name]=bg end - function BG.send(...) if BG.event then BG.event(...) diff --git a/main.lua b/main.lua index f22f03f2..9f2717e8 100644 --- a/main.lua +++ b/main.lua @@ -130,7 +130,17 @@ AIFUNC= require("parts/ai") MODES= require("parts/modes") TICK= require("parts/tick") ---Load Scene files from SOURCE ONLY +--Load background files from SOURCE ONLY +for _,v in next,love.filesystem.getDirectoryItems("parts/backgrounds")do + if love.filesystem.getRealDirectory("parts/backgrounds/"..v)~=SAVEDIR then + local name=v:sub(1,-5) + BG.add(name,require("parts/backgrounds/"..name)) + else + LOG.print("Dangerous file : %SAVE%/parts/backgrounds/"..v) + end +end + +--Load scene files from SOURCE ONLY for _,v in next,fs.getDirectoryItems("parts/scenes")do if fs.getRealDirectory("parts/scenes/"..v)~=SAVEDIR then require("parts/scenes/"..v:sub(1,-5))