背景模块使用方法微调

This commit is contained in:
MrZ626
2020-11-09 09:37:51 +08:00
parent 126f1dee25
commit c205e30fc1
2 changed files with 13 additions and 10 deletions

View File

@@ -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(...)

View File

@@ -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))