From 10f350c967ae18736816ecd734b04ff67a59eeb6 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 16 May 2022 21:21:15 +0100 Subject: [PATCH] Delete copied code Given licence incompatibilities, we can't really copy code from WorldEdit --- worldeditadditions_commands/aliases.lua | 10 ++++++ worldeditadditions_commands/init.lua | 10 ------ worldeditadditions_core/register/init.lua | 4 +-- worldeditadditions_core/register/override.lua | 35 ------------------- worldeditadditions_core/register/register.lua | 32 ----------------- 5 files changed, 12 insertions(+), 79 deletions(-) delete mode 100644 worldeditadditions_core/register/override.lua delete mode 100644 worldeditadditions_core/register/register.lua diff --git a/worldeditadditions_commands/aliases.lua b/worldeditadditions_commands/aliases.lua index ca16922..3d64993 100644 --- a/worldeditadditions_commands/aliases.lua +++ b/worldeditadditions_commands/aliases.lua @@ -9,3 +9,13 @@ worldedit.alias_command("flora", "bonemeal") -- Measure Tools worldedit.alias_command("mcount", "count") worldedit.alias_command("mfacing", "mface") + + +--- Overrides to core WorldEdit commands +-- These are commented out for now, as they could be potentially dangerous to stability +-- Thorough testing is required of our replacement commands before these are uncommented +-- TODO: Depend on worldeditadditions_core before uncommenting this +-- BUG: //move+ seems to be leaving stuff behind for some strange reason --@sbrl 2021-12-26 +-- worldeditadditions_core.alias_override("copy", "copy+") +-- worldeditadditions_core.alias_override("move", "move+") -- MAY have issues where it doesn't overwrite the old region properly, but haven't been able to reliably reproduce this +-- worldeditadditions_core.alias_override("replace", "replacemix") diff --git a/worldeditadditions_commands/init.lua b/worldeditadditions_commands/init.lua index 168508d..22f17d1 100644 --- a/worldeditadditions_commands/init.lua +++ b/worldeditadditions_commands/init.lua @@ -81,13 +81,3 @@ end dofile(we_c.modpath.."/aliases.lua") - - ---- Overrides to core WorldEdit commands --- These are commented out for now, as they could be potentially dangerous to stability --- Thorough testing is required of our replacement commands before these are uncommented --- TODO: Depend on worldeditadditions_core before uncommenting this --- BUG: //move+ seems to be leaving stuff behind for some strange reason --@sbrl 2021-12-26 --- worldeditadditions_core.alias_override("copy", "copy+") --- worldeditadditions_core.alias_override("move", "move+") -- MAY have issues where it doesn't overwrite the old region properly, but haven't been able to reliably reproduce this --- worldeditadditions_core.alias_override("replace", "replacemix") diff --git a/worldeditadditions_core/register/init.lua b/worldeditadditions_core/register/init.lua index 2ebb6c5..ff1fc86 100644 --- a/worldeditadditions_core/register/init.lua +++ b/worldeditadditions_core/register/init.lua @@ -10,5 +10,5 @@ local we_cm = worldeditadditions_core.modpath .. "/register/" dofile(we_cm.."check.lua") dofile(we_cm.."handler.lua") -dofile(we_cm.."register.lua") -dofile(we_cm.."override.lua") +-- dofile(we_cm.."register.lua") +-- dofile(we_cm.."override.lua") diff --git a/worldeditadditions_core/register/override.lua b/worldeditadditions_core/register/override.lua deleted file mode 100644 index cc74d2a..0000000 --- a/worldeditadditions_core/register/override.lua +++ /dev/null @@ -1,35 +0,0 @@ -local we_c = worldeditadditions_core -function we_c.override_command(name, def) - local def = table.copy(def) - local success, err = we_c.check_command(name, def) - - if not success then - error(err) - return false - end - - minetest.override_chatcommand("/" .. name, { - privs = def.privs, - params = def.params, - description = def.description, - func = function(player_name, param) - return we_c.chatcommand_handler(name, player_name, param) - end, - }) - worldedit.registered_commands[name] = def -end - -function we_c.alias_override(alias, original) - if not worldedit.registered_commands[original] then - minetest.log("error", "worldedit_shortcommands: original " .. original .. " does not exist") - return - end - if minetest.chatcommands["/" .. alias] then - minetest.override_chatcommand("/" .. alias, minetest.chatcommands["/" .. original]) - worldedit.registered_commands[alias] = worldedit.registered_commands[original] - else - minetest.register_chatcommand("/" .. alias, minetest.chatcommands["/" .. original]) - worldedit.registered_commands[alias] = worldedit.registered_commands[original] - end - -end diff --git a/worldeditadditions_core/register/register.lua b/worldeditadditions_core/register/register.lua deleted file mode 100644 index acd845d..0000000 --- a/worldeditadditions_core/register/register.lua +++ /dev/null @@ -1,32 +0,0 @@ -local we_c = worldeditadditions_core -function we_c.register_command(name, def) - local def = table.copy(def) - local success, err = we_c.check_command(name, def) - if not success then - return false, err - end - - minetest.register_chatcommand("/" .. name, { - privs = def.privs, - params = def.params, - description = def.description, - func = function(player_name, param) - return we_c.chatcommand_handler(name, player_name, param) - end, - }) - worldedit.registered_commands[name] = def -end - -function we_c.alias_command(alias, original) - if not worldedit.registered_commands[original] then - minetest.log("error", "worldedit_shortcommands: original " .. original .. " does not exist") - return - end - if minetest.chatcommands["/" .. alias] then - minetest.log("error", "worldedit_shortcommands: alias " .. alias .. " already exists") - return - end - - minetest.register_chatcommand("/" .. alias, minetest.chatcommands["/" .. original]) - worldedit.registered_commands[alias] = worldedit.registered_commands[original] -end