cleanup and fixes

This commit is contained in:
AFCMS 2021-03-09 12:47:57 +01:00
parent 5f00d47ec2
commit 31e256e1e2
2 changed files with 22 additions and 22 deletions

View File

@ -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

View File

@ -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.",