mirror of
https://gitlab.com/4w/mtimer.git
synced 2025-01-09 14:27:42 +01:00
make independent from xtend_default
This commit is contained in:
parent
e9e625bcf4
commit
dd9716e30d
46
init.lua
46
init.lua
@ -1,6 +1,3 @@
|
||||
_xtend.i()
|
||||
|
||||
|
||||
-- Convert a given x,y string into a table {x=given_x, y=given_y} and return
|
||||
-- it to be used of the screen location parameters in the HUD definition
|
||||
local _mtimer_location_value = function (o)
|
||||
@ -10,23 +7,42 @@ local _mtimer_location_value = function (o)
|
||||
end
|
||||
|
||||
|
||||
local interval = _xtend.g('mtimer_update_interval')
|
||||
local placeholder = _xtend.g('mtimer_placeholder')
|
||||
local font_color = _xtend.g('mtimer_font_color')
|
||||
local _mtimer_get_options = function ()
|
||||
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||
local file = io.open(path..DIR_DELIM..'settingtypes.txt', 'rb')
|
||||
local result = {}
|
||||
|
||||
for line in file:lines() do
|
||||
if line:match("^([a-zA-Z])") then
|
||||
local name = line:gsub(' .+', '')
|
||||
local default_value = line:gsub('^[^ ]+ %b() %a+ ', '')
|
||||
local set_value = minetest.setting_get(name)
|
||||
result[name] = set_value or default_value
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local _options = _mtimer_get_options()
|
||||
|
||||
local interval = _options['mtimer_update_interval']
|
||||
local placeholder = _options['mtimer_placeholder']
|
||||
local font_color = _options['mtimer_font_color']
|
||||
|
||||
local format = {
|
||||
locale = _xtend.g('mtimer_locale'),
|
||||
start = _xtend.g('mtimer_session_start'),
|
||||
runtime = _xtend.g('mtimer_session_runtime'),
|
||||
current = _xtend.g('mtimer_current_time'),
|
||||
ingame = _xtend.g('mtimer_ingame_time'),
|
||||
output = _xtend.g('mtimer_output_format')
|
||||
locale = _options['mtimer_locale'],
|
||||
start = _options['mtimer_session_start'],
|
||||
runtime = _options['mtimer_session_runtime'],
|
||||
current = _options['mtimer_current_time'],
|
||||
ingame = _options['mtimer_ingame_time'],
|
||||
output = _options['mtimer_output_format']
|
||||
}
|
||||
|
||||
local location = {
|
||||
position = _mtimer_location_value(_xtend.g('mtimer_position')),
|
||||
alignment = _mtimer_location_value(_xtend.g('mtimer_alignment')),
|
||||
offset = _mtimer_location_value(_xtend.g('mtimer_offset'))
|
||||
position = _mtimer_location_value(_options['mtimer_position']),
|
||||
alignment = _mtimer_location_value(_options['mtimer_alignment']),
|
||||
offset = _mtimer_location_value(_options['mtimer_offset'])
|
||||
}
|
||||
|
||||
local playerData = {}
|
||||
|
Loading…
Reference in New Issue
Block a user