feat: expose stable overworld checkpoints to mods

This commit is contained in:
MaxTomahawk
2026-08-07 14:49:45 +02:00
parent 0399ad040f
commit 6e94625f2a
6 changed files with 568 additions and 15 deletions
+10
View File
@@ -571,6 +571,7 @@ function Loader:_api(mod)
local modId = mod.manifest.id
local Storage = engineRequire("src.mods.Storage")
local storage = Storage and Storage.new(modId, loader.fs)
local Checkpoint = engineRequire("src.core.Checkpoint")
local api = {
id = modId,
version = mod.manifest.version,
@@ -670,6 +671,15 @@ function Loader:_api(mod)
list = function(_, game, prefix) return storage:list(game, prefix) end,
delete = function(_, game, key) return storage:delete(game, key) end,
},
-- Runtime safety and reconstruction stay engine-owned. Checkpoints contain
-- data only; no controller, stack, coroutine or renderer object crosses out.
checkpoints = {
inspect = function(_, game) return Checkpoint.inspect(game) end,
capture = function(_, game) return Checkpoint.capture(game) end,
restore = function(_, game, checkpoint)
return Checkpoint.restore(game, checkpoint)
end,
},
options = {
define = function(_, schema)
assert(type(schema) == "table", "options schema must be a table of rows")