Fix non-shown aliased recipes

This commit is contained in:
Jean-Patrick Guerrero 2019-09-29 15:16:41 +02:00
parent 22ff82cc89
commit aef1fe0dc6

View File

@ -7,6 +7,7 @@ local searches = {}
local recipes_cache = {} local recipes_cache = {}
local usages_cache = {} local usages_cache = {}
local fuel_cache = {} local fuel_cache = {}
local alias_cache = {}
local toolrepair local toolrepair
@ -873,15 +874,13 @@ end
fuel_cache.replacements = {} fuel_cache.replacements = {}
local old_register_alias = core.register_alias local old_register_alias = core.register_alias
local current_alias = {} local old_register_craft = core.register_craft
core.register_alias = function(old, new) core.register_alias = function(old, new)
old_register_alias(old, new) old_register_alias(old, new)
current_alias = {old, new} alias_cache[new] = old
end end
local old_register_craft = core.register_craft
core.register_craft = function(def) core.register_craft = function(def)
old_register_craft(def) old_register_craft(def)
@ -902,9 +901,6 @@ core.register_craft = function(def)
for i = 1, #output do for i = 1, #output do
local name = output[i] local name = output[i]
if name == current_alias[1] then
name = current_alias[2]
end
if def.type ~= "fuel" then if def.type ~= "fuel" then
def.items = {} def.items = {}
@ -960,6 +956,20 @@ local function get_init_items()
local c = 0 local c = 0
for name, def in pairs(reg_items) do for name, def in pairs(reg_items) do
if show_item(def) then if show_item(def) then
local old_name = alias_cache[name]
if old_name then
local old_recipes = recipes_cache[old_name]
local old_usages = usages_cache[old_name]
if old_recipes then
recipes_cache[name] = old_recipes
end
if old_usages then
usages_cache[name] = old_usages
end
end
if not fuel_cache[name] then if not fuel_cache[name] then
cache_fuel(name) cache_fuel(name)
end end