|
@@ -61,15 +61,20 @@ local function build_chatcommands_formspec(name, sel, copy)
|
|
|
for i, data in ipairs(mod_cmds) do
|
|
|
rows[#rows + 1] = COLOR_BLUE .. ",0," .. F(data[1]) .. ","
|
|
|
for j, cmds in ipairs(data[2]) do
|
|
|
- local has_priv = check_player_privs(name, cmds[2].privs)
|
|
|
+ local has_priv = INIT == "client" or check_player_privs(name, cmds[2].privs)
|
|
|
rows[#rows + 1] = ("%s,1,%s,%s"):format(
|
|
|
has_priv and COLOR_GREEN or COLOR_GRAY,
|
|
|
cmds[1], F(cmds[2].params))
|
|
|
if sel == #rows then
|
|
|
description = cmds[2].description
|
|
|
if copy then
|
|
|
- core.chat_send_player(name, S("Command: @1 @2",
|
|
|
- core.colorize("#0FF", "/" .. cmds[1]), cmds[2].params))
|
|
|
+ local msg = S("Command: @1 @2",
|
|
|
+ core.colorize("#0FF", "/" .. cmds[1]), cmds[2].params)
|
|
|
+ if INIT == "client" then
|
|
|
+ core.display_chat_message(msg)
|
|
|
+ else
|
|
|
+ core.chat_send_player(name, msg)
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
end
|
|
@@ -111,26 +116,46 @@ end
|
|
|
|
|
|
|
|
|
-- DETAILED CHAT COMMAND INFORMATION
|
|
|
+if INIT == "client" then
|
|
|
+ core.register_on_formspec_input(function(formname, fields)
|
|
|
+ if formname ~= "__builtin:help_cmds" or fields.quit then
|
|
|
+ return
|
|
|
+ end
|
|
|
|
|
|
-core.register_on_player_receive_fields(function(player, formname, fields)
|
|
|
- if formname ~= "__builtin:help_cmds" or fields.quit then
|
|
|
- return
|
|
|
- end
|
|
|
+ local event = core.explode_table_event(fields.list)
|
|
|
+ if event.type ~= "INV" then
|
|
|
+ core.show_formspec("__builtin:help_cmds",
|
|
|
+ build_chatcommands_formspec(nil, event.row, event.type == "DCL"))
|
|
|
+ end
|
|
|
+ end)
|
|
|
+else
|
|
|
+ core.register_on_player_receive_fields(function(player, formname, fields)
|
|
|
+ if formname ~= "__builtin:help_cmds" or fields.quit then
|
|
|
+ return
|
|
|
+ end
|
|
|
|
|
|
- local event = core.explode_table_event(fields.list)
|
|
|
- if event.type ~= "INV" then
|
|
|
- local name = player:get_player_name()
|
|
|
- core.show_formspec(name, "__builtin:help_cmds",
|
|
|
- build_chatcommands_formspec(name, event.row, event.type == "DCL"))
|
|
|
- end
|
|
|
-end)
|
|
|
+ local event = core.explode_table_event(fields.list)
|
|
|
+ if event.type ~= "INV" then
|
|
|
+ local name = player:get_player_name()
|
|
|
+ core.show_formspec(name, "__builtin:help_cmds",
|
|
|
+ build_chatcommands_formspec(name, event.row, event.type == "DCL"))
|
|
|
+ end
|
|
|
+ end)
|
|
|
+end
|
|
|
|
|
|
function core.show_general_help_formspec(name)
|
|
|
- core.show_formspec(name, "__builtin:help_cmds",
|
|
|
- build_chatcommands_formspec(name))
|
|
|
+ if INIT == "client" then
|
|
|
+ core.show_formspec("__builtin:help_cmds",
|
|
|
+ build_chatcommands_formspec(name))
|
|
|
+ else
|
|
|
+ core.show_formspec(name, "__builtin:help_cmds",
|
|
|
+ build_chatcommands_formspec(name))
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
-function core.show_privs_help_formspec(name)
|
|
|
- core.show_formspec(name, "__builtin:help_privs",
|
|
|
- build_privs_formspec(name))
|
|
|
+if INIT ~= "client" then
|
|
|
+ function core.show_privs_help_formspec(name)
|
|
|
+ core.show_formspec(name, "__builtin:help_privs",
|
|
|
+ build_privs_formspec(name))
|
|
|
+ end
|
|
|
end
|