Final push

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-01-02 19:02:43 +07:00
parent 478eb0774f
commit b3ca43fa69
7 changed files with 48 additions and 15 deletions

View File

@@ -593,7 +593,8 @@ function loadGame(mode,ifQuickPlay,ifNet)-- Load a mode and go to game scene
end
end
end
function gameOver()-- Save record
function gameOver()
-- Save record
if GAME.replaying then
local R=GAME.curMode.getRank
if R then
@@ -665,6 +666,14 @@ function gameOver()-- Save record
end
end
end
-- Kill mod patching function
if GAME.ApplyModsTask then
TASK.removeTask_code(GAME.ApplyModsTask)
TABLE.cut(GAME.modCodeList)
GAME.modCodeList=nil
GAME.ApplyModsTask=nil
end
end
function trySave()
if not GAME.statSaved and PLAYERS[1] and PLAYERS[1].type=='human' and (PLAYERS[1].frameRun>300 or GAME.result) then

View File

@@ -364,7 +364,9 @@ do-- Mod data
{no=1,id="HL",name="hold",
key="w",x=200,y=230,color='lO',
list={0,1,2,3,4,5,6},
func=function(P,O) P.gameEnv.holdCount=O end,
func=function(P,O,F)
if P.gameEnv.holdCount==O then return end
if F then P:setHold(O) else P.gameEnv.holdCount=O end end,
unranked=true,
},
{no=2,id="FL",name="hideNext",
@@ -410,7 +412,11 @@ do-- Mod data
{no=9,id="DT",name="dropDelay",
key="a",x=140,y=350,color='lR',
list={0,.125,.25,.5,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
func=function(P,O) P.gameEnv.drop=O end,
func=function(P,O,F)
if P.gameEnv.drop==O then return end
P.gameEnv.drop=O
if F then P:set20G(O==0) end
end,
unranked=true,
},
{no=10,id="LT",name="lockDelay",
@@ -522,6 +528,7 @@ do-- Game data tables
curMode=false, -- Current gamemode object
initPlayerCount=0, -- Player count when init game
mod=TABLE.new(0,#MODOPT),-- List of loaded mods
modPatch=false, -- Mods can lock value to prevent changes? False by default to compactible with old replays (from 0.17 to 0.17.15)
modeEnv=false, -- Current gamemode environment
setting={}, -- Game settings
rep={}, -- Recording list, key,time,key,time...

View File

@@ -449,6 +449,7 @@ C. Gamepad
},
mod={
title="Mods",
modPatch="Enable mod patch",
reset="Reset (tab)",
unranked="Unranked",
},

View File

@@ -237,7 +237,7 @@ return {
noRotation="No Rotation\nKhông thể xoay gạch",
noMove="No Movement\nKhông thể di chuyển trái phải",
customSeq="Randomizer\nGhi đè trình xáo gạch",
pushSpeed="Garbage Speed\nGhi đ tốc độ xuất hiện của hàng rác",
pushSpeed="Garbage Speed\nGhi đè tốc độ xuất hiện rác",
boneBlock="[ ]\nChơi với skin [ ]",
},
pauseStat={
@@ -457,6 +457,7 @@ C. Tay cầm chơi game (Gamepad):
mod={
title="Mods",
reset="Đặt lại (tab)",
modPatch="Bật bản vá mod",
unranked="Không tính điểm",
},
pause={

View File

@@ -200,22 +200,33 @@ local function _loadGameEnv(P)-- Load gameEnv
end
end
if ENV.allowMod then
if SETTING.forceMod or ENV.forceMod then
-- Psudeo code
MOD_CODE_LIST={}
if GAME.modPatch then
GAME.modCodeList={}
for i=1,#GAME.mod do
if GAME.mod[i]>0 then
local M=MODOPT[i]
table.insert(MOD_CODE_LIST,function() M.func(P,M.list and M.list[GAME.mod[i]]) end)
if not GAME.modCodeList[P.id] then GAME.modCodeList[P.id]={} end
table.insert(GAME.modCodeList[P.id], function() M.func(P,M.list and M.list[GAME.mod[i]],true) end)
end
end
MOD_BATCH_TASK=function() for _,c in pairs(MOD_CODE_LIST) do c() end end
TASK.new(MOD_BATCH_TASK)
if not GAME.ApplyModsTask then
GAME.ApplyModsTask=function()
while true do
for _,p in pairs(GAME.modCodeList) do
for _,c in pairs(p) do pcall(c) end
end
coroutine.yield()
end
end
TASK.new(GAME.ApplyModsTask)
end
else
for i=1,#GAME.mod do
if GAME.mod[i]>0 then
local M=MODOPT[i]
M.func(P,M.list and M.list[GAME.mod[i]])
M.func(P,M.list and M.list[GAME.mod[i]],false)
end
end
end

View File

@@ -2786,6 +2786,9 @@ function Player:_die()
end
end
end
if GAME.ApplyModsTask then
TABLE.cut(GAME.modCodeList[self.id])
end
end
function Player:update(dt)
self.trigFrame=self.trigFrame+dt*60

View File

@@ -143,10 +143,11 @@ function scene.draw()
end
scene.widgetList={
WIDGET.newText{name='title', x=80,y=50,font=70,align='L'},
WIDGET.newText{name='unranked',x=1200,y=60,color='Y',font=50,align='R'},
WIDGET.newButton{name='reset', x=1140,y=540,w=170,h=80,font=25,code=pressKey'tab'},
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
WIDGET.newText{name='title', x=80,y=50,font=70,align='L'},
WIDGET.newText{name='unranked', x=1200,y=60,color='Y',font=50,align='R'},
WIDGET.newSwitch{name='modPatch',x=1175,y=550,font=20,disp=function() return GAME.modPatch end,code=function() GAME.modPatch=not GAME.modPatch end},
WIDGET.newButton{name='reset', x=1095,y=640,w=80,h=80,font=60,fText=CHAR.icon.trash,code=pressKey'tab'},
WIDGET.newButton{name='back', x=1185,y=640,w=80,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
}
return scene