-
Notifications
You must be signed in to change notification settings - Fork 0
/
data-updates.lua
31 lines (27 loc) · 1.11 KB
/
data-updates.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
-- Special thanks to Gotlag for these recipe functions
local function replace_ingredient(ingredients, old_ingredient, new_ingredient)
for i,ingredient in pairs(ingredients) do
if ingredient.name then
if ingredient.name == old_ingredient then
ingredient.name = new_ingredient
end
elseif ingredient[1] == old_ingredient then
ingredient[1] = new_ingredient
end
end
end
local function update_recipe(recipe, old_ingredient, new_ingredient)
if data.raw.recipe[recipe].ingredients then
replace_ingredient(data.raw.recipe[recipe].ingredients, old_ingredient, new_ingredient)
end
if data.raw.recipe[recipe].normal then
replace_ingredient(data.raw.recipe[recipe].normal.ingredients, old_ingredient, new_ingredient)
end
if data.raw.recipe[recipe].expensive then
replace_ingredient(data.raw.recipe[recipe].expensive.ingredients, old_ingredient, new_ingredient)
end
end
update_recipe("concrete", "iron-ore", "iron-stick")
if mods["Dectorio"] then
update_recipe("dect-concrete-grid", "iron-ore", "iron-stick")
end