forked from Mirrorlandia_minetest/minetest
Also print help commands to chat for server terminal (#8869)
This commit is contained in:
parent
6a7f5c0985
commit
c413eeb026
@ -77,6 +77,13 @@ local function do_help_cmd(name, param)
|
|||||||
end
|
end
|
||||||
table.sort(cmds)
|
table.sort(cmds)
|
||||||
return true, gettext("Available commands:").."\n"..table.concat(cmds, "\n")
|
return true, gettext("Available commands:").."\n"..table.concat(cmds, "\n")
|
||||||
|
elseif INIT == "game" and param == "privs" then
|
||||||
|
local privs = {}
|
||||||
|
for priv, def in pairs(core.registered_privileges) do
|
||||||
|
privs[#privs + 1] = priv .. ": " .. def.description
|
||||||
|
end
|
||||||
|
table.sort(privs)
|
||||||
|
return true, "Available privileges:\n"..table.concat(privs, "\n")
|
||||||
else
|
else
|
||||||
local cmd = param
|
local cmd = param
|
||||||
local def = core.registered_chatcommands[cmd]
|
local def = core.registered_chatcommands[cmd]
|
||||||
|
@ -128,16 +128,24 @@ local help_command = core.registered_chatcommands["help"]
|
|||||||
local old_help_func = help_command.func
|
local old_help_func = help_command.func
|
||||||
|
|
||||||
help_command.func = function(name, param)
|
help_command.func = function(name, param)
|
||||||
|
local admin = core.settings:get("name")
|
||||||
|
|
||||||
|
-- If the admin ran help, put the output in the chat buffer as well to
|
||||||
|
-- work with the server terminal
|
||||||
if param == "privs" then
|
if param == "privs" then
|
||||||
core.show_formspec(name, "__builtin:help_privs",
|
core.show_formspec(name, "__builtin:help_privs",
|
||||||
build_privs_formspec(name))
|
build_privs_formspec(name))
|
||||||
|
if name ~= admin then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if param == "" or param == "all" then
|
if param == "" or param == "all" then
|
||||||
core.show_formspec(name, "__builtin:help_cmds",
|
core.show_formspec(name, "__builtin:help_cmds",
|
||||||
build_chatcommands_formspec(name))
|
build_chatcommands_formspec(name))
|
||||||
|
if name ~= admin then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return old_help_func(name, param)
|
return old_help_func(name, param)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user