mtimer/system/on_joinplayer.lua
Dirk Sohler 89cd1f6212
implement ingame time format setting
Convert ingame time to millihours and calculate the timestamp from this.
It results in a default timestampo that is parsed by default date and
time functions.

Replacement variables:

{24h} = 24 hours time
{12h} = 12 hours time
{min} = minutes
{its} = ingame timestamp

For some reason I was not able to get the am/pm indicator (`%p`) so 12
hours format is only the time and no optional indicator.
2019-02-21 16:16:10 +01:00

11 lines
325 B
Lua

local m = mtimer
minetest.register_on_joinplayer(function(player)
local meta = player:get_meta()
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
meta:set_string('mtimer:session_start', os.time())
end)