diff options
author | Alexander Weber <web.alexander@web.de> | 2016-09-05 21:02:53 +0200 |
---|---|---|
committer | Alexander Weber <web.alexander@web.de> | 2016-09-05 21:02:53 +0200 |
commit | 8aef2c19bab48d552c1701f22a273b6b521e51fa (patch) | |
tree | 2708416623a65fa2d28ba08380e4d8f3dfd091f7 /players.lua | |
parent | be8fa19b68f7362bce5bd0b519c61b0c743eb851 (diff) |
The u_skins is a mod, not a modpack. Moved u_skins to the root and all updater stuff to the (new) updater directory
Diffstat (limited to 'players.lua')
-rw-r--r-- | players.lua | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/players.lua b/players.lua new file mode 100644 index 0000000..3053530 --- /dev/null +++ b/players.lua @@ -0,0 +1,40 @@ +u_skins.load_players = function() + local file = io.open(u_skins.file, "r") + if file then + for line in file:lines() do + local data = string.split(line, " ", 2) + u_skins.u_skins[data[1]] = data[2] + end + io.close(file) + end +end +u_skins.load_players() + +local ttime = 0 +minetest.register_globalstep(function(t) + ttime = ttime + t + if ttime < 360 then --every 6min' + return + end + ttime = 0 + u_skins.save() +end) + +minetest.register_on_shutdown(function() u_skins.save() end) + +u_skins.save = function() + if not u_skins.file_save then + return + end + u_skins.file_save = false + local output = io.open(u_skins.file, "w") + for name, skin in pairs(u_skins.u_skins) do + if name and skin then + if skin ~= u_skins.default then + output:write(name.." "..skin.."\n") + end + end + end + io.close(output) +end + |