fix custom games (#1139)

Now you can `play custom_` without going through the `customGame` scene
This commit is contained in:
Imple Lee
2024-08-26 11:20:48 +08:00
committed by GitHub
parent dee6ba95f2
commit 5793b7ca38
3 changed files with 9 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
require'parts.scenes.customGame'.initialize()
return {
env={},
load=function()

View File

@@ -1,6 +1,8 @@
local gc_setColor,gc_draw=love.graphics.setColor,love.graphics.draw
local ply_applyField=PLY.draw.applyField
require'parts.scenes.customGame'.initialize()
return {
env={
fkey1=function(P) P.modeData.showMark=1-P.modeData.showMark end,

View File

@@ -23,7 +23,10 @@ local function apply_locals()
TABLE.clear(CUSTOMENV)
TABLE.cover(CUSTOMGAME_LOCAL.customenv,CUSTOMENV)
end
do -- Initialize fields, sequence, missions, gameEnv for cutsom game
local scene={}
function scene.initialize() -- Initialize fields, sequence, missions, gameEnv for cutsom game
local fieldData=loadFile('conf/customBoards','-string -canSkip')
local fieldReinit=false
if not fieldData then
@@ -64,6 +67,7 @@ do -- Initialize fields, sequence, missions, gameEnv for cutsom game
TABLE.complete(customData,CUSTOMGAME_LOCAL.customenv)
end
TABLE.complete(require"parts.customEnv0",CUSTOMGAME_LOCAL.customenv)
apply_locals()
end
local sList={
@@ -87,8 +91,6 @@ local sList={
}
local modUsed
local scene={}
function scene.enter()
destroyPlayers()
BG.set(CUSTOMGAME_LOCAL.customenv.bg)
@@ -143,7 +145,6 @@ local function _play(mode)
end
end
saveFile(CUSTOMGAME_LOCAL.customenv,'conf/customEnv')
apply_locals()
loadGame('custom_'..mode,true)
end