feat: capture data-only battle checkpoints

This commit is contained in:
MaxTomahawk
2026-08-07 16:22:43 +02:00
parent 24d9f279ec
commit 67b6dcc293
3 changed files with 306 additions and 0 deletions
+20
View File
@@ -5,6 +5,7 @@ local SaveSerializer = require("src.core.SaveSerializer")
local SaveData = require("src.core.SaveData")
local Version = require("src.core.Version")
local BattleState = require("src.battle.BattleState")
local BattleCheckpoint = require("src.core.BattleCheckpoint")
local Checkpoint = {}
@@ -172,6 +173,25 @@ function Checkpoint.capture(game)
.. tostring(err)
end
if capability.kind == "battle" then
local battle = game.stack:top()
local runtime, rngOrCode, battleMessage =
BattleCheckpoint.capture(game, battle, progress, dataCopy)
if not runtime then return nil, rngOrCode, battleMessage end
return {
format = Checkpoint.FORMAT,
kind = "battle",
identity = {
engineVersion = Version.engine,
gameVersion = game.save.version,
playthroughId = game.save.meta.playthroughId,
},
save = progress,
runtime = runtime,
rng = rngOrCode,
}
end
local player = game.overworld.player
return {
format = Checkpoint.FORMAT,