Skip to content

Commit

Permalink
fix custom games (#1139)
Browse files Browse the repository at this point in the history
Now you can `play custom_` without going through the `customGame` scene
  • Loading branch information
ImpleLee authored Aug 26, 2024
1 parent dee6ba9 commit 5793b7c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions parts/modes/custom_clear.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require'parts.scenes.customGame'.initialize()

return {
env={},
load=function()
Expand Down
2 changes: 2 additions & 0 deletions parts/modes/custom_puzzle.lua
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
9 changes: 5 additions & 4 deletions parts/scenes/customGame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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={
Expand All @@ -87,8 +91,6 @@ local sList={
}
local modUsed

local scene={}

function scene.enter()
destroyPlayers()
BG.set(CUSTOMGAME_LOCAL.customenv.bg)
Expand Down Expand Up @@ -143,7 +145,6 @@ local function _play(mode)
end
end
saveFile(CUSTOMGAME_LOCAL.customenv,'conf/customEnv')
apply_locals()
loadGame('custom_'..mode,true)
end

Expand Down

0 comments on commit 5793b7c

Please sign in to comment.