This commit is contained in:
Jean-Patrick Guerrero 2020-07-16 02:29:18 +02:00
parent 89979a8610
commit fa1e330856
1 changed files with 10 additions and 18 deletions

View File

@ -602,13 +602,7 @@ local function cache_usages(item)
end end
if fuel_cache[item] then if fuel_cache[item] then
local fuel = { usages_cache[item] = table_merge(usages_cache[item] or {}, {fuel_cache[item]})
type = "fuel",
items = {item},
replacements = fuel_cache[item].replacements,
}
usages_cache[item] = table_merge(usages_cache[item] or {}, {fuel})
end end
end end
@ -978,11 +972,9 @@ end
local function get_grid_fs(lang_code, fs, rcp, spacing) local function get_grid_fs(lang_code, fs, rcp, spacing)
local width = rcp.width or 1 local width = rcp.width or 1
local right, btn_size, _btn_size = 0, ITEM_BTN_SIZE local right, btn_size, _btn_size = 0, ITEM_BTN_SIZE
local cooktime, shapeless local shapeless
if rcp.type == "cooking" then if width == 0 and not rcp.custom then
cooktime, width = width, 1
elseif width == 0 and not rcp.custom then
shapeless = true shapeless = true
local n = #rcp.items local n = #rcp.items
width = (n < 5 and n > 1) and 2 or min(3, max(1, n)) width = (n < 5 and n > 1) and 2 or min(3, max(1, n))
@ -1081,7 +1073,7 @@ local function get_grid_fs(lang_code, fs, rcp, spacing)
weird = weird, weird = weird,
groups = groups, groups = groups,
burntime = burntime, burntime = burntime,
cooktime = cooktime, cooktime = rcp.cooktime,
replace = replace, replace = replace,
} }
@ -1470,15 +1462,15 @@ core.register_craft = function(def)
local name = output[i] local name = output[i]
if def.type == "fuel" then if def.type == "fuel" then
fuel_cache[name] = { def.replacements = def.replacements
burntime = def.burntime, def.items = {def.recipe}
replacements = def.replacements, def.recipe = nil
} fuel_cache[name] = def
elseif def.type == "cooking" then elseif def.type == "cooking" then
def.width = def.cooktime def.cooktime = def.cooktime or 1
def.items = {def.recipe} def.items = {def.recipe}
def.recipe, def.cooktime = nil, nil def.recipe = nil
cook_cache[name] = def cook_cache[name] = def
end end
end end