Compare commits

...

3 Commits

View File

@ -734,21 +734,17 @@ end
local function groups_to_items(groups, get_all)
if not get_all and #groups == 1 then
local group = groups[1]
local def_gr = "default:" .. group
local stereotypes = craftguide.group_stereotypes
local stereotype = stereotypes and stereotypes[group]
stereotype = reg_items[stereotype] and stereotype
local stereotype = craftguide.group_stereotypes[group]
local def = reg_items[stereotype]
if stereotype then
if def and show_item(def) then
return stereotype
elseif reg_items[def_gr] then
return def_gr
end
end
local names = {}
for name, def in pairs(reg_items) do
if item_has_groups(def.groups, groups) then
if show_item(def) and item_has_groups(def.groups, groups) then
if get_all then
names[#names + 1] = name
else
@ -1466,9 +1462,39 @@ core.register_craft = function(def)
local name = output[i]
if def.type == "fuel" then
def.replacements = def.replacements
def.items = {def.recipe}
fuel_cache[name] = def
elseif def.type == "cooking" then
def.items = {def.recipe}
elseif def.type == "shapeless" then
def.items, def.width = {}, 0
for j = 1, #def.recipe do
def.items[#def.items + 1] = def.recipe[j]
end
else
def.items, def.width = {}, #def.recipe[1]
local c = 0
for j = 1, #def.recipe do
if def.recipe[j] then
for h = 1, def.width do
c = c + 1
local it = def.recipe[j][h]
if it and it ~= "" then
def.items[c] = it
end
end
end
end
end
if def.type ~= "fuel" then
def.recipe = nil
recipes_cache[name] = recipes_cache[name] or {}
insert(recipes_cache[name], 1, def)
end
end
end
@ -1530,14 +1556,16 @@ local function get_init_items()
if name ~= "" and show_item(def) then
cache_drops(name, def.drop)
if not fuel_cache[name] then
if not fuel_cache[name] then --[*]
cache_fuel(name)
end
if not recipes_cache[name] then
if not recipes_cache[name] then --[*]
cache_recipes(name)
end
--[*] `core.register_craft` override may have cached them already
_preselect[name] = true
end
end