From 14d8aa513a60a1ce9cf3bbb0c35a806c79c3d7dd Mon Sep 17 00:00:00 2001 From: Wyrrrd Date: Fri, 20 Mar 2020 22:34:00 +0100 Subject: [PATCH] dynamic recipe --- changelog.txt | 5 +++++ data-final-fixes.lua | 23 +++++++++++++++++++++++ data-updates.lua | 9 --------- info.json | 2 +- 4 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 data-final-fixes.lua delete mode 100644 data-updates.lua diff --git a/changelog.txt b/changelog.txt index c871977..2432a96 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 0.18.2 +Date: 2020-03-20 + Changes: + - Replaced rail ingredient with dynamic recipe ingredients of rail recipe +--------------------------------------------------------------------------------------------------- Version: 0.18.1 Date: 2020-03-19 Changes: diff --git a/data-final-fixes.lua b/data-final-fixes.lua new file mode 100644 index 0000000..e956bba --- /dev/null +++ b/data-final-fixes.lua @@ -0,0 +1,23 @@ +local base_recipe = {} +-- grab rail recipe ingredients except stone +for _,component in pairs(data.raw["recipe"]["rail"].ingredients) do + cname = component[1] or component["name"] + camount = component[2] or component["amount"] + if cname ~= "stone" then + table.insert(base_recipe,{cname,camount}) + end +end + +data.raw["recipe"]["bbr-rail-wood"].ingredients = table.deepcopy(base_recipe) +data.raw["recipe"]["bbr-rail-iron"].ingredients = table.deepcopy(base_recipe) +data.raw["recipe"]["bbr-rail-brick"].ingredients = table.deepcopy(base_recipe) + +if settings.startup["bbr_fix_expensive"].value then + table.insert(data.raw["recipe"]["bbr-rail-wood"].ingredients,{"wood",5}) + table.insert(data.raw["recipe"]["bbr-rail-iron"].ingredients,{"iron-plate",5}) + table.insert(data.raw["recipe"]["bbr-rail-brick"].ingredients,{"stone-brick",5}) +else + table.insert(data.raw["recipe"]["bbr-rail-wood"].ingredients,{"wood",1}) + table.insert(data.raw["recipe"]["bbr-rail-iron"].ingredients,{"iron-plate",1}) + table.insert(data.raw["recipe"]["bbr-rail-brick"].ingredients,{"stone-brick",1}) +end \ No newline at end of file diff --git a/data-updates.lua b/data-updates.lua deleted file mode 100644 index 20fd6f5..0000000 --- a/data-updates.lua +++ /dev/null @@ -1,9 +0,0 @@ -if settings.startup["bbr_fix_expensive"].value then - data.raw["recipe"]["bbr-rail-wood"].ingredients = {{"rail",2},{"wood",5}} - data.raw["recipe"]["bbr-rail-iron"].ingredients = {{"rail",2},{"iron-plate",5}} - data.raw["recipe"]["bbr-rail-brick"].ingredients = {{"rail",2},{"stone-brick",5}} -else - data.raw["recipe"]["bbr-rail-wood"].ingredients = {{"rail",2},{"wood",1}} - data.raw["recipe"]["bbr-rail-iron"].ingredients = {{"rail",2},{"iron-plate",1}} - data.raw["recipe"]["bbr-rail-brick"].ingredients = {{"rail",2},{"stone-brick",1}} -end \ No newline at end of file diff --git a/info.json b/info.json index 8e0504c..cf552b0 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bbr-fix", - "version": "0.18.1", + "version": "0.18.2", "title": "Beautiful Bridge Railway - Recipe Fix", "author": "Wyrrrd", "factorio_version": "0.18",