Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function getIngIndex (recipe, name)
- for index, ingr in pairs (recipe.ingredients) do
- if ingr[1] == name or ingr.name == name then
- return index;
- end
- end
- return 0;
- end
- local function hasIng (recipe, name)
- return getIngIndex(recipe, name) ~= 0;
- end
- local function tryRemoveWheel(recipe)
- if recipe.ingredients then
- local wheelIndex = getIngIndex (recipe, 'iron-gear-wheel');
- if hasIng(recipe, 'small-parts-01') and wheelIndex > 0 then
- table.remove(recipe.ingredients, wheelIndex);
- end
- else
- if (recipe.normal) then
- tryRemoveWheel (recipe.normal);
- end
- if (recipe.expensive) then
- tryRemoveWheel (recipe.expensive);
- end
- end
- end
- for _, recipe in pairs (data.raw["recipe"]) do
- tryRemoveWheel (recipe);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement