mtimer/system/on_joinplayer.lua

22 lines
558 B
Lua
Raw Normal View History

2019-02-16 16:45:32 +01:00
local m = mtimer
minetest.register_on_joinplayer(function(player)
local meta = player:get_meta()
2019-02-22 15:29:08 +01:00
2019-02-16 16:45:32 +01:00
for _,def in pairs(m.meta) do
local current = meta:get_string(def.key)
if current == '' then meta:set_string(def.key, def.default) end
end
2019-02-22 15:29:08 +01:00
meta:set_string('mtimer:session_start', os.time())
2019-02-22 15:29:08 +01:00
meta:set_string('mtimer:hud_id', player:hud_add({
hud_elem_type = 'text',
text = '',
number = '0x000000',
position = {x=0,y=0},
alignment = {x=0,y=0},
offset = {x=0,y=0}
}))
2019-02-16 16:45:32 +01:00
end)