mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 23:42:59 +00:00
implement options.override
This commit is contained in:
parent
1de0402a02
commit
698ca09336
1 changed files with 7 additions and 3 deletions
|
@ -55,8 +55,8 @@ local function register_command(cmdname, options)
|
||||||
log_error(cmdname, "The func option is not a function.")
|
log_error(cmdname, "The func option is not a function.")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if wea_c.registered_commands[cmdname] and options.override ~= true then
|
if minetest.registered_chatcommands["/"..cmdname] and options.override ~= true then
|
||||||
log_error(cmdname, "A WorldEditAdditions command with that name is registered, but the option override is not set to true.")
|
log_error(cmdname, "A chat command with that name is registered, but the option override is not set to true.")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -72,7 +72,11 @@ local function register_command(cmdname, options)
|
||||||
---
|
---
|
||||||
-- 3: Registration
|
-- 3: Registration
|
||||||
---
|
---
|
||||||
minetest.register_chatcommand("/"..cmdname, {
|
local register_chatcommand = minetest.register_chatcommand
|
||||||
|
if minetest.registered_chatcommands["/"..cmdname] and options.override == true then
|
||||||
|
register_chatcommand = minetest.override_chatcommand
|
||||||
|
end
|
||||||
|
register_chatcommand("/"..cmdname, {
|
||||||
params = options.params,
|
params = options.params,
|
||||||
description = options.description,
|
description = options.description,
|
||||||
privs = options.privs,
|
privs = options.privs,
|
||||||
|
|
Loading…
Reference in a new issue