/usr/share/games/instead/stead/snapshots.lua is in instead-data 1.9.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | game._snapshots = {}
stead.make_snapshot = function(nr)
if not tonumber(nr) then nr = 0 end
local h = { };
h.txt = ''
h.write = function(s, ...)
local i
local a = {...};
for i = 1, stead.table.maxn(a) do
s.txt = s.txt .. tostring(a[i]);
end
end
local old = game._snapshots; game._snapshots = nil
stead.do_savegame(game, h);
game._snapshots = old
game._snapshots[nr] = h.txt;
end
function isSnapshot(nr)
if not tonumber(nr) then nr = 0 end
return (game._snapshots[nr] ~= nil)
end
stead.restore_snapshot = function (nr)
if not tonumber(nr) then nr = 0 end
local ss = game._snapshots
if not ss[nr] then return nil, true end -- nothing todo
local i,v
if stead.api_version >= "1.7.1" then
stead.gamereset("main.lua", true);
else
stead.gamefile("main.lua", true);
end
local f, err = stead.eval(ss[nr]..' ');
if not f then return end
local i,r = f();
game._snapshots = ss
if r then
return nil, false
end
i = stead.do_ini(game, true);
if stead.api_version >= "1.7.1" then
game:start()
stead.started = true
PLAYER_MOVED = true -- force fading
end
RAW_TEXT = true
-- delete_snapshot(nr);
if stead.cctx() then
stead.pr(i)
end
return i;
end
stead.delete_snapshot = function(nr)
if not tonumber(nr) then nr = 0 end
game._snapshots[nr] = nil
end
function make_snapshot(nr)
if type(nr) ~= 'number' then
nr = 0
end
MAKE_SNAPSHOT = nr
end
function restore_snapshot(nr)
return stead.restore_snapshot(nr)
end
function delete_snapshot(nr)
return stead.delete_snapshot(nr);
end
iface.cmd = stead.hook(iface.cmd, function(f, ...)
local r,v = f(...);
if MAKE_SNAPSHOT ~= nil then
stead.make_snapshot(MAKE_SNAPSHOT);
MAKE_SNAPSHOT = nil
end
return r,v
end)
-- vim:ts=4
|