summaryrefslogtreecommitdiff
path: root/builtin/common/information_formspecs.lua
diff options
context:
space:
mode:
authorPedro Gimeno <pgimeno@users.noreply.notabug.org>2021-04-03 22:51:09 +0200
committersfan5 <sfan5@live.de>2021-10-01 16:22:05 +0200
commitd7e7ade0f61a0f5e05d889ffbc7d9a878148a461 (patch)
tree5822c6b56d0750b05eaeb6c435daaae807b565da /builtin/common/information_formspecs.lua
parent982e03f60dc95cb2605a4a1c6520b604f85dd1d0 (diff)
downloadminetest-d7e7ade0f61a0f5e05d889ffbc7d9a878148a461.tar.gz
minetest-d7e7ade0f61a0f5e05d889ffbc7d9a878148a461.tar.bz2
minetest-d7e7ade0f61a0f5e05d889ffbc7d9a878148a461.zip
Add an option `-t` to force text output in /help
This also improves detection of whether formspecs are available.
Diffstat (limited to 'builtin/common/information_formspecs.lua')
-rw-r--r--builtin/common/information_formspecs.lua32
1 files changed, 7 insertions, 25 deletions
diff --git a/builtin/common/information_formspecs.lua b/builtin/common/information_formspecs.lua
index e814b4c43..3405263bf 100644
--- a/builtin/common/information_formspecs.lua
+++ b/builtin/common/information_formspecs.lua
@@ -125,30 +125,12 @@ core.register_on_player_receive_fields(function(player, formname, fields)
end
end)
-
-local help_command = core.registered_chatcommands["help"]
-local old_help_func = help_command.func
-
-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
- core.show_formspec(name, "__builtin:help_privs",
- build_privs_formspec(name))
- if name ~= admin then
- return true
- end
- end
- if param == "" or param == "all" then
- core.show_formspec(name, "__builtin:help_cmds",
- build_chatcommands_formspec(name))
- if name ~= admin then
- return true
- end
- end
-
- return old_help_func(name, param)
+function core.show_general_help_formspec(name)
+ core.show_formspec(name, "__builtin:help_cmds",
+ build_chatcommands_formspec(name))
end
+function core.show_privs_help_formspec(name)
+ core.show_formspec(name, "__builtin:help_privs",
+ build_privs_formspec(name))
+end