From 449f12d5d710fa9d60f32175c3b9695bf722e16a Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Tue, 22 Oct 2024 22:00:53 -0700 Subject: [PATCH] //reset refactor --- .../commands/selectors/reset.lua | 47 +++++++------------ 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/worldeditadditions_commands/commands/selectors/reset.lua b/worldeditadditions_commands/commands/selectors/reset.lua index 54c82f5..2ffa79f 100644 --- a/worldeditadditions_commands/commands/selectors/reset.lua +++ b/worldeditadditions_commands/commands/selectors/reset.lua @@ -1,32 +1,21 @@ -local weac = worldeditadditions_core +-- ██████ ███████ ███████ ███████ ████████ +-- ██ ██ ██ ██ ██ ██ +-- ██████ █████ ███████ █████ ██ +-- ██ ██ ██ ██ ██ ██ +-- ██ ██ ███████ ███████ ███████ ██ +local wea_c = worldeditadditions_core -local worldedit_reset -if minetest.registered_chatcommands["/reset"] then - worldedit_reset = minetest.registered_chatcommands["/reset"].func -end - -local function do_reset(name, params_text) - -- Hide the WorldEdit marker, if appropriate - if type(worldedit_reset) == "function" then - worldedit_reset(name, params_text) +worldeditadditions_core.register_command("reset", { + params = "", + description = "Clears all defined points and the currently defined region.", + privs = {worldedit=true}, + override = true, -- Override the WorldEdit command + parse = function(params_text) + return true, params_text + end, + func = function(name) + wea_c.pos.clear(name) + return true, "Selection reset for "..name end - - -- Hide the WorldEditAdditions marker - weac.pos.clear(name) -end - -if minetest.registered_chatcommands["/reset"] then - minetest.override_chatcommand("/reset", { - params = "", - description = "Clears all defined points and the currently defined region.", - func = do_reset - }) -else - minetest.register_chatcommand("/reset", { - params = "", - description = "Clears all defined points and the currently defined region.", - privs = { worldedit = true }, - func = do_reset - }) -end \ No newline at end of file +}) \ No newline at end of file