:3c
This commit is contained in:
parent
68ec37f994
commit
45e6ec6e95
8 changed files with 49 additions and 39 deletions
|
@ -24,10 +24,21 @@ unpacked = {
|
|||
43046721
|
||||
}
|
||||
|
||||
last_total = 0
|
||||
last_estimate_time = 0
|
||||
estimate_interval_h = 30/3600
|
||||
estimated_speed = 0
|
||||
startup_total = nil
|
||||
startup_time = os.epoch("utc")
|
||||
speed = 0
|
||||
|
||||
function format_time(seconds)
|
||||
local t = math.floor(seconds)
|
||||
local t_s = t % 60
|
||||
local t_m = math.floor(t / 60) % 60
|
||||
local t_h = math.floor(t / 3600) % 24
|
||||
local t_d = math.floor(t / 86400)
|
||||
function two_digit(n)
|
||||
return n<10 and "0"..tostring(n) or tostring(n)
|
||||
end
|
||||
return t_d.."d "..two_digit(t_h)..":"..two_digit(t_m)..":"..two_digit(t_s)
|
||||
end
|
||||
|
||||
function update()
|
||||
local counts = {}
|
||||
|
@ -42,13 +53,11 @@ function update()
|
|||
end
|
||||
end
|
||||
|
||||
local time = os.time("utc")
|
||||
if time - last_estimate_time >= estimate_interval_h then
|
||||
last_estimate_time = time
|
||||
estimated_speed = (total - last_total) / (estimate_interval_h * 3600)
|
||||
last_total = total
|
||||
local time = os.epoch("utc")
|
||||
if not startup_total then
|
||||
startup_total = total
|
||||
end
|
||||
|
||||
speed = math.floor((total - startup_total) / ((time - startup_time) / 1000) * 100) / 100
|
||||
-- draw
|
||||
|
||||
term.clear()
|
||||
|
@ -59,22 +68,18 @@ function update()
|
|||
local bar = string.rep("#", count) .. string.rep(".", 9 - count)
|
||||
print("lvl", level, bar)
|
||||
end
|
||||
print()
|
||||
print("total: ", total)
|
||||
local progress = math.floor(total / unpacked[8] * 10000) / 100
|
||||
print("progress to octuple: " .. progress .. "%")
|
||||
print("speed:", estimated_speed, base_item.."/s")
|
||||
local eta = math.floor((unpacked[8] - progress) / estimated_speed + 0.5)
|
||||
local eta_s = eta % 60
|
||||
local eta_m = math.floor(eta / 60) % 60
|
||||
local eta_h = math.floor(eta / 3600) % 24
|
||||
local eta_d = math.floor(eta / 86400)
|
||||
-- print(eta)
|
||||
print("time remaining: ", eta_d .. "d", eta_h .. ":" .. eta_m .. ":" .. eta_s)
|
||||
local n = math.floor(30 * (time - last_estimate_time) / estimate_interval_h)
|
||||
print(string.rep(",", n)..string.rep(".", 32-n))
|
||||
local progress = total / unpacked[8] * 100
|
||||
print(string.format("octuple: %.5f%%\n", progress))
|
||||
print("speed:", speed, base_item .. "/s")
|
||||
local eta = math.floor((unpacked[8] - progress) / speed + 0.5)
|
||||
print("uptime:", format_time((time - startup_time) / 1000))
|
||||
print("remaining:", format_time(eta))
|
||||
|
||||
end
|
||||
|
||||
while true do
|
||||
update()
|
||||
sleep(2)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue