From 81773c8556b73cd8c9294fcaf1ca162dfaef5bd4 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 2 Jan 2022 17:17:05 +0000 Subject: [PATCH] //forest: use local wea alias --- .../commands/forest.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/worldeditadditions_commands/commands/forest.lua b/worldeditadditions_commands/commands/forest.lua index 29167f9..5240ae8 100644 --- a/worldeditadditions_commands/commands/forest.lua +++ b/worldeditadditions_commands/commands/forest.lua @@ -1,3 +1,5 @@ +local wea = worldeditadditions + -- ███████ ██████ ██████ ███████ ███████ ████████ -- ██ ██ ██ ██ ██ ██ ██ ██ -- █████ ██ ██ ██████ █████ ███████ ██ @@ -17,12 +19,12 @@ worldedit.register_command("forest", { params_text = params_text:sub(#match_start + 1) -- everything starts at 1 in Lua :-/ end - local success, sapling_list = worldeditadditions.parse.weighted_nodes( - worldeditadditions.split_shell(params_text), + local success, sapling_list = wea.parse.weighted_nodes( + wea.split_shell(params_text), false, function(name) return worldedit.normalize_nodename( - worldeditadditions.normalise_saplingname(name) + wea.normalise_saplingname(name) ) end ) @@ -35,22 +37,22 @@ worldedit.register_command("forest", { return (pos2.x - pos1.x) * (pos2.y - pos1.y) end, func = function(name, density, sapling_list) - local start_time = worldeditadditions.get_ms_time() - local success, stats = worldeditadditions.forest( + local start_time = wea.get_ms_time() + local success, stats = wea.forest( worldedit.pos1[name], worldedit.pos2[name], density, sapling_list ) if not success then return success, stats end - local time_taken = worldeditadditions.format.human_time(worldeditadditions.get_ms_time() - start_time) + local time_taken = wea.format.human_time(wea.get_ms_time() - start_time) - local distribution_display = worldeditadditions.format.node_distribution( + local distribution_display = wea.format.node_distribution( stats.placed, stats.successes, false -- no grand total at the bottom ) - minetest.log("action", name.." used //forest at "..worldeditadditions.vector.tostring(worldedit.pos1[name]).." - "..worldeditadditions.vector.tostring(worldedit.pos2[name])..", "..stats.successes.." trees placed, averaging "..stats.attempts_avg.." growth attempts / tree and "..stats.failures.." failed attempts in "..time_taken) + minetest.log("action", name.." used //forest at "..wea.vector.tostring(worldedit.pos1[name]).." - "..wea.vector.tostring(worldedit.pos2[name])..", "..stats.successes.." trees placed, averaging "..stats.attempts_avg.." growth attempts / tree and "..stats.failures.." failed attempts in "..time_taken) return true, distribution_display.."\n=========================\n"..stats.successes.." trees placed, averaging "..stats.attempts_avg.." growth attempts / tree and "..stats.failures.." failed attempts in "..time_taken end })