From 31e256e1e2c9f56c1864850f724f5f110aefab51 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Tue, 9 Mar 2021 12:47:57 +0100 Subject: [PATCH] cleanup and fixes --- mods/CORE/mcl_commands/init.lua | 41 ++++++++++++++------------- mods/MISC/mcl_basic_commands/kill.lua | 3 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/mods/CORE/mcl_commands/init.lua b/mods/CORE/mcl_commands/init.lua index e8e855099..ebab70769 100644 --- a/mods/CORE/mcl_commands/init.lua +++ b/mods/CORE/mcl_commands/init.lua @@ -12,21 +12,21 @@ local get_modpath = minetest.get_modpath mcl_commands = {} -mcl_commands.types = { - pos = "%(? *(%-?[%d.]+) *, *(%-?[%d.]+) *, *(%-?[%d.]+) *%)?", - text = "(.+)", - number = "(%-?[%d.]+)", - int = "(%-?[%d]+)", - word = "([^ ]+)", - alpha = "([A-Za-z]+)", - modname = "([a-z0-9_]+)", - alphascore = "([A-Za-z_]+)", - alphanumeric = "([A-Za-z0-9]+)", - username = "([A-Za-z0-9-_]+)", - json = "(.+)", --FIXME - color = "([^ ]+)", --FIXME - nodename = "([A-Za-z_]+)", -} +-- mcl_commands.types = { + -- pos = "%(? *(%-?[%d.]+) *, *(%-?[%d.]+) *, *(%-?[%d.]+) *%)?", + -- text = "(.+)", + -- number = "(%-?[%d.]+)", + -- int = "(%-?[%d]+)", + -- word = "([^ ]+)", + -- alpha = "([A-Za-z]+)", + -- modname = "([a-z0-9_]+)", + -- alphascore = "([A-Za-z_]+)", + -- alphanumeric = "([A-Za-z0-9]+)", + -- username = "([A-Za-z0-9-_]+)", + -- json = "(.+)", --FIXME + -- color = "([^ ]+)", --FIXME + -- nodename = "([A-Za-z_]+)", +-- } mcl_commands.types = { pos = {"%(? *(%-?[%d.]+) *, *(%-?[%d.]+) *, *(%-?[%d.]+) *%)?", @@ -109,10 +109,11 @@ mcl_commands.types = { username = {"([A-Za-z0-9-_]+)}", function(res, pointer) --if minetest.player_exists(res[pointer]) then - return nil, res[pointer], pointer+1 - --else - --return S("Player doesn't exist.") - --end + if res[pointer] then + return nil, res[pointer], pointer+1 + else + return S("Player doesn't exist.") + end end}, json = {"(.+)", --FIXME function(res, pointer) @@ -153,7 +154,7 @@ function mcl_commands.register_command(name, def) return cmd end -function mcl_commands.overide_command(name, def) +function mcl_commands.override_command(name, def) def = def or {} local cmd = mcl_commands.build(name, def) if minetest.registered_chatcommands[name] then diff --git a/mods/MISC/mcl_basic_commands/kill.lua b/mods/MISC/mcl_basic_commands/kill.lua index 3d21f11c8..ca659f8ef 100644 --- a/mods/MISC/mcl_basic_commands/kill.lua +++ b/mods/MISC/mcl_basic_commands/kill.lua @@ -41,7 +41,7 @@ local function handle_kill_command(suspect, victim) return true end -mcl_commands.overide_command("kill", { +mcl_commands.override_command("kill", { func = function(cmd) cmd:sub("", { func = function(name) @@ -52,7 +52,6 @@ mcl_commands.overide_command("kill", { func = function(name, target) return handle_kill_command(name, target) end, - privs = {settime = true} }) end, description = "Kill player or yourself.",