2019-02-16 16:45:32 +01:00
|
|
|
local modpath = minetest.get_modpath('mtimer')..DIR_DELIM
|
|
|
|
local syspath = modpath..'system'..DIR_DELIM
|
2019-02-22 16:00:18 +01:00
|
|
|
local S = minetest.get_translator('mtimer')
|
2019-02-16 16:45:32 +01:00
|
|
|
|
|
|
|
|
2019-02-22 20:33:42 +01:00
|
|
|
-- Set initial global `mtimer` table
|
|
|
|
--
|
|
|
|
-- The sub-table `show_formspec` is filled programmatically and is used for the
|
|
|
|
-- functions that show the formspecs to the player.
|
|
|
|
--
|
|
|
|
-- In sub-table `meta` the meta keys and their default values are defined. Those
|
|
|
|
-- are iterated over when a player joins. The names are searched for whenever
|
|
|
|
-- somewhere in the code a meta information is to be loaded.
|
|
|
|
--
|
|
|
|
-- @see ./system/formspec/formspec_creation.lua
|
2019-02-16 16:45:32 +01:00
|
|
|
mtimer = {
|
2019-02-22 16:00:18 +01:00
|
|
|
translator = S,
|
2019-02-16 16:45:32 +01:00
|
|
|
show_formspec = {},
|
|
|
|
meta = {
|
|
|
|
visible = { key = 'mtimer:visible', default = 'true' },
|
2019-02-17 01:31:10 +01:00
|
|
|
position = { key = 'mtimer:position', default = 'bl' },
|
2019-02-22 15:29:08 +01:00
|
|
|
color = { key = 'mtimer:color', default = '#ffffff' },
|
2019-02-19 13:40:19 +01:00
|
|
|
timezone_offset = { key = 'mtimer:timezone_offset', default = '0' },
|
2019-02-22 14:08:44 +01:00
|
|
|
ingame_time = {
|
|
|
|
key = 'mtimer:ingame_time_format',
|
|
|
|
default = '{24h}:{min}'
|
|
|
|
},
|
|
|
|
real_time = {
|
|
|
|
key = 'mtimer:real_time_format',
|
|
|
|
default = '{24h}:{min} ({isodate})'
|
|
|
|
},
|
2019-02-21 21:07:35 +01:00
|
|
|
session_start_time = {
|
|
|
|
key = 'mtimer:session_start_time_format',
|
|
|
|
default = '{isodate}T{isotime}'
|
|
|
|
},
|
|
|
|
session_duration = {
|
|
|
|
key = 'mtimer:session_duration_format',
|
|
|
|
default = '{hours}:{minutes}'
|
2019-02-22 14:08:44 +01:00
|
|
|
},
|
|
|
|
timer_format = {
|
|
|
|
key = 'mtimer:timer_format',
|
2019-02-22 16:00:18 +01:00
|
|
|
default = table.concat({
|
|
|
|
S('Current Date: @1', '{rd}'),
|
|
|
|
S('Ingame Time: @1', '{it}'),
|
|
|
|
S('Session Start: @1', '{st}'),
|
|
|
|
S('Session Duration: @1', '{sd}')
|
|
|
|
}, '\n')
|
|
|
|
}
|
2019-02-16 16:45:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-02-21 21:07:35 +01:00
|
|
|
-- Load formspec functionality
|
|
|
|
dofile(syspath..'formspec'..DIR_DELIM..'formspec_helpers.lua')
|
|
|
|
dofile(syspath..'formspec'..DIR_DELIM..'real_time_universal.lua')
|
|
|
|
dofile(syspath..'formspec'..DIR_DELIM..'formspec_creation.lua')
|
|
|
|
|
2019-02-22 20:33:42 +01:00
|
|
|
|
2019-02-21 21:07:35 +01:00
|
|
|
-- Load system
|
2019-02-16 16:45:32 +01:00
|
|
|
dofile(syspath..'chat_command.lua')
|
2019-02-22 15:50:32 +01:00
|
|
|
dofile(syspath..'update_timer.lua')
|
2019-02-16 16:45:32 +01:00
|
|
|
dofile(syspath..'on_receive_fields.lua')
|
|
|
|
dofile(syspath..'on_joinplayer.lua')
|
2019-02-21 14:37:58 +01:00
|
|
|
dofile(syspath..'get_times.lua')
|
2019-02-22 14:08:44 +01:00
|
|
|
dofile(syspath..'get_timer_data.lua')
|
2019-02-22 15:50:32 +01:00
|
|
|
dofile(syspath..'register_globalstep.lua')
|