mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-15 06:50:31 +01:00
Removed classes' save system to unlock class determination at reboot
This commit is contained in:
parent
019b1e2864
commit
060b810c52
|
@ -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
|
||||
--
|
||||
|
|
Loading…
Reference in New Issue
Block a user