fix crash when setting tech recipe

This commit is contained in:
Brevven 2021-05-05 00:35:10 -07:00
parent 364a2d4d16
commit 6ec53fab5e
4 changed files with 19 additions and 7 deletions

View file

@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 0.10.11
Date: 2021-05-05
Fixes:
- Fix crash when expected equipment techs are not present.
---------------------------------------------------------------------------------------------------
Version: 0.10.10
Date: 2021-05-01
Fixes:

View file

@ -51,6 +51,13 @@ function data_util.remove_raw(t, name)
end
end
-- Set technology recipe
function data_util.set_tech_recipe(technology_name, ingredients)
if data.raw.technology[technology_name] then
data.raw.technology[technology_name].unit.ingredients = ingredients
end
end
-- Add a prerequisite to a given technology
function data_util.add_prerequisite(technology_name, prerequisite)
technology = data.raw.technology[technology_name]

View file

@ -1,6 +1,6 @@
{
"name": "bztitanium",
"version": "0.10.10",
"version": "0.10.11",
"factorio_version": "1.1",
"title": "Titanium",
"author": "Brevven",

View file

@ -21,11 +21,11 @@ else
data.raw.technology["titanium-processing"].prerequisites = {"lubricant"}
end
if not mods["Pre0-17-60Oil"] then
data.raw.technology["solar-panel-equipment"].unit.ingredients = {
{"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}}
data.raw.technology["belt-immunity-equipment"].unit.ingredients = {
{"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}}
data.raw.technology["night-vision-equipment"].unit.ingredients = {
{"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}}
util.set_tech_recipe("solar-panel-equipment", {
{"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}})
util.set_tech_recipe("belt-immunity-equipment", {
{"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}})
util.set_tech_recipe("night-vision-equipment", {
{"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}})
end
end