Your own save system
For a save system you wrote, or one from another library.
On this page
Whatever saves your players, it ends in a data store call. Report next to that call, with the key info it gave back: where it loads, where it saves and where it removes.
Where to put the calls
Most save systems have one function that loads and one that saves. Wrap their data store calls:
function Saves.load(key)
local ok, data, info = pcall(function()
return store:GetAsync(key)
end)
if not ok then return nil end
-- Report what was saved, before defaults are filled in.
Atomo.report(STORE_NAME, key, data, info)
return fillDefaults(data)
end
function Saves.save(key, data)
local ok, saved, info = pcall(function()
return store:UpdateAsync(key, function()
return data
end)
end)
if ok then
Atomo.report(STORE_NAME, key, saved, info)
end
return ok
end
What it needs
- The key info. If your system calls
SetAsync, or keeps the key info to itself, there is nothing to report. Change it toUpdateAsyncand pass the key info out, or Atomo sees its saves only through a full sync. - The data as it sits in the data store. If your system wraps the player’s data (in a field such as
Data), report the whole value and set the game’s Data path in Atomo to that field. - Every place that writes. Admin tools and scripts that change offline players should report too.