more helpers, including for k2
This commit is contained in:
parent
6c0276c69b
commit
26fadf8191
1 changed files with 11 additions and 2 deletions
|
|
@ -12,12 +12,21 @@ end
|
|||
|
||||
--- Change all occurances of steel plates to titanium plates in a given recipe
|
||||
function data_util.steel_to_titanium(recipe)
|
||||
data_util.replace_ingredient(recipe, "steel-plate", "titanium-plate")
|
||||
end
|
||||
|
||||
--- Change all occurances of rare metals to titanium plates in a given recipe
|
||||
function data_util.rare_to_titanium(recipe)
|
||||
data_util.replace_ingredient(recipe, "rare-metals", "titanium-plate")
|
||||
end
|
||||
|
||||
function data_util.replace_ingredient(recipe, old, new)
|
||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||
for i, ingredient in pairs(recipe.ingredients) do
|
||||
-- For final fixes
|
||||
if ingredient.name == "steel-plate" then ingredient.name = "titanium-plate" end
|
||||
if ingredient.name == old then ingredient.name = new end
|
||||
-- For updates
|
||||
if ingredient[1] == "steel-plate" then ingredient[1] = "titanium-plate" end
|
||||
if ingredient[1] == old then ingredient[1] = new end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue