mirror of
https://gitlab.com/4w/mtimer.git
synced 2024-11-24 16:23:44 +01:00
extend chat command
This commit is contained in:
parent
028cdbf99e
commit
613ebf046d
@ -1,6 +1,6 @@
|
||||
# textdomain: mtimer
|
||||
|
||||
# Configuration Selection Menu
|
||||
# Configuration Selection Menu and chat command help
|
||||
Toggle Visibility=Sichtbarkeit umschalten
|
||||
Set Position=Position setzen
|
||||
Set Color=Farbe einstellen
|
||||
@ -8,6 +8,7 @@ Timezone Offset=Zeitzonenunterschied
|
||||
Ingame Time Representation=Spielzeit-Repräsentation
|
||||
Real World Time Representation=Realzeit-Repräsentation
|
||||
Set Timer Text=Timertext einstellen
|
||||
Open Main Menu=Hauptmenü öffnen
|
||||
|
||||
# Visibility
|
||||
mTimer Visibility=mTimer-Sichtbarkeit
|
||||
@ -17,7 +18,7 @@ Invisible=Unsichtbar
|
||||
# Generic Formspec Strings
|
||||
Default=Standard
|
||||
Exit=Verlassen
|
||||
Back=Zurück
|
||||
Main Menu=Hauptmenü
|
||||
|
||||
# Timer Weekdays
|
||||
Monday=Montag
|
||||
|
@ -1,10 +1,42 @@
|
||||
local m = mtimer
|
||||
local S = m.translator
|
||||
local fs = m.show_formspec
|
||||
local cs = minetest.chat_send_player
|
||||
|
||||
|
||||
local command = function (command)
|
||||
return minetest.colorize('cyan', '/mtimer '..command..' ')
|
||||
end
|
||||
|
||||
minetest.register_chatcommand('mtimer', {
|
||||
description = S('Configure timer display'),
|
||||
params = '<vi/po/co/tz/in/re/te/help>',
|
||||
func = function(name, parameters)
|
||||
local action = parameters:match('%a+')
|
||||
if not action then m.show_formspec.menu(name) end
|
||||
|
||||
if not minetest.get_player_by_name(name) then return end
|
||||
if not action then fs.main_menu(name) end
|
||||
|
||||
if action == 'vi' then fs.set_visibility(name) end
|
||||
if action == 'po' then fs.set_position(name) end
|
||||
if action == 'co' then fs.set_color(name) end
|
||||
if action == 'tz' then fs.timezone_offset(name) end
|
||||
if action == 'in' then fs.ingame_time(name) end
|
||||
if action == 're' then fs.real_time(name) end
|
||||
if action == 'te' then fs.timer_text(name) end
|
||||
|
||||
if action == 'help' then
|
||||
local message = {
|
||||
command('vi')..S('Set Visibility'),
|
||||
command('po')..S('Set Position'),
|
||||
command('co')..S('Set Color'),
|
||||
command('tz')..S('Timezone Offset'),
|
||||
command('in')..S('Ingame Time Representation'),
|
||||
command('re')..S('Real World Time Representation'),
|
||||
command('te')..S('Set Timer Text'),
|
||||
command(' ')..S('Open Main Menu')
|
||||
}
|
||||
cs(name, table.concat(message, '\n'))
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -2,7 +2,7 @@ local m = mtimer
|
||||
local S = m.translator
|
||||
|
||||
|
||||
mtimer.show_formspec.menu = function (player_name)
|
||||
mtimer.show_formspec.main_menu = function (player_name)
|
||||
minetest.show_formspec(player_name, 'mtimer:main_menu', [[
|
||||
size[4,7.75]
|
||||
button[0,0;4,1;set_visibility;]]..S('Set Visibility')..[[]
|
||||
@ -25,6 +25,6 @@ mtimer.show_formspec.set_visibility = function (player_name)
|
||||
button[2,0.5;2,1;invisible;]]..S('Invisible')..[[]
|
||||
button[4,0.5;2,1;default;]]..S('Default')..[[]
|
||||
button_exit[0,1.5;3,1;exit;]]..S('Exit')..[[]
|
||||
button[3,1.5;3,1;back;]]..S('Back')..[[]
|
||||
button[3,1.5;3,1;back;]]..S('Main Menu')..[[]
|
||||
]])
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
||||
|
||||
-- Back to menu from all formspecs
|
||||
if fields.back then f.menu(name) end
|
||||
if fields.back then f.main_menu(name) end
|
||||
|
||||
|
||||
-- DEBUG: Print all player meta data
|
||||
|
Loading…
Reference in New Issue
Block a user