Minor style cleaning

This commit is contained in:
Jean-Patrick Guerrero 2020-01-07 00:23:15 +01:00
parent 58b2f49c8c
commit 24d8faec59

@ -556,7 +556,7 @@ local function get_usages(item)
end end
local function get_burntime(item) local function get_burntime(item)
return get_craft_result({method = "fuel", items = {item}}).time return get_craft_result{method = "fuel", items = {item}}.time
end end
local function cache_fuel(item) local function cache_fuel(item)
@ -929,6 +929,7 @@ local function get_panels(data, fs)
if k ~= "favs" then if k ~= "favs" then
local fav = is_fav(data) local fav = is_fav(data)
local nfavs = #data.favs
fs[#fs + 1] = fmt( fs[#fs + 1] = fmt(
"style[fav;fgimg=%s;fgimg_hovered=%s;fgimg_pressed=%s]", "style[fav;fgimg=%s;fgimg_hovered=%s;fgimg_pressed=%s]",
@ -936,9 +937,14 @@ local function get_panels(data, fs)
fmt("craftguide_fav%s.png", fav and "_off" or ""), fmt("craftguide_fav%s.png", fav and "_off" or ""),
fmt("craftguide_fav%s.png", fav and "_off" or "")) fmt("craftguide_fav%s.png", fav and "_off" or ""))
if nfavs < 6 or (nfavs >= 6 and fav) then
fs[#fs + 1] = fmt(FMT.image_button, fs[#fs + 1] = fmt(FMT.image_button,
14, spacing, 0.5, 0.45, "", "fav", "") 14, spacing, 0.5, 0.45, "", "fav", "")
end end
fs[#fs + 1] = fmt("tooltip[fav;%s]",
fav and ES"Unmark this item" or ES"Mark this item")
end
end end
local rn = #v.dat local rn = #v.dat
@ -1369,20 +1375,20 @@ local function handle_drops_table(name, drop)
end end
for item, count in pairs(drop_sure) do for item, count in pairs(drop_sure) do
craftguide.register_craft({ craftguide.register_craft{
type = "digging", type = "digging",
items = {name}, items = {name},
output = fmt("%s %u", item, count), output = fmt("%s %u", item, count),
}) }
end end
for item, data in pairs(drop_maybe) do for item, data in pairs(drop_maybe) do
craftguide.register_craft({ craftguide.register_craft{
type = "digging_chance", type = "digging_chance",
items = {name}, items = {name},
output = fmt("%s %u", item, data.output), output = fmt("%s %u", item, data.output),
rarity = data.rarity, rarity = data.rarity,
}) }
end end
end end
@ -1391,11 +1397,11 @@ local function register_drops(name, def)
local dstack = ItemStack(drop) local dstack = ItemStack(drop)
if not dstack:is_empty() and dstack:get_name() ~= name then if not dstack:is_empty() and dstack:get_name() ~= name then
craftguide.register_craft({ craftguide.register_craft{
type = "digging", type = "digging",
items = {name}, items = {name},
output = drop, output = drop,
}) }
elseif is_table(drop) then elseif is_table(drop) then
handle_drops_table(name, drop) handle_drops_table(name, drop)
end end
@ -1506,10 +1512,10 @@ local function get_init_items()
fuel = fuel_cache, fuel = fuel_cache,
} }
http.fetch_async({ http.fetch_async{
url = craftguide.export_url, url = craftguide.export_url,
post_data = write_json(post_data), post_data = write_json(post_data),
}) }
end end
print() print()
@ -1720,29 +1726,29 @@ else
end end
}) })
core.register_craft({ core.register_craft{
output = "craftguide:book", output = "craftguide:book",
type = "shapeless", type = "shapeless",
recipe = {"default:book"} recipe = {"default:book"}
}) }
core.register_craft({ core.register_craft{
type = "fuel", type = "fuel",
recipe = "craftguide:book", recipe = "craftguide:book",
burntime = 3 burntime = 3
}) }
core.register_craft({ core.register_craft{
output = "craftguide:sign", output = "craftguide:sign",
type = "shapeless", type = "shapeless",
recipe = {"default:sign_wall_wood"} recipe = {"default:sign_wall_wood"}
}) }
core.register_craft({ core.register_craft{
type = "fuel", type = "fuel",
recipe = "craftguide:sign", recipe = "craftguide:sign",
burntime = 10 burntime = 10
}) }
if rawget(_G, "sfinv_buttons") then if rawget(_G, "sfinv_buttons") then
sfinv_buttons.register_button("craftguide", { sfinv_buttons.register_button("craftguide", {
@ -1958,29 +1964,29 @@ if progressive_mode then
end end
data.hud = { data.hud = {
bg = player:hud_add({ bg = player:hud_add{
hud_elem_type = "image", hud_elem_type = "image",
position = {x = 0.78, y = 1}, position = {x = 0.78, y = 1},
alignment = {x = 1, y = 1}, alignment = {x = 1, y = 1},
scale = {x = 370, y = 112}, scale = {x = 370, y = 112},
text = PNG.bg, text = PNG.bg,
}), },
book = player:hud_add({ book = player:hud_add{
hud_elem_type = "image", hud_elem_type = "image",
position = {x = 0.79, y = 1.02}, position = {x = 0.79, y = 1.02},
alignment = {x = 1, y = 1}, alignment = {x = 1, y = 1},
scale = {x = 4, y = 4}, scale = {x = 4, y = 4},
text = PNG.book, text = PNG.book,
}), },
text = player:hud_add({ text = player:hud_add{
hud_elem_type = "text", hud_elem_type = "text",
position = {x = 0.84, y = 1.04}, position = {x = 0.84, y = 1.04},
alignment = {x = 1, y = 1}, alignment = {x = 1, y = 1},
number = 0xfff, number = 0xfff,
text = "", text = "",
}), },
} }
end) end)