Merge branch 'craftguide-clear_craft' of dekunuts/MeseCraft into unstable
commit
0e5af25afe
|
@ -1351,15 +1351,30 @@ end
|
||||||
local old_clear_craft = core.clear_craft
|
local old_clear_craft = core.clear_craft
|
||||||
|
|
||||||
core.clear_craft = function(def)
|
core.clear_craft = function(def)
|
||||||
old_clear_craft(def)
|
local craft_removed = old_clear_craft(def)
|
||||||
|
|
||||||
if true_str(def) then
|
if craft_removed then
|
||||||
def = match(def, "%S*")
|
if true_str(def) then
|
||||||
recipes_cache[def] = nil
|
def = match(def, "%S*")
|
||||||
fuel_cache[def] = nil
|
recipes_cache[def] = nil
|
||||||
|
fuel_cache[def] = nil
|
||||||
|
|
||||||
elseif is_table(def) then
|
elseif is_table(def) then
|
||||||
return -- TODO
|
if def.type == "toolrepair" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for item_name, item_recipes in pairs(recipes_cache) do
|
||||||
|
for recipe_index, recipe in pairs(item_recipes) do
|
||||||
|
for ingredient_index, ingredient in pairs(recipe.items) do
|
||||||
|
if (recipe.type == def.type) and (ingredient == def.recipe) then
|
||||||
|
table.remove(recipes_cache[item_name], recipe_index)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue