From 9b4a777a6789eabcbe8663b98a9ad6b129c47053 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 2 Jul 2023 02:02:42 +0100 Subject: [PATCH] //scale, //subdivide, //spop: use new position api --- .../commands/meta/subdivide.lua | 17 +++++++++++------ worldeditadditions_commands/commands/scale.lua | 8 +++++--- .../commands/selectors/spop.lua | 9 ++++++--- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/worldeditadditions_commands/commands/meta/subdivide.lua b/worldeditadditions_commands/commands/meta/subdivide.lua index e027455..a033650 100644 --- a/worldeditadditions_commands/commands/meta/subdivide.lua +++ b/worldeditadditions_commands/commands/meta/subdivide.lua @@ -116,9 +116,11 @@ worldeditadditions_core.register_command("subdivide", { end worldedit.player_notify_suppress(name) - worldedit.pos1[name] = cpos1 - worldedit.pos2[name] = cpos2 - worldedit.marker_update(name) + wea_c.pos.set1(name, cpos1) + wea_c.pos.set2(name, cpos2) + -- worldedit.pos1[name] = cpos1 + -- worldedit.pos2[name] = cpos2 + -- worldedit.marker_update(name) cmd.func(name, wea_c.table.unpack(cmd_args_parsed)) if will_trigger_saferegion(name, cmd_name, args) then minetest.chatcommands["/y"].func(name) @@ -141,9 +143,12 @@ worldeditadditions_core.register_command("subdivide", { time_last_msg = wea_c.get_ms_time() end end, function(_, _, stats) - worldedit.pos1[name] = pos1 - worldedit.pos2[name] = pos2 - worldedit.marker_update(name) + + wea_c.pos.set1(name, pos1) + wea_c.pos.set2(name, pos2) + -- worldedit.pos1[name] = pos1 + -- worldedit.pos2[name] = pos2 + -- worldedit.marker_update(name) -- Called on completion minetest.log("action", string.format("%s used //subdivide at %s - %s, with %d chunks and %d total nodes in %s", diff --git a/worldeditadditions_commands/commands/scale.lua b/worldeditadditions_commands/commands/scale.lua index 1b7b194..a70db16 100644 --- a/worldeditadditions_commands/commands/scale.lua +++ b/worldeditadditions_commands/commands/scale.lua @@ -117,9 +117,11 @@ wea_c.register_command("scale", { ) if not success then return success, stats end - worldedit.pos1[name] = stats.pos1 - worldedit.pos2[name] = stats.pos2 - worldedit.marker_update(name) + wea_c.pos.set1(name, stats.pos1) + wea_c.pos.set2(name, stats.pos2) + -- worldedit.pos1[name] = stats.pos1 + -- worldedit.pos2[name] = stats.pos2 + -- worldedit.marker_update(name) local time_taken = wea_c.get_ms_time() - start_time diff --git a/worldeditadditions_commands/commands/selectors/spop.lua b/worldeditadditions_commands/commands/selectors/spop.lua index 231a5b4..ba20664 100644 --- a/worldeditadditions_commands/commands/selectors/spop.lua +++ b/worldeditadditions_commands/commands/selectors/spop.lua @@ -1,4 +1,5 @@ local wea = worldeditadditions +local weac = worldeditadditions_core -- ███████ ██████ ██████ ██████ @@ -20,9 +21,11 @@ worldeditadditions_core.register_command("spop", { local success, pos1, pos2 = wea.spop(name) if not success then return success, pos1 end - worldedit.pos1[name] = pos1 - worldedit.pos2[name] = pos2 - worldedit.marker_update(name) + weac.pos.set1(name, pos1) + weac.pos.set2(name, pos2) + -- worldedit.pos1[name] = pos1 + -- worldedit.pos2[name] = pos2 + -- worldedit.marker_update(name) local new_count = wea.scount(name) local plural = "s are"