mirror of
https://gitlab.com/4w/mtimer.git
synced 2025-01-10 06:47:32 +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
|
-- 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
|
-- it to be used of the screen location parameters in the HUD definition
|
||||||
local _mtimer_location_value = function (o)
|
local _mtimer_location_value = function (o)
|
||||||
@ -10,23 +7,42 @@ local _mtimer_location_value = function (o)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local interval = _xtend.g('mtimer_update_interval')
|
local _mtimer_get_options = function ()
|
||||||
local placeholder = _xtend.g('mtimer_placeholder')
|
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local font_color = _xtend.g('mtimer_font_color')
|
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 = {
|
local format = {
|
||||||
locale = _xtend.g('mtimer_locale'),
|
locale = _options['mtimer_locale'],
|
||||||
start = _xtend.g('mtimer_session_start'),
|
start = _options['mtimer_session_start'],
|
||||||
runtime = _xtend.g('mtimer_session_runtime'),
|
runtime = _options['mtimer_session_runtime'],
|
||||||
current = _xtend.g('mtimer_current_time'),
|
current = _options['mtimer_current_time'],
|
||||||
ingame = _xtend.g('mtimer_ingame_time'),
|
ingame = _options['mtimer_ingame_time'],
|
||||||
output = _xtend.g('mtimer_output_format')
|
output = _options['mtimer_output_format']
|
||||||
}
|
}
|
||||||
|
|
||||||
local location = {
|
local location = {
|
||||||
position = _mtimer_location_value(_xtend.g('mtimer_position')),
|
position = _mtimer_location_value(_options['mtimer_position']),
|
||||||
alignment = _mtimer_location_value(_xtend.g('mtimer_alignment')),
|
alignment = _mtimer_location_value(_options['mtimer_alignment']),
|
||||||
offset = _mtimer_location_value(_xtend.g('mtimer_offset'))
|
offset = _mtimer_location_value(_options['mtimer_offset'])
|
||||||
}
|
}
|
||||||
|
|
||||||
local playerData = {}
|
local playerData = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user