fix load error
This commit is contained in:
parent
4346425610
commit
1db2ff551d
3 changed files with 27 additions and 14 deletions
|
|
@ -1,4 +1,9 @@
|
||||||
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
||||||
|
Version: 0.1.4
|
||||||
|
Date: 2021-01-22
|
||||||
|
Fixes:
|
||||||
|
- Attempt to fix a load error by failing gracefully
|
||||||
|
---------------------------------------------------------------------------------------------------
|
||||||
Version: 0.1.3
|
Version: 0.1.3
|
||||||
Date: 2021-01-19
|
Date: 2021-01-19
|
||||||
Changes:
|
Changes:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bzlead",
|
"name": "bzlead",
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"factorio_version": "1.1",
|
"factorio_version": "1.1",
|
||||||
"title": "Lead",
|
"title": "Lead",
|
||||||
"author": "Brevven",
|
"author": "Brevven",
|
||||||
|
|
|
||||||
34
util.lua
34
util.lua
|
|
@ -33,9 +33,11 @@ end
|
||||||
|
|
||||||
-- Add a given quantity of ingredient to a given recipe
|
-- Add a given quantity of ingredient to a given recipe
|
||||||
function util.add_ingredient(recipe_name, ingredient, quantity)
|
function util.add_ingredient(recipe_name, ingredient, quantity)
|
||||||
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
if data.raw.recipe[recipe_name] then
|
||||||
add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
|
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
||||||
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
|
add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
|
||||||
|
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function add_ingredient(recipe, ingredient, quantity)
|
function add_ingredient(recipe, ingredient, quantity)
|
||||||
|
|
@ -44,11 +46,13 @@ function add_ingredient(recipe, ingredient, quantity)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Replace one ingredien with another in a recipe
|
-- Replace one ingredient with another in a recipe
|
||||||
function util.replace_ingredient(recipe_name, old, new)
|
function util.replace_ingredient(recipe_name, old, new)
|
||||||
replace_ingredient(data.raw.recipe[recipe_name], old, new)
|
if data.raw.recipe[recipe_name] then
|
||||||
replace_ingredient(data.raw.recipe[recipe_name].normal, old, new)
|
replace_ingredient(data.raw.recipe[recipe_name], old, new)
|
||||||
replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new)
|
replace_ingredient(data.raw.recipe[recipe_name].normal, old, new)
|
||||||
|
replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function replace_ingredient(recipe, old, new)
|
function replace_ingredient(recipe, old, new)
|
||||||
|
|
@ -64,9 +68,11 @@ end
|
||||||
|
|
||||||
-- Remove an ingredient from a recipe
|
-- Remove an ingredient from a recipe
|
||||||
function util.remove_ingredient(recipe_name, old)
|
function util.remove_ingredient(recipe_name, old)
|
||||||
remove_ingredient(data.raw.recipe[recipe_name], old)
|
if data.raw.recipe[recipe_name] then
|
||||||
remove_ingredient(data.raw.recipe[recipe_name].normal, old)
|
remove_ingredient(data.raw.recipe[recipe_name], old)
|
||||||
remove_ingredient(data.raw.recipe[recipe_name].expensive, old)
|
remove_ingredient(data.raw.recipe[recipe_name].normal, old)
|
||||||
|
remove_ingredient(data.raw.recipe[recipe_name].expensive, old)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function remove_ingredient(recipe, old)
|
function remove_ingredient(recipe, old)
|
||||||
|
|
@ -87,9 +93,11 @@ end
|
||||||
|
|
||||||
-- Replace an amount of an ingredient in a recipe. Keep at least 1 of old.
|
-- Replace an amount of an ingredient in a recipe. Keep at least 1 of old.
|
||||||
function util.replace_some_ingredient(recipe_name, old, new, amount)
|
function util.replace_some_ingredient(recipe_name, old, new, amount)
|
||||||
replace_some_ingredient(data.raw.recipe[recipe_name], old, new, amount)
|
if data.raw.recipe[recipe_name] then
|
||||||
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, new, amount)
|
replace_some_ingredient(data.raw.recipe[recipe_name], old, new, amount)
|
||||||
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, new, amount)
|
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, new, amount)
|
||||||
|
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, new, amount)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function replace_some_ingredient(recipe, old, new, amount)
|
function replace_some_ingredient(recipe, old, new, amount)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue