1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 18:20:36 +01:00
This commit is contained in:
Cyberpangolin 2015-07-28 22:27:58 +02:00
commit 8dae42cd3d

View File

@ -31,40 +31,6 @@ dofile(minetest.get_modpath("pclasses") .. "/api.lua")
---------------------------
-- Backup and load system
--
-- Startup
local pfile = io.open(pclasses.conf.datafile, "r")
if pfile then
local line = pfile:read()
if line then
pclasses.datas.players = minetest.deserialize(line)
end
pfile:close()
end
-- Frequent backup
local function save_datas()
local pfile = io.open(pclasses.conf.datafile, "w")
pfile:write(minetest.serialize(pclasses.datas.players))
pfile:close()
minetest.log("action", "[PClasses] Datas saved")
end
local save_timer = 0
minetest.register_globalstep(function(dtime)
save_timer = save_timer + dtime
if save_timer >= pclasses.conf.save_interval then
save_datas()
save_timer = 0
end
end)
minetest.register_on_shutdown(save_datas)
------------------ ------------------
-- Default class -- Default class
-- --