From 888ee04f9df769216308f0770f0441847a91509c Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 7 Feb 2021 01:28:07 +0000 Subject: [PATCH] //subdivide: fix a number of other issues --- worldeditadditions/lib/subdivide.lua | 4 ++-- worldeditadditions/utils/numbers.lua | 4 +--- worldeditadditions_commands/commands/meta/subdivide.lua | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/worldeditadditions/lib/subdivide.lua b/worldeditadditions/lib/subdivide.lua index 957c9e2..6426080 100644 --- a/worldeditadditions/lib/subdivide.lua +++ b/worldeditadditions/lib/subdivide.lua @@ -88,7 +88,7 @@ local function subdivide_step_afterload(state_emerge, state_ours) state_ours.times.emerge_last = wea.get_ms_time() - state_ours.times.emerge_last table.insert(state_ours.times.emerge, state_ours.times.emerge_last) if #state_ours.times.emerge > 25 then - state_ours.times.emerge = wea.table_get_last(state_ours.times.emerge, 25) + state_ours.times.emerge = wea.table_get_last(state_ours.times.emerge, 100) end state_ours.times.emerge_total = state_ours.times.emerge_total + state_ours.times.emerge_last @@ -107,7 +107,7 @@ local function subdivide_step_afterload(state_emerge, state_ours) state_ours.times.step_last = wea.get_ms_time() - state_ours.times.step_start_abs table.insert(state_ours.times.steps, state_ours.times.step_last) if #state_ours.times.steps > 25 then - state_ours.times.steps = wea.table_get_last(state_ours.times.steps, 25) + state_ours.times.steps = wea.table_get_last(state_ours.times.steps, 100) end state_ours.times.steps_total = state_ours.times.steps_total + state_ours.times.step_last state_ours.times.step_start_abs = wea.get_ms_time() diff --git a/worldeditadditions/utils/numbers.lua b/worldeditadditions/utils/numbers.lua index 196128b..027a23f 100644 --- a/worldeditadditions/utils/numbers.lua +++ b/worldeditadditions/utils/numbers.lua @@ -21,7 +21,6 @@ end function worldeditadditions.average(list) - print("[DEBUG] averaging "..#list.." numbers") if #list == 0 then return 0 end return worldeditadditions.sum(list) / #list end @@ -33,9 +32,8 @@ function worldeditadditions.get_ms_time() end function worldeditadditions.eta(existing_times, times_total_count) - print("[DEBUG] eta got "..#existing_times.." numbers") local average = worldeditadditions.average( - worldeditadditions.table_get_last(existing_times, 25) + worldeditadditions.table_get_last(existing_times, 100) ) local times_left = times_total_count - #existing_times if times_left == 0 then return 0 end diff --git a/worldeditadditions_commands/commands/meta/subdivide.lua b/worldeditadditions_commands/commands/meta/subdivide.lua index cce8944..95ae1ca 100644 --- a/worldeditadditions_commands/commands/meta/subdivide.lua +++ b/worldeditadditions_commands/commands/meta/subdivide.lua @@ -13,8 +13,8 @@ local function will_trigger_saferegion(name, cmd_name, args) if not parse_success then return nil, table.remove(parsed, 1) end if not def.nodes_needed then return false end - local success, result = def.nodes_needed(name, unpack(parsed)) - if not success then return nil, result end + local result = def.nodes_needed(name, unpack(parsed)) + if not result then return nil, result end if result > 10000 then return true end return false end @@ -109,7 +109,7 @@ worldedit.register_command("subdivide", { worldedit.marker_update(name) cmd.func(name, args) if will_trigger_saferegion(name, cmd_name, args) then - minetest.chatcommands["/y"].func() + minetest.chatcommands["/y"].func(name) end worldedit.player_notify_unsuppress(name)