Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Commit

Permalink
Remove progress bar because of too much issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbith committed Apr 12, 2020
1 parent 3f34d27 commit 689840d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
41 changes: 2 additions & 39 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ local toolrepair

local progressive_mode = core.settings:get_bool("craftguide_progressive_mode")
local sfinv_only = core.settings:get_bool("craftguide_sfinv_only") and rawget(_G, "sfinv")
local enable_cache_progress_bar = core.settings:get_bool("craftguide_enable_cache_progress_bar")

if enable_cache_progress_bar == nil then
enable_cache_progress_bar = true
end

local http = core.request_http_api()

Expand Down Expand Up @@ -61,7 +56,7 @@ local fmt, find, gmatch, match, sub, split, upper, lower =
string.sub, string.split, string.upper, string.lower

local min, max, floor, ceil = math.min, math.max, math.floor, math.ceil
local pairs, next, type, tostring, unpack, io = pairs, next, type, tostring, unpack, io
local pairs, next, type, tostring, unpack = pairs, next, type, tostring, unpack
local vec_add, vec_mul = vector.add, vector.multiply

local FORMSPEC_MINIMAL_VERSION = 3
Expand Down Expand Up @@ -1435,41 +1430,11 @@ local function show_item(def)
def.description and def.description ~= ""
end

local function tablelen(t)
local c = 0
for _ in pairs(t) do
c = c + 1
end

return c
end

local function get_init_items()
print()
local ic, it, last_str = 0, tablelen(reg_items), ""
print("[craftguide] Caching data (this may take a while)")
local hash = {}

local function iop(str)
io.write(("\b \b"):rep(#last_str))
io.write(str)
io.flush()
last_str = str
end

local full_char, empty_char = "#", " "

for name, def in pairs(reg_items) do
ic = ic + 1
local percent, bar, len = (ic * 100) / it, "[", 20

for i = 1, len do
bar = bar .. (i <= percent / (100 / len) and full_char or empty_char)
end

if enable_cache_progress_bar then
iop(fmt("[craftguide] Caching data %s %u%%\r", bar .. "]", percent))
end

if show_item(def) then
if not fuel_cache[name] then
cache_fuel(name)
Expand Down Expand Up @@ -1504,8 +1469,6 @@ local function get_init_items()
post_data = write_json(post_data),
}
end

print()
end

local function init_data(name)
Expand Down
3 changes: 0 additions & 3 deletions settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ craftguide_progressive_mode (Progressive Mode) bool false

# Integration in the default Minetest Game inventory.
craftguide_sfinv_only (Sfinv only) bool false

# Display the cache-building progress bar in the server console.
craftguide_enable_cache_progress_bar (Enable console cache progress bar) bool true

0 comments on commit 689840d

Please sign in to comment.