mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-22 19:03:43 +01:00
Add progress bar info
This commit is contained in:
parent
62d2b302ed
commit
92c5b1ab8e
22
init.lua
22
init.lua
@ -189,8 +189,8 @@ local function table_eq(T1, T2)
|
|||||||
return t1 == t2
|
return t1 == t2
|
||||||
end
|
end
|
||||||
|
|
||||||
if avoid_loops[t1] then return
|
if avoid_loops[t1] then
|
||||||
avoid_loops[t1] == t2
|
return avoid_loops[t1] == t2
|
||||||
end
|
end
|
||||||
|
|
||||||
avoid_loops[t1] = t2
|
avoid_loops[t1] = t2
|
||||||
@ -1393,14 +1393,22 @@ local function get_init_items()
|
|||||||
last_str = str
|
last_str = str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local full_char, empty_char = "▰", "▱"
|
||||||
|
|
||||||
for name, def in pairs(reg_items) do
|
for name, def in pairs(reg_items) do
|
||||||
ic = ic + 1
|
ic = ic + 1
|
||||||
if ic < it then
|
local percent, bar, len = (ic * 100) / it, "", 20
|
||||||
iop(fmt("[craftguide] Caching data: %u/%u items", ic, it))
|
|
||||||
else
|
for i = 1, len do
|
||||||
iop("[craftguide] Caching data: done\r\n")
|
if i <= percent / (100 / len) then
|
||||||
|
bar = bar .. full_char
|
||||||
|
else
|
||||||
|
bar = bar .. empty_char
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
iop(fmt("[craftguide] Caching data %s (%u%%)\r", bar, percent))
|
||||||
|
|
||||||
if show_item(def) then
|
if show_item(def) then
|
||||||
if not fuel_cache[name] then
|
if not fuel_cache[name] then
|
||||||
cache_fuel(name)
|
cache_fuel(name)
|
||||||
@ -1435,6 +1443,8 @@ local function get_init_items()
|
|||||||
post_data = write_json(post_data),
|
post_data = write_json(post_data),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
print()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function init_data(name)
|
local function init_data(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user