diff options
author | HybridDog <3192173+HybridDog@users.noreply.github.com> | 2021-03-26 20:59:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-26 20:59:05 +0100 |
commit | fc1512cca64ca9e44ed60372355a0cf1f7b2fe09 (patch) | |
tree | c91fb3666a340abdd548e0b8296c4bc2f594ef54 /builtin/game/chat.lua | |
parent | 6a26d6d15a9a122681772c29a7f3b0c36ac9c62e (diff) | |
download | minetest-fc1512cca64ca9e44ed60372355a0cf1f7b2fe09.tar.gz minetest-fc1512cca64ca9e44ed60372355a0cf1f7b2fe09.tar.bz2 minetest-fc1512cca64ca9e44ed60372355a0cf1f7b2fe09.zip |
Translate chatcommand delay message and replace minetest with core (#11113)
Diffstat (limited to 'builtin/game/chat.lua')
-rw-r--r-- | builtin/game/chat.lua | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua index bf2d7851e..10da054fd 100644 --- a/builtin/game/chat.lua +++ b/builtin/game/chat.lua @@ -75,9 +75,9 @@ core.register_on_chat_message(function(name, message) local has_privs, missing_privs = core.check_player_privs(name, cmd_def.privs) if has_privs then core.set_last_run_mod(cmd_def.mod_origin) - local t_before = minetest.get_us_time() + local t_before = core.get_us_time() local success, result = cmd_def.func(name, param) - local delay = (minetest.get_us_time() - t_before) / 1000000 + local delay = (core.get_us_time() - t_before) / 1000000 if success == false and result == nil then core.chat_send_player(name, "-!- "..S("Invalid command usage.")) local help_def = core.registered_chatcommands["help"] @@ -91,11 +91,12 @@ core.register_on_chat_message(function(name, message) if delay > msg_time_threshold then -- Show how much time it took to execute the command if result then - result = result .. - minetest.colorize("#f3d2ff", " (%.5g s)"):format(delay) + result = result .. core.colorize("#f3d2ff", S(" (@1 s)", + string.format("%.5f", delay))) else - result = minetest.colorize("#f3d2ff", - "Command execution took %.5f s"):format(delay) + result = core.colorize("#f3d2ff", S( + "Command execution took @1 s", + string.format("%.5f", delay))) end end if result then |