fix nodename pattern and add debug command (do not work)

This commit is contained in:
AFCMS 2021-03-10 19:35:23 +01:00
parent 669a9ff0a4
commit 11384bd73c
2 changed files with 19 additions and 1 deletions

View File

@ -133,7 +133,7 @@ mcl_commands.types = {
return S("Color is not a valid color name or hexadecimal!")
end
end},
nodename = {"([A-Za-z_]+)",
nodename = {"^(%l+[%w_]+%:?[_%l]+[%w_]*)$",
function(res, pointer)
if minetest.registered_items[res[pointer]] then
return nil, res[pointer], pointer+1

View File

@ -14,4 +14,22 @@ mcl_commands.register_command("setblock", {
description = S("Set node at given position"),
params = S("<X>,<Y>,<Z> <NodeString>"),
privs = {give=true, interact=true},
})
--DEBUG: must be removed later
mcl_commands.register_command("setdebug", {
func = function(cmd)
cmd:sub(":node:nodename", {
func = function(name, node)
minetest.set_node({x=0,y=0,z=0}, {name=node})
return true, S("@1 spawned.", node)
--return false, S("Invalid parameters (see /help setblock)")
end,
privs = {},
})
end,
description = S("Set node at given position"),
params = S("<X>,<Y>,<Z> <NodeString>"),
privs = {give=true, interact=true},
})