mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 15:33:00 +00:00
//subdivide: fix a number of other issues
This commit is contained in:
parent
edb80d7478
commit
888ee04f9d
3 changed files with 6 additions and 8 deletions
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue