mirror of
https://gitlab.com/4w/mtimer.git
synced 2024-11-28 10:13:50 +01:00
rename xTimer to MTimer
This commit is contained in:
parent
42d6333578
commit
e9e625bcf4
32
init.lua
32
init.lua
@ -3,30 +3,30 @@ _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 _xtimer_location_value = function (o)
|
||||
local _mtimer_location_value = function (o)
|
||||
local x = o:gsub(',[^,]+$', '')
|
||||
local y = o:gsub('^[^,]+,', '')
|
||||
return {x=x, y=y}
|
||||
end
|
||||
|
||||
|
||||
local interval = _xtend.g('xtimer_update_interval')
|
||||
local placeholder = _xtend.g('xtimer_placeholder')
|
||||
local font_color = _xtend.g('xtimer_font_color')
|
||||
local interval = _xtend.g('mtimer_update_interval')
|
||||
local placeholder = _xtend.g('mtimer_placeholder')
|
||||
local font_color = _xtend.g('mtimer_font_color')
|
||||
|
||||
local format = {
|
||||
locale = _xtend.g('xtimer_locale'),
|
||||
start = _xtend.g('xtimer_session_start'),
|
||||
runtime = _xtend.g('xtimer_session_runtime'),
|
||||
current = _xtend.g('xtimer_current_time'),
|
||||
ingame = _xtend.g('xtimer_ingame_time'),
|
||||
output = _xtend.g('xtimer_output_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')
|
||||
}
|
||||
|
||||
local location = {
|
||||
position = _xtimer_location_value(_xtend.g('xtimer_position')),
|
||||
alignment = _xtimer_location_value(_xtend.g('xtimer_alignment')),
|
||||
offset = _xtimer_location_value(_xtend.g('xtimer_offset'))
|
||||
position = _mtimer_location_value(_xtend.g('mtimer_position')),
|
||||
alignment = _mtimer_location_value(_xtend.g('mtimer_alignment')),
|
||||
offset = _mtimer_location_value(_xtend.g('mtimer_offset'))
|
||||
}
|
||||
|
||||
local playerData = {}
|
||||
@ -47,7 +47,7 @@ minetest.register_on_joinplayer(function(player)
|
||||
startTime = os.time(),
|
||||
hudID = _hudID
|
||||
}
|
||||
minetest.after(5, _xtimer_changeText, player)
|
||||
minetest.after(5, _mtimer_changeText, player)
|
||||
end, player)
|
||||
end)
|
||||
|
||||
@ -58,7 +58,7 @@ minetest.register_on_leaveplayer(function(player)
|
||||
end)
|
||||
|
||||
|
||||
function _xtimer_changeText(player)
|
||||
function _mtimer_changeText(player)
|
||||
local playerName = player:get_player_name()
|
||||
if playerName == '' then return end
|
||||
|
||||
@ -92,5 +92,5 @@ function _xtimer_changeText(player)
|
||||
os.setlocale(currentLocale) -- Restore game-detected locale
|
||||
|
||||
player:hud_change(hudID, 'text', res)
|
||||
minetest.after(interval, _xtimer_changeText, player)
|
||||
minetest.after(interval, _mtimer_changeText, player)
|
||||
end
|
||||
|
@ -2,7 +2,7 @@
|
||||
# fast when accessed through the API there is no need in
|
||||
# setting this to 1 second. The default of 30 seconds is
|
||||
# absolutely fine.
|
||||
xtimer_update_interval (Seconds between updates) int 30
|
||||
mtimer_update_interval (Seconds between updates) int 30
|
||||
|
||||
# The string will be displayed as provided here. There
|
||||
# are some variables.
|
||||
@ -12,11 +12,11 @@ xtimer_update_interval (Seconds between updates) int 30
|
||||
# +r = Runtime of the current session
|
||||
# +i = Current ingame time in 24h format
|
||||
# +n = Following output will be in a new line
|
||||
xtimer_output_format (Output string formatting) string Aufnahmesitzung vom +s+nAktuelle Uhrzeit: +c+nSpieldauer: +r, Ingame-Zeit: +i
|
||||
mtimer_output_format (Output string formatting) string Aufnahmesitzung vom +s+nAktuelle Uhrzeit: +c+nSpieldauer: +r, Ingame-Zeit: +i
|
||||
|
||||
# A placeholder text that is shown before the timer
|
||||
# function gets executed the first time
|
||||
xtimer_placeholder (Placeholder for the timer) string [xTimer ...]
|
||||
mtimer_placeholder (Placeholder for the timer) string [MTimer ...]
|
||||
|
||||
# The font color for the timer text
|
||||
#
|
||||
@ -26,7 +26,7 @@ xtimer_placeholder (Placeholder for the timer) string [xTimer ...]
|
||||
#
|
||||
# Use the hexadecimal color notation here (“HTML notation”
|
||||
# but without the `#` sign in front).
|
||||
xtimer_font_color (Font color for the timer text) string babdb6
|
||||
mtimer_font_color (Font color for the timer text) string babdb6
|
||||
|
||||
|
||||
[Time Formatting]
|
||||
@ -34,7 +34,7 @@ xtimer_font_color (Font color for the timer text) string babdb6
|
||||
# Time when the current session was started. The session
|
||||
# is based on when the user connected to the world. The
|
||||
# format is this: https://www.lua.org/pil/22.1.html
|
||||
xtimer_session_start ([+s] Session start time) string %d. %B %Y, %H:%M Uhr
|
||||
mtimer_session_start ([+s] Session start time) string %d. %B %Y, %H:%M Uhr
|
||||
|
||||
# A hours:minutes timer that allows tracking of the
|
||||
# current play time. The timer breaks if game time
|
||||
@ -43,12 +43,12 @@ xtimer_session_start ([+s] Session start time) string %d. %B %Y, %H:%M Uhr
|
||||
# +h = Hours
|
||||
# +m = Minutes
|
||||
# +s = Seconds
|
||||
xtimer_session_runtime ([+r] Session runtime) string +h:+m
|
||||
mtimer_session_runtime ([+r] Session runtime) string +h:+m
|
||||
|
||||
# The current real-world time according to what the OS
|
||||
# provides. Formatting this string is quite easy by using
|
||||
# those tags: https://www.lua.org/pil/22.1.html
|
||||
xtimer_current_time ([+c] Current time) string %d. %B %Y, %H:%M Uhr
|
||||
mtimer_current_time ([+c] Current time) string %d. %B %Y, %H:%M Uhr
|
||||
|
||||
# Ingame time in 24 hours format that was converted
|
||||
# the provided decimal number and might not be 100
|
||||
@ -56,12 +56,12 @@ xtimer_current_time ([+c] Current time) string %d. %B %Y, %H:%M Uhr
|
||||
#
|
||||
# +h = hours with leading zeros
|
||||
# +m = minutes with leading zeros
|
||||
xtimer_ingame_time ([+i] Ingame time) string +h:+m Uhr
|
||||
mtimer_ingame_time ([+i] Ingame time) string +h:+m Uhr
|
||||
|
||||
# Locale that will be used for the time formatting. The
|
||||
# locale has to be provided by your system. On Linux see
|
||||
# command `locale` for valid locales to use.
|
||||
xtimer_locale (Format output locale) string de_DE.utf8
|
||||
mtimer_locale (Format output locale) string de_DE.utf8
|
||||
|
||||
|
||||
[Positioning]
|
||||
@ -73,7 +73,7 @@ xtimer_locale (Format output locale) string de_DE.utf8
|
||||
# without spaces.
|
||||
#
|
||||
# See http://dev.minetest.net/HUD#Fields
|
||||
xtimer_position (Position) string 0,1
|
||||
mtimer_position (Position) string 0,1
|
||||
|
||||
# "Specifies how the item will be aligned. It ranges
|
||||
# from -1 to 1, with 0 being the center, -1 is moved to
|
||||
@ -81,7 +81,7 @@ xtimer_position (Position) string 0,1
|
||||
# numbers with a comma but without spaces.
|
||||
#
|
||||
# See http://dev.minetest.net/HUD#Fields
|
||||
xtimer_alignment (Alignment) string 1,-1
|
||||
mtimer_alignment (Alignment) string 1,-1
|
||||
|
||||
# "Specifies a pixel offset from the position. Not scaled
|
||||
# to the screen size. [It adapts] to screen DPI as well
|
||||
@ -89,4 +89,4 @@ xtimer_alignment (Alignment) string 1,-1
|
||||
# numbers with a comma but without spaces.
|
||||
#
|
||||
# See http://dev.minetest.net/HUD#Fields
|
||||
xtimer_offset (Offset) string 4,0
|
||||
mtimer_offset (Offset) string 4,0
|
||||
|
Loading…
Reference in New Issue
Block a user