From 9bfb428c3f042a1b1e4b414c0c095f55cc7bc1c1 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 24 May 2022 00:11:22 +0100 Subject: [PATCH 1/4] add override aliases behind a setting --- worldeditadditions_commands/aliases.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/worldeditadditions_commands/aliases.lua b/worldeditadditions_commands/aliases.lua index bf102f6..28d3bc6 100644 --- a/worldeditadditions_commands/aliases.lua +++ b/worldeditadditions_commands/aliases.lua @@ -1,5 +1,6 @@ local wea_c = worldeditadditions_core + wea_c.register_alias("smoothadv", "convolve") wea_c.register_alias("conv", "convolve") @@ -16,8 +17,8 @@ wea_c.register_alias("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") +if minetest.settings:get_bool("worldeditadditions.override_commands", false) then + worldeditadditions_core.register_alias("copy", "copy+", true) + worldeditadditions_core.register_alias("move", "move+", true) + worldeditadditions_core.register_alias("replace", "replacemix", true) +end From af7d39110b60b8c32099d1f70cd9c09ae710c5a3 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 24 May 2022 01:05:09 +0100 Subject: [PATCH 2/4] //spiral2: fix params description --- worldeditadditions_commands/commands/spiral2.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldeditadditions_commands/commands/spiral2.lua b/worldeditadditions_commands/commands/spiral2.lua index 68f689e..9bcf40f 100644 --- a/worldeditadditions_commands/commands/spiral2.lua +++ b/worldeditadditions_commands/commands/spiral2.lua @@ -3,7 +3,7 @@ local wea = worldeditadditions local Vector3 = wea.Vector3 worldeditadditions_core.register_command("spiral2", { - params = "[] [ [ [] ] ]", + params = "[circle|square] [ [ [] ] ]", description = "Generates a spiral that fills the defined region using the specified replace node. The spiral is either square (default) or circular in shape. The interval specifies the distance between the walls of the spiral, and the acceleration specifies how quickly this value should increase.", privs = { worldedit = true }, require_pos = 2, From 64ff61a4d2eb27daa14bb93e6a92be396d101ebf Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 24 May 2022 02:24:43 +0100 Subject: [PATCH 3/4] Fix override aliases --- .luacheckrc | 3 ++- worldeditadditions_commands/aliases.lua | 9 ++++++--- worldeditadditions_core/core/register_alias.lua | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 9ad6553..27630b7 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -33,6 +33,7 @@ read_globals = { "describe", "bonemeal", "dofile", - "PerlinNoise" + "PerlinNoise", + "Settings" } std = "max" diff --git a/worldeditadditions_commands/aliases.lua b/worldeditadditions_commands/aliases.lua index 28d3bc6..109f76f 100644 --- a/worldeditadditions_commands/aliases.lua +++ b/worldeditadditions_commands/aliases.lua @@ -15,9 +15,12 @@ wea_c.register_alias("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 -if minetest.settings:get_bool("worldeditadditions.override_commands", false) then +-- These are disabled by default for now, as they could be potentially dangerous to stability +-- Thorough testing is required of our replacement commands before these are enabled by default +local worldmt_settings = Settings(minetest.get_worldpath().."/world.mt") +local should_override = worldmt_settings:get_bool("worldeditadditions_override_commands", false) +if should_override then + minetest.log("info", "[WorldEditAdditions] Enabling override aliases") worldeditadditions_core.register_alias("copy", "copy+", true) worldeditadditions_core.register_alias("move", "move+", true) worldeditadditions_core.register_alias("replace", "replacemix", true) diff --git a/worldeditadditions_core/core/register_alias.lua b/worldeditadditions_core/core/register_alias.lua index 0e448a7..70c7a1e 100644 --- a/worldeditadditions_core/core/register_alias.lua +++ b/worldeditadditions_core/core/register_alias.lua @@ -16,7 +16,7 @@ local function register_alias(cmdname_target, cmdname_source, override) return false end - print("DEBUG ALIAS source "..cmdname_source.." target "..cmdname_target) + -- print("DEBUG ALIAS source "..cmdname_source.." target "..cmdname_target) if minetest.chatcommands["/"..cmdname_target] then minetest.override_chatcommand( From cb75776164fe2ac00219dbee134c3e5db6fb0742 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Wed, 25 May 2022 00:45:37 +0100 Subject: [PATCH 4/4] tests.sh: fix eval luarocks path on Windows Annoyingly luarocks generates batch commands on Windows, even when being called from Git Bash :-/ --- tests.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests.sh b/tests.sh index 002c8ee..4672d13 100755 --- a/tests.sh +++ b/tests.sh @@ -31,7 +31,15 @@ check_command luarocks; luarocks_root="${PWD}/.luarocks"; # Setup the lua module path -eval "$(luarocks --tree "${luarocks_root}" path)"; +# eval "$(luarocks --tree "${luarocks_root}" path)"; + +PATH="$(luarocks --tree "${luarocks_root}" path --lr-bin):${PATH}"; +echo "PATH | ${PATH}"; +LUA_PATH="$(luarocks --tree "${luarocks_root}" path --lr-path);init.lua;./?.lua"; +LUA_CPATH="$(luarocks --tree "${luarocks_root}" path --lr-cpath);./?.so"; + + +export PATH LUA_PATH LUA_CPATH; mode="${1}"; if [[ "$#" -gt 0 ]]; then shift; fi