Fix some bugs

This commit is contained in:
SweetSea-ButImNotSweet
2024-01-04 07:53:28 +07:00
parent 77232885b6
commit 8252f85720
3 changed files with 8 additions and 9 deletions

View File

@@ -334,6 +334,7 @@ do-- function DATA.saveReplay()
seed=GAME.seed,
setting=GAME.setting,
mod=_getModList(),
modPatch=GAME.modPatch,
tasUsed=GAME.tasUsed,
}
if GAME.curMode.savePrivate then
@@ -393,6 +394,7 @@ function DATA.parseReplayData(fileName,fileData,ifFull)
seed=metaData.seed,
setting=metaData.setting,
mod=metaData.mod,
modPatch=metaData.modPatch,
tasUsed=metaData.tasUsed,
}
if ifFull then rep.data=fileData end

View File

@@ -666,14 +666,6 @@ function gameOver()
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

@@ -212,12 +212,17 @@ local function _loadGameEnv(P)-- Load gameEnv
if not GAME.ApplyModsTask then
GAME.ApplyModsTask=function()
while true do
while GAME.playing do
for _,p in pairs(GAME.modCodeList) do
for _,c in pairs(p) do pcall(c) end
end
coroutine.yield()
end
-- Kill mod patching function when game stopped
TASK.removeTask_code(GAME.ApplyModsTask)
TABLE.cut(GAME.modCodeList)
GAME.modCodeList=nil
GAME.ApplyModsTask=nil
end
TASK.new(GAME.ApplyModsTask)
end