[CSM] Allow escaping chatcommands and add missing calls to gettext. (#5565)
This commit is contained in:
parent
a3e7372686
commit
4e2479e46a
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
|
|
||||||
core.register_on_sending_chat_messages(function(message)
|
core.register_on_sending_chat_messages(function(message)
|
||||||
|
if message:sub(1,2) == ".." then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local first_char = message:sub(1,1)
|
local first_char = message:sub(1,1)
|
||||||
if first_char == "/" or first_char == "." then
|
if first_char == "/" or first_char == "." then
|
||||||
core.display_chat_message(core.gettext("issued command: ") .. message)
|
core.display_chat_message(core.gettext("issued command: ") .. message)
|
||||||
|
@ -12,9 +16,7 @@ core.register_on_sending_chat_messages(function(message)
|
||||||
end
|
end
|
||||||
|
|
||||||
local cmd, param = string.match(message, "^%.([^ ]+) *(.*)")
|
local cmd, param = string.match(message, "^%.([^ ]+) *(.*)")
|
||||||
if not param then
|
param = param or ""
|
||||||
param = ""
|
|
||||||
end
|
|
||||||
|
|
||||||
if not cmd then
|
if not cmd then
|
||||||
core.display_chat_message(core.gettext("-!- Empty command"))
|
core.display_chat_message(core.gettext("-!- Empty command"))
|
||||||
|
@ -36,15 +38,15 @@ core.register_on_sending_chat_messages(function(message)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
core.register_chatcommand("list_players", {
|
core.register_chatcommand("list_players", {
|
||||||
description = "List online players",
|
description = core.gettext("List online players"),
|
||||||
func = function(param)
|
func = function(param)
|
||||||
local players = table.concat(core.get_player_names(), ", ")
|
local players = table.concat(core.get_player_names(), ", ")
|
||||||
core.display_chat_message("Online players: " .. players)
|
core.display_chat_message(core.gettext("Online players: ") .. players)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
core.register_chatcommand("disconnect", {
|
core.register_chatcommand("disconnect", {
|
||||||
description = "Exit to main menu",
|
description = core.gettext("Exit to main menu"),
|
||||||
func = function(param)
|
func = function(param)
|
||||||
core.disconnect()
|
core.disconnect()
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in New Issue