diff --git a/changelog.txt b/changelog.txt index c2482a7..c15de91 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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: diff --git a/data-util.lua b/data-util.lua index d7a75a1..758cf8b 100644 --- a/data-util.lua +++ b/data-util.lua @@ -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] diff --git a/info.json b/info.json index 0c906e3..26956b3 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bztitanium", - "version": "0.10.10", + "version": "0.10.11", "factorio_version": "1.1", "title": "Titanium", "author": "Brevven", diff --git a/titanium-data-final-settings.lua b/titanium-data-final-settings.lua index 6fd8406..65f1140 100644 --- a/titanium-data-final-settings.lua +++ b/titanium-data-final-settings.lua @@ -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