mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-25 16:43:05 +00:00
Update minetest.chatcommands → minetest.registered_chatcommands
This commit is contained in:
parent
3bfc62be24
commit
f2214150f2
8 changed files with 12 additions and 12 deletions
|
@ -68,7 +68,7 @@ worldeditadditions_core.register_command("for", {
|
||||||
return true, values, command, args
|
return true, values, command, args
|
||||||
end,
|
end,
|
||||||
func = function(name, values, command, args)
|
func = function(name, values, command, args)
|
||||||
local cmd = minetest.chatcommands[command]
|
local cmd = minetest.registered_chatcommands[command]
|
||||||
if not cmd then
|
if not cmd then
|
||||||
return false, "Error: "..command.." isn't a valid command."
|
return false, "Error: "..command.." isn't a valid command."
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,7 @@ local function step(params)
|
||||||
if not args then args = ""
|
if not args then args = ""
|
||||||
else args = args:match("^%s*(.*)%s*$") end
|
else args = args:match("^%s*(.*)%s*$") end
|
||||||
-- Get command and test privs
|
-- Get command and test privs
|
||||||
local cmd = minetest.chatcommands[command]
|
local cmd = minetest.registered_chatcommands[command]
|
||||||
if not cmd then
|
if not cmd then
|
||||||
return false, "Error: "..command.." isn't a valid command."
|
return false, "Error: "..command.." isn't a valid command."
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,7 @@ local function step(params)
|
||||||
))
|
))
|
||||||
))
|
))
|
||||||
|
|
||||||
local cmd = minetest.chatcommands[params.cmd_name]
|
local cmd = minetest.registered_chatcommands[params.cmd_name]
|
||||||
|
|
||||||
minetest.log("action", params.name.." runs "..full_cmd.." (time "..tostring(params.i).." of "..tostring(params.count)..")")
|
minetest.log("action", params.name.." runs "..full_cmd.." (time "..tostring(params.i).." of "..tostring(params.count)..")")
|
||||||
cmd.func(params.name, params.args)
|
cmd.func(params.name, params.args)
|
||||||
|
@ -80,7 +80,7 @@ minetest.register_chatcommand("/many", {
|
||||||
cmd_name = wea_c.trim(cmd_name):sub(2) -- Things start at 1, not 0 in Lua :-(
|
cmd_name = wea_c.trim(cmd_name):sub(2) -- Things start at 1, not 0 in Lua :-(
|
||||||
|
|
||||||
-- Check the command we're going to execute
|
-- Check the command we're going to execute
|
||||||
local cmd = minetest.chatcommands[cmd_name]
|
local cmd = minetest.registered_chatcommands[cmd_name]
|
||||||
if not cmd then
|
if not cmd then
|
||||||
return false, "Error: "..cmd_name.." isn't a valid command."
|
return false, "Error: "..cmd_name.." isn't a valid command."
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,7 @@ minetest.register_chatcommand("/multi", {
|
||||||
|
|
||||||
worldedit.player_notify(name, "#"..i..": "..command)
|
worldedit.player_notify(name, "#"..i..": "..command)
|
||||||
|
|
||||||
local cmd = minetest.chatcommands[command_name]
|
local cmd = minetest.registered_chatcommands[command_name]
|
||||||
if not cmd then
|
if not cmd then
|
||||||
return false, "Error: "..command_name.." isn't a valid command."
|
return false, "Error: "..command_name.." isn't a valid command."
|
||||||
end
|
end
|
||||||
|
|
|
@ -123,7 +123,7 @@ worldeditadditions_core.register_command("subdivide", {
|
||||||
-- worldedit.marker_update(name)
|
-- worldedit.marker_update(name)
|
||||||
cmd.func(name, wea_c.table.unpack(cmd_args_parsed))
|
cmd.func(name, wea_c.table.unpack(cmd_args_parsed))
|
||||||
if will_trigger_saferegion(name, cmd_name, args) then
|
if will_trigger_saferegion(name, cmd_name, args) then
|
||||||
minetest.chatcommands["/y"].func(name)
|
minetest.registered_chatcommands["/y"].func(name)
|
||||||
end
|
end
|
||||||
worldedit.player_notify_unsuppress(name)
|
worldedit.player_notify_unsuppress(name)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
--- Fetches the definition of a WorldEditAdditions or WorldEdit command
|
--- Fetches the definition of a WorldEditAdditions or WorldEdit command
|
||||||
-- Does not support fetching generic Minetest commands - check
|
-- Does not support fetching generic Minetest commands - check
|
||||||
-- minetest.chatcommands for this.
|
-- minetest.registered_chatcommands for this.
|
||||||
-- @param cmdname string The name of the command to fetch the definition for.
|
-- @param cmdname string The name of the command to fetch the definition for.
|
||||||
local function fetch_command_def(cmdname)
|
local function fetch_command_def(cmdname)
|
||||||
local wea_c = worldeditadditions_core
|
local wea_c = worldeditadditions_core
|
||||||
|
|
|
@ -18,15 +18,15 @@ local function register_alias(cmdname_target, cmdname_source, override)
|
||||||
|
|
||||||
-- print("DEBUG ALIAS source "..cmdname_source.." target "..cmdname_target)
|
-- print("DEBUG ALIAS source "..cmdname_source.." target "..cmdname_target)
|
||||||
|
|
||||||
if minetest.chatcommands["/"..cmdname_target] then
|
if minetest.registered_chatcommands["/" .. cmdname_target] then
|
||||||
minetest.override_chatcommand(
|
minetest.override_chatcommand(
|
||||||
"/"..cmdname_target,
|
"/"..cmdname_target,
|
||||||
minetest.chatcommands["/"..cmdname_source]
|
minetest.registered_chatcommands["/" .. cmdname_source]
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
minetest.register_chatcommand(
|
minetest.register_chatcommand(
|
||||||
"/"..cmdname_target,
|
"/"..cmdname_target,
|
||||||
minetest.chatcommands["/"..cmdname_source]
|
minetest.registered_chatcommands["/" .. cmdname_source]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
wea_c.registered_commands[cmdname_target] = wea_c.registered_commands[cmdname_source]
|
wea_c.registered_commands[cmdname_target] = wea_c.registered_commands[cmdname_source]
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
local worldedit_command_y, worldedit_command_n
|
local worldedit_command_y, worldedit_command_n
|
||||||
|
|
||||||
if minetest.global_exists("worldedit") then
|
if minetest.global_exists("worldedit") then
|
||||||
worldedit_command_y = minetest.chatcommands["/y"].func
|
worldedit_command_y = minetest.registered_chatcommands["/y"].func
|
||||||
worldedit_command_n = minetest.chatcommands["/n"].func
|
worldedit_command_n = minetest.registered_chatcommands["/n"].func
|
||||||
end
|
end
|
||||||
|
|
||||||
--- A table that holds at most 1 pending function call per player.
|
--- A table that holds at most 1 pending function call per player.
|
||||||
|
|
Loading…
Reference in a new issue