From 351c9d7aee2aad2d95b68ba69bb1836534cd2fdd Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Tue, 21 Oct 2025 21:19:07 +0200 Subject: [PATCH] Fix crash due to result_count --- MDbobelectronics2/prototypes/resource.lua | 99 +++++++++-------------- 1 file changed, 37 insertions(+), 62 deletions(-) diff --git a/MDbobelectronics2/prototypes/resource.lua b/MDbobelectronics2/prototypes/resource.lua index 3bdf22c..b7ed173 100644 --- a/MDbobelectronics2/prototypes/resource.lua +++ b/MDbobelectronics2/prototypes/resource.lua @@ -1,5 +1,4 @@ -data:extend( -{ +data:extend({ { type = "item", name = "resin", @@ -9,21 +8,18 @@ data:extend( order = "f[resin]", stack_size = 100 }, - { type = "recipe", name = "bob-resin-wood", category = "crafting-machine", subgroup = "bob-resource-chemical", energy_required = 1, - ingredients = - { - { type = "item", name = "wood", amount = 1}, + ingredients = { + { type = "item", name = "wood", amount = 1 }, }, - results = {{type="item", name="resin", amount=1}}, + results = { { type = "item", name = "resin", amount = 1 } }, allow_decomposition = false }, - { type = "recipe", name = "bob-resin-oil", @@ -31,25 +27,21 @@ data:extend( subgroup = "bob-resource-chemical", energy_required = 1, enabled = false, - ingredients = - { - {type="fluid", name="heavy-oil", amount=10}, + ingredients = { + { type = "fluid", name = "heavy-oil", amount = 10 }, }, - results = {{type="item", name="resin", amount=1}}, - crafting_machine_tint = - { - primary = {r = 0.5, g = 0.04, b = 0.0, a = 0.000}, - secondary = {r = 0.85, g = 0.6, b = 0.3, a = 0.000}, - tertiary = {r = 1, g = 0.6, b = 0.0, a = 0.000}, + results = { { type = "item", name = "resin", amount = 1 } }, + crafting_machine_tint = { + primary = { r = 0.5, g = 0.04, b = 0.0, a = 0.000 }, + secondary = { r = 0.85, g = 0.6, b = 0.3, a = 0.000 }, + tertiary = { r = 1, g = 0.6, b = 0.0, a = 0.000 }, }, allow_decomposition = false }, -} -) +}) -data:extend( -{ +data:extend({ { type = "item", name = "rubber", @@ -59,28 +51,24 @@ data:extend( order = "f[rubber]", stack_size = 100 }, - { type = "recipe", name = "bob-rubber", subgroup = "bob-resource-chemical", category = "smelting", energy_required = 3.5, - ingredients = - { + ingredients = { { type = "item", name = "resin", amount = 1 }, }, - results = {{type="item", name="rubber", amount=1}}, + results = { { type = "item", name = "rubber", amount = 1 } }, allow_decomposition = false }, -} -) +}) if not data.raw.item["silicon-wafer"] then if data.raw.item["kr-silicon"] or data.raw.item["silicon"] or data.raw.item["silicon-plate"] then - data:extend( - { + data:extend({ { type = "item", name = "silicon-wafer", @@ -90,36 +78,30 @@ if not data.raw.item["silicon-wafer"] then order = "f[silicon-wafer]", stack_size = 200 }, - { type = "recipe", name = "silicon-wafer", category = "crafting-machine", enabled = false, energy_required = 5, - ingredients = - { - }, - results = {{type="item", name="silicon-wafer", amount=1}}, - result_count = 8 - }, - } - ) + ingredients = {}, + results = { { type = "item", name = "silicon-wafer", amount = 8 } }, + } + }) if data.raw.item["kr-silicon"] then - table.insert(data.raw.recipe["silicon-wafer"].ingredients ,{type="item", name="kr-silicon", amount=1}) + table.insert(data.raw.recipe["silicon-wafer"].ingredients, { type = "item", name = "kr-silicon", amount = 1 }) elseif data.raw.item["silicon"] then - table.insert(data.raw.recipe["silicon-wafer"].ingredients ,{type="item", name="silicon", amount=1}) + table.insert(data.raw.recipe["silicon-wafer"].ingredients, { type = "item", name = "silicon", amount = 1 }) else - table.insert(data.raw.recipe["silicon-wafer"].ingredients ,{type="item", name="silicon-plate", amount=1}) + table.insert(data.raw.recipe["silicon-wafer"].ingredients, { type = "item", name = "silicon-plate", amount = 1 }) end end end if data.raw.item["tin-plate"] then - data:extend( - { + data:extend({ { type = "item", name = "solder-alloy", @@ -129,46 +111,39 @@ if data.raw.item["tin-plate"] then order = "c-b-h[solder]", stack_size = 200 }, - { type = "recipe", name = "solder-alloy", energy_required = 7, enabled = false, category = "crafting-machine", - ingredients = - { - {type="item", name="tin-plate", amount=9}, - {type="item", name="copper-plate", amount=1}, + ingredients = { + { type = "item", name = "tin-plate", amount = 9 }, + { type = "item", name = "copper-plate", amount = 1 }, }, - results = {{type="item", name="solder-alloy", amount=11}}, + results = { { type = "item", name = "solder-alloy", amount = 11 } }, allow_decomposition = false }, - } - ) + }) if data.raw.item["silver-plate"] then - table.insert(data.raw.recipe["solder-alloy"].ingredients,{type="item", name="silver-plate", amount=1}) + table.insert(data.raw.recipe["solder-alloy"].ingredients, { type = "item", name = "silver-plate", amount = 1 }) end if data.raw.item["lead-plate"] then - data:extend( - { + data:extend({ { type = "recipe", name = "solder-alloy-lead", energy_required = 7, enabled = false, category = "crafting-machine", - ingredients = - { - {type="item", name="tin-plate", amount=4}, - {type="item", name="lead-plate", amount=7}, + ingredients = { + { type = "item", name = "tin-plate", amount = 4 }, + { type = "item", name = "lead-plate", amount = 7 }, }, - results = {{type="item", name="solder-alloy", amount=11}}, + results = { { type = "item", name = "solder-alloy", amount = 11 } }, allow_decomposition = false }, - } - ) + }) end end -