From ef6b218b0df465daabdc6832ba8b809a5ffc2582 Mon Sep 17 00:00:00 2001 From: Afforess Date: Thu, 14 Apr 2016 21:51:52 -0400 Subject: [PATCH] Update bob compatibility, check for ingredients before updating --- Makefile | 2 +- data-updates.lua | 78 +++++- data.lua | 2 + info.json | 4 +- prototypes/bobsmods/recipe-chemistry.lua | 18 +- prototypes/bobsmods/recipe-circuit.lua | 286 +++++++++++--------- prototypes/bobsmods/recipe-intermediate.lua | 36 +-- prototypes/bobsmods/recipe-logistics.lua | 36 +-- prototypes/bobsmods/recipe-power.lua | 96 +++---- prototypes/bobsmods/recipe-production.lua | 36 +-- prototypes/bobsmods/recipe-resource.lua | 14 +- prototypes/bobsmods/recipe-turret.lua | 6 +- 12 files changed, 358 insertions(+), 256 deletions(-) diff --git a/Makefile b/Makefile index 4e0a263..393af5f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION := 1.0.2 +VERSION := 1.0.3 NAME := marathon all: clean build install_mod diff --git a/data-updates.lua b/data-updates.lua index 015c689..4ad1ea3 100644 --- a/data-updates.lua +++ b/data-updates.lua @@ -1,12 +1,78 @@ -if bobmods and bobmods.config then - function update_recipe(name, values) - local recipe = data.raw.recipe[name] - if recipe then - for key, value in pairs(values) do - recipe[key] = value + +function marathon.update_recipe(name, values) + local recipe = data.raw.recipe[name] + if recipe then + for key, value in pairs(values) do + recipe[key] = value + end + end +end + +function marathon.replace_recipe_item(recipe, prev_name, new_name) + local doit = false + local amount = 0 + if data.raw.recipe[recipe] and data.raw.item[new_name] then + local ingredients = data.raw.recipe[recipe].ingredients + for i = 1, #ingredients do + local ingredient_item = ingredients[i] + if ingredient_item[1] == prev_name then + ingredient_item[1] = new_name + elseif ingredient_item.name == prev_name then + ingredient_item.name = new_name + end + end + end +end + +function marathon.add_new_recipe_item(recipe, item) + local item_name + if item.name then + item_name = item.name + else + item_name = item[1] + end + + if data.raw.recipe[recipe] and data.raw.item[item_name] then + for _, ingredient_item in pairs(data.raw.recipe[recipe].ingredients) do + if ingredient_item[1] == item_name then + return + elseif ingredient_item.name == item_name then + return end end + table.insert(data.raw.recipe[recipe].ingredients, item) end +end + +function marathon.add_recipe_item(recipe, item) + local addit = true + local item_name + if item.name then + item_name = item.name + else + item_name = item[1] + end + local item_amount + if item.amount then + item_amount = item.amount + else + item_amount = item[2] + end + if data.raw.recipe[recipe] and data.raw.item[item_name] then + for _, ingredient_item in pairs(data.raw.recipe[recipe].ingredients) do + if ingredient_item[1] == item_name then + ingredient_item[2] = ingredient_item[2] + item_amount + return + elseif ingredient_item.name == item_name then + ingredient_item.amount = ingredient_item.amount + item_amount + return + end + end + table.insert(data.raw.recipe[recipe].ingredients, item) + end +end + +if bobmods and bobmods.config then require("prototypes.bobsmods.item") require("prototypes.bobsmods.recipe-chemistry") require("prototypes.bobsmods.recipe-circuit") diff --git a/data.lua b/data.lua index 2028584..4f54d61 100644 --- a/data.lua +++ b/data.lua @@ -10,3 +10,5 @@ require("prototypes.recipe-production") require("prototypes.recipe-science") require("prototypes.recipe-smelting") require("prototypes.recipe-weapon") + +marathon = {} diff --git a/info.json b/info.json index 18cff0a..754f7eb 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "marathon", - "version": "1.0.2", + "version": "1.0.3", "title": "Marathon Mod", "author": "Benoit Girard & Afforess", "contributors": ["Wulfson", "KeepOnDigging", "gheift"], @@ -20,5 +20,5 @@ "? bobpower >= 0.12.6", "? bobtech >= 0.12.4", "? bobwarfare >= 0.12.9" - ] + ] } diff --git a/prototypes/bobsmods/recipe-chemistry.lua b/prototypes/bobsmods/recipe-chemistry.lua index b2b5056..1053f04 100644 --- a/prototypes/bobsmods/recipe-chemistry.lua +++ b/prototypes/bobsmods/recipe-chemistry.lua @@ -1,5 +1,5 @@ -update_recipe("alumina", +marathon.update_recipe("alumina", { energy_required = 6, result_count = 6, @@ -9,8 +9,8 @@ update_recipe("alumina", } }) -if bobmods.config.plates.BatteryUpdate then - update_recipe("battery", +if bobmods.config.plates.BatteryUpdate and data.raw.item["lead-plate"] and data.raw.item["sulfuric-acid"] then + marathon.update_recipe("battery", { ingredients = { {type="item", name="lead-plate", amount=4}, @@ -20,7 +20,7 @@ if bobmods.config.plates.BatteryUpdate then }) end -update_recipe("coal-cracking", +marathon.update_recipe("coal-cracking", { energy_required = 6, ingredients = { @@ -32,7 +32,7 @@ update_recipe("coal-cracking", } }) -update_recipe("ferric-chloride-solution", +marathon.update_recipe("ferric-chloride-solution", { energy_required = 5, results = { @@ -40,7 +40,7 @@ update_recipe("ferric-chloride-solution", } }) -update_recipe("liquid-fuel", +marathon.update_recipe("liquid-fuel", { energy_required = 3, ingredients = { @@ -48,7 +48,7 @@ update_recipe("liquid-fuel", } }) -update_recipe("lithium-chloride", +marathon.update_recipe("lithium-chloride", { energy_required = 2, ingredients = { @@ -56,12 +56,12 @@ update_recipe("lithium-chloride", } }) -update_recipe("sulfur-2", +marathon.update_recipe("sulfur-2", { energy_required = 1.5 }) -update_recipe("sulfuric-acid-2", +marathon.update_recipe("sulfuric-acid-2", { ingredients = { {type="fluid", name="water", amount=1}, diff --git a/prototypes/bobsmods/recipe-circuit.lua b/prototypes/bobsmods/recipe-circuit.lua index 1988c4b..e4e1c8f 100644 --- a/prototypes/bobsmods/recipe-circuit.lua +++ b/prototypes/bobsmods/recipe-circuit.lua @@ -1,60 +1,76 @@ -update_recipe("advanced-circuit", -{ - ingredients = { - {type="item", name="circuit-board", amount=1}, - {type="item", name="basic-electronic-components", amount=6}, - {type="item", name="electronic-components", amount=6}, - } -}) -update_recipe("advanced-processing-unit", -{ - energy_required = 25, - ingredients = { - {type="item", name="multi-layer-circuit-board", amount=1}, - {type="item", name="basic-electronic-components", amount=3}, - {type="item", name="electronic-components", amount=4}, - {type="item", name="intergrated-electronics", amount=6}, - {type="item", name="processing-electronics", amount=4}, - } -}) -update_recipe("basic-electronic-components", -{ - energy_required = 3, - ingredients = { - {type="item", name="copper-cable", amount=1}, - {type="item", name="coal", amount=2}, - } -}) -update_recipe("circuit-board", -{ - ingredients = { - {type="item", name="phenolic-board", amount=1}, - {type="item", name="copper-plate", amount=4}, - {type="fluid", name="ferric-chloride-solution", amount=1.5} - } -}) -update_recipe("electronic-circuit", -{ - enabled = false, - energy_required = 2.5, - ingredients = { - {type="item", name="basic-circuit-board", amount=1}, - {type="item", name="basic-electronic-components", amount=10}, - } -}) -update_recipe("electronic-components", -{ - energy_required = 7, - ingredients = { - {type="item", name="copper-cable", amount=1}, - {type="item", name="plastic-bar", amount=2}, - } -}) -update_recipe("fibreglass-board", + +if data.raw.item["basic-electronic-components"] and data.raw.item["electronic-components"] then + marathon.update_recipe("advanced-circuit", + { + ingredients = { + {type="item", name="circuit-board", amount=1}, + {type="item", name="basic-electronic-components", amount=6}, + {type="item", name="electronic-components", amount=6}, + } + }) + + marathon.update_recipe("advanced-processing-unit", + { + energy_required = 25, + ingredients = { + {type="item", name="multi-layer-circuit-board", amount=1}, + {type="item", name="basic-electronic-components", amount=3}, + {type="item", name="electronic-components", amount=4}, + {type="item", name="intergrated-electronics", amount=6}, + {type="item", name="processing-electronics", amount=4}, + } + }) + + marathon.update_recipe("basic-electronic-components", + { + energy_required = 3, + ingredients = { + {type="item", name="copper-cable", amount=1}, + {type="item", name="coal", amount=2}, + } + }) +end + +if data.raw.item["phenolic-board"] then + marathon.update_recipe("circuit-board", + { + ingredients = { + {type="item", name="phenolic-board", amount=1}, + {type="item", name="copper-plate", amount=4}, + {type="fluid", name="ferric-chloride-solution", amount=1.5} + } + }) +end + +if data.raw.item["basic-electronic-components"] and data.raw.item["electronic-components"] then + marathon.update_recipe("electronic-circuit", + { + enabled = false, + energy_required = 2.5, + ingredients = { + {type="item", name="basic-circuit-board", amount=1}, + {type="item", name="basic-electronic-components", amount=10}, + } + }) +end + +if data.raw.item["electronic-components"] then + marathon.update_recipe("electronic-components", + { + energy_required = 7, + ingredients = { + {type="item", name="copper-cable", amount=1}, + {type="item", name="plastic-bar", amount=2}, + } + }) +end + +marathon.update_recipe("fibreglass-board", { result_count = 1 }) -update_recipe("intergrated-electronics", + +marathon.update_recipe("intergrated-electronics", { energy_required = 8, ingredients = { @@ -63,31 +79,41 @@ update_recipe("intergrated-electronics", {type="fluid", name="sulfuric-acid", amount=1.5} } }) -update_recipe("multi-layer-circuit-board", -{ - ingredients = { - {type="item", name="fibreglass-board", amount=1}, - {type="item", name="copper-plate", amount=8}, - {type="fluid", name="ferric-chloride-solution", amount=3} - } -}) -update_recipe("phenolic-board", -{ - result_count = 1, - ingredients = { - {type="item", name="wood", amount=1}, - {type="item", name="resin", amount=3}, - } -}) -update_recipe("phenolic-board-synthetic", -{ - result_count = 1, - ingredients = { - {type="item", name="synthetic-wood", amount=1}, - {type="item", name="resin", amount=3}, - } -}) -update_recipe("processing-electronics", + +if data.raw.item["fibreglass-board"] and data.raw.item["ferric-chloride-solution"] then + marathon.update_recipe("multi-layer-circuit-board", + { + ingredients = { + {type="item", name="fibreglass-board", amount=1}, + {type="item", name="copper-plate", amount=8}, + {type="fluid", name="ferric-chloride-solution", amount=3} + } + }) +end + +if data.raw.item["resin"] then + marathon.update_recipe("phenolic-board", + { + result_count = 1, + ingredients = { + {type="item", name="wood", amount=1}, + {type="item", name="resin", amount=3}, + } + }) + + if data.raw.item["synthetic-wood"] then + marathon.update_recipe("phenolic-board-synthetic", + { + result_count = 1, + ingredients = { + {type="item", name="synthetic-wood", amount=1}, + {type="item", name="resin", amount=3}, + } + }) + end +end + +marathon.update_recipe("processing-electronics", { ingredients = { {type="item", name="copper-cable", amount=4}, @@ -95,95 +121,103 @@ update_recipe("processing-electronics", {type="fluid", name="sulfuric-acid", amount=1.5} } }) -update_recipe("processing-unit", -{ - energy_required = 15, - ingredients = { - {"superior-circuit-board", 1}, - {"basic-electronic-components", 6}, - {"electronic-components", 6}, - {"intergrated-electronics", 4}, - } -}) + +if data.raw.item["intergrated-electronic"] and + data.raw.item["electronic-components"] and + data.raw.item["superior-circuit-board"] and + data.raw.item["basic-electronic-components"] then + marathon.update_recipe("processing-unit", + { + energy_required = 15, + ingredients = { + {"superior-circuit-board", 1}, + {"basic-electronic-components", 6}, + {"electronic-components", 6}, + {"intergrated-electronics", 4}, + } + }) +end if data.raw.item["solder-alloy"] then - update_recipe("solder", + marathon.update_recipe("solder", { energy_required = 4, result_count = 4 }) end -update_recipe("superior-circuit-board", -{ - ingredients = { - {type="item", name="fibreglass-board", amount=1}, - {type="item", name="copper-plate", amount=4}, - {type="fluid", name="ferric-chloride-solution", amount=1.5} - } -}) +if data.raw.item["fibreglass-board"] and data.raw.item["ferric-chloride-solution"] then + marathon.update_recipe("superior-circuit-board", + { + ingredients = { + {type="item", name="fibreglass-board", amount=1}, + {type="item", name="copper-plate", amount=4}, + {type="fluid", name="ferric-chloride-solution", amount=1.5} + } + }) +end -- Update Marathon recipes w/bob items if data.raw.item["tinned-copper-cable"] then - bobmods.lib.replace_recipe_item("basic-electronic-components", "copper-cable", "tinned-copper-cable") - bobmods.lib.replace_recipe_item("electronic-components", "copper-cable", "tinned-copper-cable") - bobmods.lib.replace_recipe_item("intergrated-electronics", "copper-cable", "tinned-copper-cable") + marathon.replace_recipe_item("basic-electronic-components", "copper-cable", "tinned-copper-cable") + marathon.replace_recipe_item("electronic-components", "copper-cable", "tinned-copper-cable") + marathon.replace_recipe_item("intergrated-electronics", "copper-cable", "tinned-copper-cable") end if data.raw.item["carbon"] then - bobmods.lib.replace_recipe_item("basic-electronic-components", "coal", "carbon") + marathon.replace_recipe_item("basic-electronic-components", "coal", "carbon") end if data.raw.item["silicon-wafer"] then - bobmods.lib.add_recipe_item("electronic-components", {"silicon-wafer", 4}) - bobmods.lib.add_recipe_item("intergrated-electronics", {"silicon-wafer", 6}) - bobmods.lib.add_recipe_item("processing-electronics", {"silicon-wafer", 10}) + marathon.add_recipe_item("electronic-components", {"silicon-wafer", 4}) + marathon.add_recipe_item("intergrated-electronics", {"silicon-wafer", 6}) + marathon.add_recipe_item("processing-electronics", {"silicon-wafer", 10}) else if data.raw.item["silicon"] then - bobmods.lib.add_recipe_item("electronic-components", {"silicon", 3}) - bobmods.lib.add_recipe_item("intergrated-electronics", {"silicon", 4}) - bobmods.lib.add_recipe_item("processing-electronics", {"silicon", 5}) + marathon.add_recipe_item("electronic-components", {"silicon", 3}) + marathon.add_recipe_item("intergrated-electronics", {"silicon", 4}) + marathon.add_recipe_item("processing-electronics", {"silicon", 5}) else - bobmods.lib.add_recipe_item("electronic-components", {"copper-plate", 3}) - bobmods.lib.add_recipe_item("intergrated-electronics", {"copper-plate", 5}) - bobmods.lib.add_recipe_item("processing-electronics", {"copper-plate", 7}) + marathon.add_recipe_item("electronic-components", {"copper-plate", 3}) + marathon.add_recipe_item("intergrated-electronics", {"copper-plate", 5}) + marathon.add_recipe_item("processing-electronics", {"copper-plate", 7}) end end if data.raw.item["gilded-copper-cable"] then - bobmods.lib.replace_recipe_item("processing-electronics", "copper-cable", "gilded-copper-cable") + marathon.replace_recipe_item("processing-electronics", "copper-cable", "gilded-copper-cable") else if data.raw.item["tinned-copper-cable"] then - bobmods.lib.replace_recipe_item("processing-electronics", "copper-cable", "tinned-copper-cable") + marathon.replace_recipe_item("processing-electronics", "copper-cable", "tinned-copper-cable") end end if data.raw.item["silicon-nitride"] then - bobmods.lib.replace_recipe_item("processing-electronics", "plastic-bar", "silicon-nitride") + marathon.replace_recipe_item("processing-electronics", "plastic-bar", "silicon-nitride") end if data.raw.item["tin-plate"] then - bobmods.lib.add_recipe_item("circuit-board", {"tin-plate", 2}) + marathon.add_recipe_item("circuit-board", {"tin-plate", 2}) else - bobmods.lib.add_recipe_item("circuit-board", {"copper-plate", 2}) + marathon.add_recipe_item("circuit-board", {"copper-plate", 2}) end if data.raw.item["gold-plate"] then - bobmods.lib.add_recipe_item("superior-circuit-board", {"gold-plate", 2}) - bobmods.lib.add_recipe_item("multi-layer-circuit-board", {"gold-plate", 4}) + marathon.add_recipe_item("superior-circuit-board", {"gold-plate", 2}) + marathon.add_recipe_item("multi-layer-circuit-board", {"gold-plate", 4}) else if data.raw.item["tin-plate"] then - bobmods.lib.add_recipe_item("superior-circuit-board", {"tin-plate", 2}) - bobmods.lib.add_recipe_item("multi-layer-circuit-board", {"tin-plate", 4}) + marathon.add_recipe_item("superior-circuit-board", {"tin-plate", 2}) + marathon.add_recipe_item("multi-layer-circuit-board", {"tin-plate", 4}) else - bobmods.lib.add_recipe_item("superior-circuit-board", {"copper-plate", 2}) - bobmods.lib.add_recipe_item("multi-layer-circuit-board", {"copper-plate", 4}) + marathon.add_recipe_item("superior-circuit-board", {"copper-plate", 2}) + marathon.add_recipe_item("multi-layer-circuit-board", {"copper-plate", 4}) end end if data.raw.item["solder"] then - bobmods.lib.add_recipe_item("electronic-circuit", {"solder", 2}) - bobmods.lib.add_recipe_item("advanced-circuit", {"solder", 2}) - bobmods.lib.add_recipe_item("processing-unit", {"solder", 3}) - bobmods.lib.add_recipe_item("advanced-processing-unit", {"solder", 6}) + marathon.add_recipe_item("electronic-circuit", {"solder", 2}) + marathon.add_recipe_item("advanced-circuit", {"solder", 2}) + marathon.add_recipe_item("processing-unit", {"solder", 3}) + marathon.add_recipe_item("advanced-processing-unit", {"solder", 6}) end diff --git a/prototypes/bobsmods/recipe-intermediate.lua b/prototypes/bobsmods/recipe-intermediate.lua index 5a7fe2d..fc3075c 100644 --- a/prototypes/bobsmods/recipe-intermediate.lua +++ b/prototypes/bobsmods/recipe-intermediate.lua @@ -1,5 +1,5 @@ if data.raw.item["brass-alloy"] then - update_recipe("brass-gear-wheel", + marathon.update_recipe("brass-gear-wheel", { energy_required = 1.5, ingredients = { @@ -9,7 +9,7 @@ if data.raw.item["brass-alloy"] then end if data.raw.item["silicon-nitride"] then - update_recipe("ceramic-bearing", + marathon.update_recipe("ceramic-bearing", { energy_required = 1.5, ingredients = { @@ -19,13 +19,13 @@ if data.raw.item["silicon-nitride"] then } }) - update_recipe("ceramic-bearing-ball", + marathon.update_recipe("ceramic-bearing-ball", { result_count = 8 }) end -update_recipe("cobalt-oxide-from-copper", +marathon.update_recipe("cobalt-oxide-from-copper", { energy_required = 37.5, ingredients = { @@ -41,7 +41,7 @@ update_recipe("cobalt-oxide-from-copper", }, }) -update_recipe("lithium-ion-battery", +marathon.update_recipe("lithium-ion-battery", { energy_required = 1.5, ingredients = { @@ -53,8 +53,8 @@ update_recipe("lithium-ion-battery", }) if data.raw.item["nitinol-alloy"] then - - update_recipe("nitinol-bearing", + + marathon.update_recipe("nitinol-bearing", { energy_required = 1.5, ingredients = { @@ -63,13 +63,13 @@ if data.raw.item["nitinol-alloy"] then {type="fluid", name="lubricant", amount=2} } }) - - update_recipe("nitinol-bearing-ball", + + marathon.update_recipe("nitinol-bearing-ball", { result_count = 8 }) - update_recipe("nitinol-gear-wheel", + marathon.update_recipe("nitinol-gear-wheel", { energy_required = 1.5, ingredients = { @@ -78,12 +78,12 @@ if data.raw.item["nitinol-alloy"] then }) end -update_recipe("silver-zinc-battery", +marathon.update_recipe("silver-zinc-battery", { energy_required = 3 }) -update_recipe("steel-bearing", +marathon.update_recipe("steel-bearing", { energy_required = 1.5, ingredients = { @@ -92,12 +92,12 @@ update_recipe("steel-bearing", } }) -update_recipe("steel-bearing-ball", +marathon.update_recipe("steel-bearing-ball", { result_count = 8 }) -update_recipe("steel-gear-wheel", +marathon.update_recipe("steel-gear-wheel", { energy_required = 1.5, ingredients = { @@ -106,7 +106,7 @@ update_recipe("steel-gear-wheel", }) if data.raw.item["titanium-plate"] then - update_recipe("titanium-bearing", + marathon.update_recipe("titanium-bearing", { energy_required = 1.5, ingredients = { @@ -116,12 +116,12 @@ if data.raw.item["titanium-plate"] then } }) - update_recipe("titanium-bearing-ball", + marathon.update_recipe("titanium-bearing-ball", { result_count = 8 }) - update_recipe("titanium-gear-wheel", + marathon.update_recipe("titanium-gear-wheel", { energy_required = 1.5, ingredients = { @@ -131,7 +131,7 @@ if data.raw.item["titanium-plate"] then end if data.raw.item["tungsten-plate"] then - update_recipe("tungsten-gear-wheel", + marathon.update_recipe("tungsten-gear-wheel", { energy_required = 1.5, ingredients = { diff --git a/prototypes/bobsmods/recipe-logistics.lua b/prototypes/bobsmods/recipe-logistics.lua index 169c366..d37a9d8 100644 --- a/prototypes/bobsmods/recipe-logistics.lua +++ b/prototypes/bobsmods/recipe-logistics.lua @@ -1,11 +1,11 @@ if data.raw.item["brass-alloy"] then - update_recipe("brass-pipe", + marathon.update_recipe("brass-pipe", { ingredients = { {type="item", name="brass-alloy", amount=2}, } }) - update_recipe("brass-pipe-to-ground", + marathon.update_recipe("brass-pipe-to-ground", { ingredients = { {type="item", name="brass-pipe", amount=15}, @@ -15,13 +15,13 @@ if data.raw.item["brass-alloy"] then end if data.raw.item["bronze-alloy"] then - update_recipe("bronze-pipe", + marathon.update_recipe("bronze-pipe", { ingredients = { {type="item", name="bronze-alloy", amount=2}, } }) - update_recipe("bronze-pipe-to-ground", + marathon.update_recipe("bronze-pipe-to-ground", { ingredients = { {type="item", name="bronze-pipe", amount=12}, @@ -30,26 +30,26 @@ if data.raw.item["bronze-alloy"] then }) end -update_recipe("copper-pipe", +marathon.update_recipe("copper-pipe", { ingredients = { {type="item", name="copper-plate", amount=2}, } }) -update_recipe("copper-pipe-to-ground", +marathon.update_recipe("copper-pipe-to-ground", { ingredients = { {type="item", name="copper-pipe", amount=10}, {type="item", name="copper-plate", amount=10}, } }) -update_recipe("plastic-pipe", +marathon.update_recipe("plastic-pipe", { ingredients = { {type="item", name="plastic-bar", amount=2}, } }) -update_recipe("plastic-pipe-to-ground", +marathon.update_recipe("plastic-pipe-to-ground", { ingredients = { {type="item", name="plastic-pipe", amount=12}, @@ -58,13 +58,13 @@ update_recipe("plastic-pipe-to-ground", }) if data.raw.item["silicon-nitride"] then - update_recipe("ceramic-pipe", + marathon.update_recipe("ceramic-pipe", { ingredients = { {type="item", name="silicon-nitride", amount=2}, } }) - update_recipe("ceramic-pipe-to-ground", + marathon.update_recipe("ceramic-pipe-to-ground", { ingredients = { {type="item", name="ceramic-pipe", amount=15}, @@ -73,26 +73,26 @@ if data.raw.item["silicon-nitride"] then }) end -update_recipe("steel-pipe", +marathon.update_recipe("steel-pipe", { ingredients = { {type="item", name="steel-plate", amount=2}, } }) -update_recipe("steel-pipe-to-ground", +marathon.update_recipe("steel-pipe-to-ground", { ingredients = { {type="item", name="steel-pipe", amount=12}, {type="item", name="steel-plate", amount=12} } }) -update_recipe("stone-pipe", +marathon.update_recipe("stone-pipe", { ingredients = { {type="item", name="stone-brick", amount=2} } }) -update_recipe("stone-pipe-to-ground", +marathon.update_recipe("stone-pipe-to-ground", { ingredients = { {type="item", name="stone-pipe", amount=10}, @@ -101,14 +101,14 @@ update_recipe("stone-pipe-to-ground", }) if data.raw.item["titanium-plate"] then - update_recipe("titanium-pipe", + marathon.update_recipe("titanium-pipe", { ingredients = { {type="item", name="titanium-plate", amount=2}, } }) - update_recipe("titanium-pipe-to-ground", + marathon.update_recipe("titanium-pipe-to-ground", { ingredients = { {type="item", name="titanium-pipe", amount=15}, @@ -118,14 +118,14 @@ if data.raw.item["titanium-plate"] then end if data.raw.item["tungsten-plate"] then - update_recipe("tungsten-pipe", + marathon.update_recipe("tungsten-pipe", { ingredients = { {type="item", name="tungsten-plate", amount=2}, } }) - update_recipe("tungsten-pipe-to-ground", + marathon.update_recipe("tungsten-pipe-to-ground", { ingredients = { {type="item", name="tungsten-pipe", amount=18}, diff --git a/prototypes/bobsmods/recipe-power.lua b/prototypes/bobsmods/recipe-power.lua index cda2cfa..f491059 100644 --- a/prototypes/bobsmods/recipe-power.lua +++ b/prototypes/bobsmods/recipe-power.lua @@ -1,4 +1,4 @@ -update_recipe("boiler-2", +marathon.update_recipe("boiler-2", { ingredients = { {type="item", name="boiler", amount=1}, @@ -6,7 +6,7 @@ update_recipe("boiler-2", } }) -update_recipe("boiler-3", +marathon.update_recipe("boiler-3", { ingredients = { {type="item", name="boiler-2", amount=1}, @@ -14,7 +14,7 @@ update_recipe("boiler-3", } }) -update_recipe("boiler-4", +marathon.update_recipe("boiler-4", { ingredients = { {type="item", name="boiler-3", amount=1}, @@ -22,7 +22,7 @@ update_recipe("boiler-4", } }) -update_recipe("fast-accumulator", +marathon.update_recipe("fast-accumulator", { energy_required = 20, ingredients = { @@ -32,7 +32,7 @@ update_recipe("fast-accumulator", } }) -update_recipe("fast-accumulator-2", +marathon.update_recipe("fast-accumulator-2", { energy_required = 20, ingredients = { @@ -43,7 +43,7 @@ update_recipe("fast-accumulator-2", } }) -update_recipe("fast-accumulator-3", +marathon.update_recipe("fast-accumulator-3", { energy_required = 20, ingredients = { @@ -54,7 +54,7 @@ update_recipe("fast-accumulator-3", } }) -update_recipe("large-accumulator", +marathon.update_recipe("large-accumulator", { energy_required = 20, ingredients = { @@ -63,7 +63,7 @@ update_recipe("large-accumulator", } }) -update_recipe("large-accumulator-2", +marathon.update_recipe("large-accumulator-2", { energy_required = 20, ingredients = { @@ -74,7 +74,7 @@ update_recipe("large-accumulator-2", } }) -update_recipe("large-accumulator-3", +marathon.update_recipe("large-accumulator-3", { energy_required = 20, ingredients = { @@ -85,7 +85,7 @@ update_recipe("large-accumulator-3", } }) -update_recipe("slow-accumulator", +marathon.update_recipe("slow-accumulator", { energy_required = 20, ingredients = { @@ -95,7 +95,7 @@ update_recipe("slow-accumulator", } }) -update_recipe("slow-accumulator-2", +marathon.update_recipe("slow-accumulator-2", { energy_required = 20, ingredients = { @@ -106,7 +106,7 @@ update_recipe("slow-accumulator-2", } }) -update_recipe("slow-accumulator-3", +marathon.update_recipe("slow-accumulator-3", { energy_required = 20, ingredients = { @@ -117,7 +117,7 @@ update_recipe("slow-accumulator-3", } }) -update_recipe("solar-panel", +marathon.update_recipe("solar-panel", { energy_required = 20, ingredients = { @@ -127,7 +127,7 @@ update_recipe("solar-panel", } }) -update_recipe("solar-panel-large", +marathon.update_recipe("solar-panel-large", { energy_required = 40, ingredients = { @@ -137,7 +137,7 @@ update_recipe("solar-panel-large", } }) -update_recipe("solar-panel-small", +marathon.update_recipe("solar-panel-small", { energy_required = 10, ingredients = { @@ -147,7 +147,7 @@ update_recipe("solar-panel-small", } }) -update_recipe("steam-engine-2", +marathon.update_recipe("steam-engine-2", { energy_required = 45, ingredients = { @@ -157,7 +157,7 @@ update_recipe("steam-engine-2", } }) -update_recipe("steam-engine-3", +marathon.update_recipe("steam-engine-3", { energy_required = 30, ingredients = { @@ -169,91 +169,91 @@ update_recipe("steam-engine-3", }) if data.raw.item["lithium-ion-battery"] then - bobmods.lib.replace_recipe_item ("large-accumulator-2", "battery", "lithium-ion-battery") - bobmods.lib.replace_recipe_item ("fast-accumulator-2", "battery", "lithium-ion-battery") - bobmods.lib.replace_recipe_item ("slow-accumulator-2", "battery", "lithium-ion-battery") + marathon.replace_recipe_item("large-accumulator-2", "battery", "lithium-ion-battery") + marathon.replace_recipe_item("fast-accumulator-2", "battery", "lithium-ion-battery") + marathon.replace_recipe_item("slow-accumulator-2", "battery", "lithium-ion-battery") end if data.raw.item["titanium-plate"] then - bobmods.lib.replace_recipe_item ("large-accumulator-3", "steel-plate", "titanium-plate") - bobmods.lib.replace_recipe_item ("fast-accumulator-3", "steel-plate", "titanium-plate") - bobmods.lib.replace_recipe_item ("slow-accumulator-3", "steel-plate", "titanium-plate") + marathon.replace_recipe_item("large-accumulator-3", "steel-plate", "titanium-plate") + marathon.replace_recipe_item("fast-accumulator-3", "steel-plate", "titanium-plate") + marathon.replace_recipe_item("slow-accumulator-3", "steel-plate", "titanium-plate") else if data.raw.item["aluminium-plate"] then - bobmods.lib.replace_recipe_item ("large-accumulator-3", "steel-plate", "aluminium-plate") - bobmods.lib.replace_recipe_item ("fast-accumulator-3", "steel-plate", "aluminium-plate") - bobmods.lib.replace_recipe_item ("slow-accumulator-3", "steel-plate", "aluminium-plate") + marathon.replace_recipe_item("large-accumulator-3", "steel-plate", "aluminium-plate") + marathon.replace_recipe_item("fast-accumulator-3", "steel-plate", "aluminium-plate") + marathon.replace_recipe_item("slow-accumulator-3", "steel-plate", "aluminium-plate") end end if data.raw.item["silver-zinc-battery"] then - bobmods.lib.replace_recipe_item ("large-accumulator-3", "battery", "silver-zinc-battery") - bobmods.lib.replace_recipe_item ("fast-accumulator-3", "battery", "silver-zinc-battery") - bobmods.lib.replace_recipe_item ("slow-accumulator-3", "battery", "silver-zinc-battery") + marathon.replace_recipe_item("large-accumulator-3", "battery", "silver-zinc-battery") + marathon.replace_recipe_item("fast-accumulator-3", "battery", "silver-zinc-battery") + marathon.replace_recipe_item("slow-accumulator-3", "battery", "silver-zinc-battery") else if data.raw.item["lithium-ion-battery"] then - bobmods.lib.replace_recipe_item ("large-accumulator-3", "battery", "lithium-ion-battery") - bobmods.lib.replace_recipe_item ("fast-accumulator-3", "battery", "lithium-ion-battery") - bobmods.lib.replace_recipe_item ("slow-accumulator-3", "battery", "lithium-ion-battery") + marathon.replace_recipe_item("large-accumulator-3", "battery", "lithium-ion-battery") + marathon.replace_recipe_item("fast-accumulator-3", "battery", "lithium-ion-battery") + marathon.replace_recipe_item("slow-accumulator-3", "battery", "lithium-ion-battery") end end if data.raw.item["steel-pipe"] then - bobmods.lib.add_recipe_item ("boiler-2", {"steel-pipe", 10}) + marathon.add_recipe_item("boiler-2", {"steel-pipe", 10}) end if data.raw.item["invar-alloy"] then - bobmods.lib.replace_recipe_item ("boiler-3", "steel-plate", "invar-alloy") + marathon.replace_recipe_item("boiler-3", "steel-plate", "invar-alloy") end if data.raw.item["brass-pipe"] then - bobmods.lib.add_recipe_item ("boiler-3", {"brass-pipe", 10}) + marathon.add_recipe_item("boiler-3", {"brass-pipe", 10}) end if data.raw.item["tungsten-plate"] then - bobmods.lib.replace_recipe_item ("boiler-4", "steel-plate", "tungsten-plate") + marathon.replace_recipe_item("boiler-4", "steel-plate", "tungsten-plate") end if data.raw.item["tungsten-pipe"] then - bobmods.lib.add_recipe_item ("boiler-4", {"tungsten-pipe", 5}) + marathon.add_recipe_item("boiler-4", {"tungsten-pipe", 5}) end if data.raw.item["steel-bearing"] then - bobmods.lib.add_new_recipe_item ("steam-engine-2", {"steel-bearing", 20}) + marathon.add_new_recipe_item("steam-engine-2", {"steel-bearing", 20}) else - bobmods.lib.add_new_recipe_item ("steam-engine-2", {"iron-gear-wheel", 30}) + marathon.add_new_recipe_item("steam-engine-2", {"iron-gear-wheel", 30}) end if data.raw.item["steel-gear-wheel"] then - bobmods.lib.replace_recipe_item ("steam-engine-2", "iron-gear-wheel", "steel-gear-wheel") + marathon.replace_recipe_item("steam-engine-2", "iron-gear-wheel", "steel-gear-wheel") end if data.raw.item["titanium-bearing"] then - bobmods.lib.add_new_recipe_item ("steam-engine-3", {"titanium-bearing", 10}) + marathon.add_new_recipe_item("steam-engine-3", {"titanium-bearing", 10}) else if data.raw.item["steel-bearing"] then - bobmods.lib.add_new_recipe_item ("steam-engine-3", {"steel-bearing", 10}) + marathon.add_new_recipe_item("steam-engine-3", {"steel-bearing", 10}) else - bobmods.lib.add_new_recipe_item ("steam-engine-3", {"iron-gear-wheel", 20}) + marathon.add_new_recipe_item("steam-engine-3", {"iron-gear-wheel", 20}) end end if data.raw.item["titanium-gear-wheel"] then - bobmods.lib.replace_recipe_item ("steam-engine-3", "iron-gear-wheel", "titanium-gear-wheel") + marathon.replace_recipe_item("steam-engine-3", "iron-gear-wheel", "titanium-gear-wheel") else if data.raw.item["tungsten-gear-wheel"] then - bobmods.lib.replace_recipe_item ("steam-engine-3", "iron-gear-wheel", "tungsten-gear-wheel") + marathon.replace_recipe_item("steam-engine-3", "iron-gear-wheel", "tungsten-gear-wheel") else if data.raw.item["steel-gear-wheel"] then - bobmods.lib.replace_recipe_item ("steam-engine-3", "iron-gear-wheel", "steel-gear-wheel") + marathon.replace_recipe_item("steam-engine-3", "iron-gear-wheel", "steel-gear-wheel") end end end if data.raw.item["titanium-plate"] then - bobmods.lib.replace_recipe_item ("steam-engine-3", "steel-plate", "titanium-plate") + marathon.replace_recipe_item("steam-engine-3", "steel-plate", "titanium-plate") else if data.raw.item["tungsten-plate"] then - bobmods.lib.replace_recipe_item ("steam-engine-3", "steel-plate", "tungsten-plate") + marathon.replace_recipe_item("steam-engine-3", "steel-plate", "tungsten-plate") end end diff --git a/prototypes/bobsmods/recipe-production.lua b/prototypes/bobsmods/recipe-production.lua index 0805c58..4cc945c 100644 --- a/prototypes/bobsmods/recipe-production.lua +++ b/prototypes/bobsmods/recipe-production.lua @@ -1,4 +1,4 @@ -update_recipe("air-pump", +marathon.update_recipe("air-pump", { energy_required = 5, ingredients = { @@ -9,7 +9,7 @@ update_recipe("air-pump", } }) -update_recipe("air-pump-2", +marathon.update_recipe("air-pump-2", { ingredients = { {type="item", name="air-pump", amount=1}, @@ -20,7 +20,7 @@ update_recipe("air-pump-2", } }) -update_recipe("chemical-plant", +marathon.update_recipe("chemical-plant", { ingredients = { {type="item", name="steel-plate", amount=20}, @@ -30,7 +30,7 @@ update_recipe("chemical-plant", } }) -update_recipe("chemical-plant-2", +marathon.update_recipe("chemical-plant-2", { ingredients = { {type="item", name="chemical-plant", amount=1}, @@ -42,7 +42,7 @@ update_recipe("chemical-plant-2", } }) -update_recipe("electrolyser", +marathon.update_recipe("electrolyser", { ingredients = { {type="item", name="stone-brick", amount=10}, @@ -51,7 +51,7 @@ update_recipe("electrolyser", } }) -update_recipe("electrolyser-2", +marathon.update_recipe("electrolyser-2", { ingredients = { {type="item", name="electrolyser", amount=1}, @@ -62,7 +62,7 @@ update_recipe("electrolyser-2", } }) -update_recipe("water-pump", +marathon.update_recipe("water-pump", { energy_required = 7, ingredients = { @@ -73,7 +73,7 @@ update_recipe("water-pump", } }) -update_recipe("water-pump-2", +marathon.update_recipe("water-pump-2", { ingredients = { {type="item", name="water-pump", amount=1}, @@ -84,7 +84,7 @@ update_recipe("water-pump-2", } }) -update_recipe("void-pump", +marathon.update_recipe("void-pump", { ingredients = { {type="item", name="iron-plate", amount=10}, @@ -95,28 +95,28 @@ update_recipe("void-pump", }) if data.raw.item["basic-circuit-board"] then - bobmods.lib.replace_recipe_item ("electrolyser", "electronic-circuit", "basic-circuit-board") + marathon.replace_recipe_item("electrolyser", "electronic-circuit", "basic-circuit-board") end if data.raw.item["steel-pipe"] then - bobmods.lib.replace_recipe_item ("chemical-plant-2", "pipe", "steel-pipe") + marathon.replace_recipe_item("chemical-plant-2", "pipe", "steel-pipe") end if data.raw.item["stone-pipe"] then - bobmods.lib.replace_recipe_item ("electrolyser", "pipe", "stone-pipe") + marathon.replace_recipe_item("electrolyser", "pipe", "stone-pipe") end if data.raw.item["plastic-pipe"] then - bobmods.lib.replace_recipe_item ("electrolyser-2", "pipe", "plastic-pipe") + marathon.replace_recipe_item("electrolyser-2", "pipe", "plastic-pipe") end if data.raw.item["copper-pipe"] then - bobmods.lib.replace_recipe_item ("air-pump", "pipe", "copper-pipe") - bobmods.lib.replace_recipe_item ("water-pump", "pipe", "copper-pipe") - bobmods.lib.replace_recipe_item ("void-pump", "pipe", "copper-pipe") + marathon.replace_recipe_item("air-pump", "pipe", "copper-pipe") + marathon.replace_recipe_item("water-pump", "pipe", "copper-pipe") + marathon.replace_recipe_item("void-pump", "pipe", "copper-pipe") end if data.raw.item["bronze-pipe"] then - bobmods.lib.replace_recipe_item ("air-pump-2", "pipe", "bronze-pipe") - bobmods.lib.replace_recipe_item ("water-pump-2", "pipe", "bronze-pipe") + marathon.replace_recipe_item("air-pump-2", "pipe", "bronze-pipe") + marathon.replace_recipe_item("water-pump-2", "pipe", "bronze-pipe") end diff --git a/prototypes/bobsmods/recipe-resource.lua b/prototypes/bobsmods/recipe-resource.lua index 8fc2e41..d010979 100644 --- a/prototypes/bobsmods/recipe-resource.lua +++ b/prototypes/bobsmods/recipe-resource.lua @@ -1,4 +1,4 @@ -update_recipe("bob-resin-oil", +marathon.update_recipe("bob-resin-oil", { energy_required = 2.5, ingredients = { @@ -6,12 +6,12 @@ update_recipe("bob-resin-oil", } }) -update_recipe("bob-resin-wood", +marathon.update_recipe("bob-resin-wood", { energy_required = 5 }) -update_recipe("bob-rubber", +marathon.update_recipe("bob-rubber", { energy_required = 7, ingredients = { @@ -19,12 +19,12 @@ update_recipe("bob-rubber", } }) -update_recipe("empty-canister", +marathon.update_recipe("empty-canister", { result_count = 1 }) -update_recipe("gas-canister", +marathon.update_recipe("gas-canister", { energy_required = 2, ingredients = { @@ -32,12 +32,12 @@ update_recipe("gas-canister", } }) -update_recipe("silicon-wafer", +marathon.update_recipe("silicon-wafer", { result_count = 6 }) -update_recipe("solid-fuel-from-hydrogen", +marathon.update_recipe("solid-fuel-from-hydrogen", { energy_required = 5, ingredients = { diff --git a/prototypes/bobsmods/recipe-turret.lua b/prototypes/bobsmods/recipe-turret.lua index 1594624..655e0fc 100644 --- a/prototypes/bobsmods/recipe-turret.lua +++ b/prototypes/bobsmods/recipe-turret.lua @@ -1,4 +1,4 @@ -update_recipe("bob-gun-turret-2", +marathon.update_recipe("bob-gun-turret-2", { energy_required = 10, ingredients = { @@ -8,7 +8,7 @@ update_recipe("bob-gun-turret-2", } }) -update_recipe("bob-sniper-turret-1", +marathon.update_recipe("bob-sniper-turret-1", { energy_required = 40, ingredients = { @@ -18,7 +18,7 @@ update_recipe("bob-sniper-turret-1", } }) -update_recipe("bob-sniper-turret-2", +marathon.update_recipe("bob-sniper-turret-2", { energy_required = 30, ingredients = {