mirror of
https://github.com/fluxionary/minetest-book_runner.git
synced 2025-03-15 04:11:25 +00:00
tweak failure messages; log execution to debug.txt
This commit is contained in:
parent
2ba84f170f
commit
f4a5f685f6
1 changed files with 4 additions and 3 deletions
|
@ -14,7 +14,7 @@ minetest.register_chatcommand("run_in_book", {
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
if not player then
|
if not player then
|
||||||
return false, "you are not a player"
|
return false, "you must be logged in to run this command"
|
||||||
end
|
end
|
||||||
|
|
||||||
local wielded_item = player:get_wielded_item()
|
local wielded_item = player:get_wielded_item()
|
||||||
|
@ -34,11 +34,11 @@ minetest.register_chatcommand("run_in_book", {
|
||||||
|
|
||||||
local command_def = minetest.registered_chatcommands[command]
|
local command_def = minetest.registered_chatcommands[command]
|
||||||
if not command_def then
|
if not command_def then
|
||||||
return false, ("unknown command %s"):format(command)
|
return false, f("unknown command %s", command)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.check_player_privs(player, command_def.privs) then
|
if not minetest.check_player_privs(player, command_def.privs) then
|
||||||
return false, ("you lack privileges to run %s"):format(command)
|
return false, f("you lack privileges to run %s", command)
|
||||||
end
|
end
|
||||||
|
|
||||||
local orig_chat_send_player = minetest.chat_send_player
|
local orig_chat_send_player = minetest.chat_send_player
|
||||||
|
@ -62,6 +62,7 @@ minetest.register_chatcommand("run_in_book", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
book_runner.log("action", "%s runs %q", name, param)
|
||||||
local _, status = command_def.func(name, args)
|
local _, status = command_def.func(name, args)
|
||||||
if status and status ~= "" then
|
if status and status ~= "" then
|
||||||
table.insert(received_messages, strip_colors(strip_translation(status)))
|
table.insert(received_messages, strip_colors(strip_translation(status)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue