From 698ca093360e1c7e1bbe7e7ea8c7305d1c0181e6 Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Fri, 18 Oct 2024 11:49:58 -0700 Subject: [PATCH] implement options.override --- worldeditadditions_core/core/register_command.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/worldeditadditions_core/core/register_command.lua b/worldeditadditions_core/core/register_command.lua index 511391e..afd4f7b 100644 --- a/worldeditadditions_core/core/register_command.lua +++ b/worldeditadditions_core/core/register_command.lua @@ -55,8 +55,8 @@ local function register_command(cmdname, options) log_error(cmdname, "The func option is not a function.") return false end - if wea_c.registered_commands[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.") + if minetest.registered_chatcommands["/"..cmdname] and options.override ~= true then + log_error(cmdname, "A chat command with that name is registered, but the option override is not set to true.") return false end @@ -72,7 +72,11 @@ local function register_command(cmdname, options) --- -- 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, description = options.description, privs = options.privs,