//subdivide: fix a number of other issues

This commit is contained in:
Starbeamrainbowlabs 2021-02-07 01:28:07 +00:00
parent edb80d7478
commit 888ee04f9d
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 6 additions and 8 deletions

View File

@ -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()

View File

@ -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

View File

@ -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)