diff --git a/CircuitProcessing/angelsmodules.lua b/CircuitProcessing/angelsmodules.lua new file mode 100644 index 0000000..4ae8744 --- /dev/null +++ b/CircuitProcessing/angelsmodules.lua @@ -0,0 +1,29 @@ +local lib = require "lib" + +--replace pollution modules ingredient with efficiency modules +lib.replace_recipe_ingredient("angels-bio-yield-module", "bob-pollution-create-module-1", "efficiency-module") +lib.replace_recipe_ingredient("angels-bio-yield-module-2", "bob-pollution-create-module-2", "efficiency-module-2") +lib.replace_recipe_ingredient("angels-bio-yield-module-3", "bob-pollution-create-module-3", "efficiency-module-3") + +if mods["bobmodules"] then + lib.replace_recipe_ingredient("angels-bio-yield-module-4", "bob-pollution-create-module-4", "bob-efficiency-module-4") + lib.replace_recipe_ingredient("angels-bio-yield-module-5", "bob-pollution-create-module-5", "bob-efficiency-module-5") +end + +bobmods.lib.tech.remove_prerequisite("angels-bio-yield-module", "bob-pollution-create-module-1") +bobmods.lib.tech.remove_prerequisite("angels-bio-yield-module-2", "bob-pollution-create-module-2") +bobmods.lib.tech.remove_prerequisite("angels-bio-yield-module-3", "bob-pollution-create-module-3") + +if mods["bobmodules"] then + bobmods.lib.tech.remove_prerequisite("angels-bio-yield-module-4", "bob-pollution-create-module-4") + bobmods.lib.tech.remove_prerequisite("angels-bio-yield-module-5", "bob-pollution-create-module-5") +end + +bobmods.lib.tech.add_prerequisite("angels-bio-yield-module", "efficiency-module") +bobmods.lib.tech.add_prerequisite("angels-bio-yield-module-2", "efficiency-module-2") +bobmods.lib.tech.add_prerequisite("angels-bio-yield-module-3", "efficiency-module-3") + +if mods["bobmodules"] then + bobmods.lib.tech.add_prerequisite("angels-bio-yield-module-4", "bob-efficiency-module-4") + bobmods.lib.tech.add_prerequisite("angels-bio-yield-module-5", "bob-efficiency-module-5") +end \ No newline at end of file diff --git a/CircuitProcessing/bobelectronics.lua b/CircuitProcessing/bobelectronics.lua index 54349f2..44fa3d2 100644 --- a/CircuitProcessing/bobelectronics.lua +++ b/CircuitProcessing/bobelectronics.lua @@ -14,7 +14,7 @@ else { type = 'item-subgroup', name = 'sb-circuit-board', - group = 'bob-intermediate-products', + group = 'intermediate-products', order = 'e-a4' } }) @@ -36,38 +36,34 @@ data.raw.item['electronic-circuit'] = local cpelectroniccircuitboardrecipe = data.raw.recipe['electronic-circuit'] data.raw.recipe['cp-electronic-circuit-board'] = cpelectroniccircuitboardrecipe cpelectroniccircuitboardrecipe.name = 'cp-electronic-circuit-board' -bobmods.lib.recipe.remove_result('cp-electronic-circuit-board', 'electronic-circuit') -bobmods.lib.recipe.add_result('cp-electronic-circuit-board', 'cp-electronic-circuit-board') +data.raw.recipe["cp-electronic-circuit-board"].allow_productivity = true + +data.raw.recipe["cp-electronic-circuit-board"].results = { + { type = "item", name = "cp-electronic-circuit-board", amount = 1 } +} lib.set_main_product('cp-electronic-circuit-board', 'cp-electronic-circuit-board') + +local electronics_crafting_category = "crafting" +local electronics_fluid_crafting_category = "advanced-crafting" + +if mods["bobassembly"] then + electronics_crafting_category = "electronics" + electronics_fluid_crafting_category = "electronics-with-fluid" +end + data.raw.recipe['electronic-circuit'] = { type = "recipe", name = "electronic-circuit", - category = "electronics", - normal = - { - ingredients = - { - {"cp-electronic-circuit-board", 1}, - {"iron-plate", 2} - }, - result = "electronic-circuit", - requester_paste_multiplier = 50, - enabled = false, - allow_decomposition = false - }, - expensive = - { - ingredients = - { - {"cp-electronic-circuit-board", 1}, - {"iron-plate", 4} - }, - result = "electronic-circuit", - requester_paste_multiplier = 50, - enabled = false, - allow_decomposition = false + category = electronics_crafting_category, + ingredients = { + { type = "item", name = "cp-electronic-circuit-board", amount = 1 }, + { type = "item", name = "iron-plate", amount = 2 } }, + results = { {type = "item", name = "electronic-circuit", amount = 1} }, + requester_paste_multiplier = 50, + enabled = false, + allow_decomposition = false } local cpadvancedcircuitboard = data.raw.item['advanced-circuit'] @@ -87,46 +83,31 @@ data.raw.item['advanced-circuit'] = local cpadvancedcircuitboardrecipe = data.raw.recipe['advanced-circuit'] data.raw.recipe['cp-advanced-circuit-board'] = cpadvancedcircuitboardrecipe cpadvancedcircuitboardrecipe.name = 'cp-advanced-circuit-board' -bobmods.lib.recipe.remove_result('cp-advanced-circuit-board', 'advanced-circuit') -bobmods.lib.recipe.add_result('cp-advanced-circuit-board', 'cp-advanced-circuit-board') +data.raw.recipe["cp-advanced-circuit-board"].allow_productivity = true + +data.raw.recipe["cp-advanced-circuit-board"].results = { + { type = "item", name = "cp-advanced-circuit-board", amount = 1 } +} lib.set_main_product('cp-advanced-circuit-board', 'cp-advanced-circuit-board') data.raw.recipe['advanced-circuit'] = { type = "recipe", name = "advanced-circuit", - category = "electronics", - normal = + category = electronics_crafting_category, + enabled = false, + energy_required = 6, + ingredients = lib.checkplate( + { type = "item", name = "bob-aluminium-plate", amount = 4 }, { - enabled = false, - energy_required = 6, - ingredients = lib.checkplate( - {"aluminium-plate", 4}, - { - {"electronic-circuit", 2}, - {"cp-advanced-circuit-board", 2}, - {"copper-cable", 4} - }), - result = "advanced-circuit", - requester_paste_multiplier = 5, - allow_decomposition = false - }, - expensive = - { - enabled = false, - energy_required = 6, - ingredients = lib.checkplate( - {"aluminium-plate", 4}, - { - {"electronic-circuit", 2}, - {"cp-advanced-circuit-board", 4}, - {"copper-cable", 8} - }), - result = "advanced-circuit", - requester_paste_multiplier = 5, - allow_decomposition = false - } - } + { type = "item", name = "electronic-circuit", amount = 2 }, + { type = "item", name = "cp-advanced-circuit-board", amount = 2 }, + { type = "item", name = "copper-cable", amount = 4 } + }), + results = { {type = "item", name = "advanced-circuit", amount = 1} }, + requester_paste_multiplier = 5, + allow_decomposition = false +} local cpprocessingboard = data.raw.item['processing-unit'] data.raw.item['cp-processing-board'] = cpprocessingboard @@ -145,53 +126,39 @@ data.raw.item['processing-unit'] = local cpprocessingboardrecipe = data.raw.recipe['processing-unit'] data.raw.recipe['cp-processing-board'] = cpprocessingboardrecipe cpprocessingboardrecipe.name = 'cp-processing-board' -bobmods.lib.recipe.remove_result('cp-processing-board', 'processing-unit') -bobmods.lib.recipe.add_result('cp-processing-board', 'cp-processing-board') +data.raw.recipe["cp-processing-board"].allow_productivity = true + +data.raw.recipe["cp-processing-board"].results = { + { type = "item", name = "cp-processing-board", amount = 1 } +} lib.set_main_product('cp-processing-board', 'cp-processing-board') data.raw.recipe['processing-unit'] = { type = "recipe", name = "processing-unit", - category = "electronics-machine", - normal = + category = electronics_fluid_crafting_category, + enabled = false, + energy_required = 10, + ingredients = lib.checkplate( + { type = "item", name = "bob-titanium-plate", amount = 8 }, { - enabled = false, - energy_required = 10, - ingredients = lib.checkplate( - {"titanium-plate", 8}, - { - {"advanced-circuit", 4}, - {"cp-processing-board", 4}, - {type = "fluid", name = "sulfuric-acid", amount = 5} - }), - result = "processing-unit", - allow_decomposition = false - }, - expensive = - { - enabled = false, - energy_required = 10, - ingredients = lib.checkplate( - {"titanium-plate", 8}, - { - {"advanced-circuit", 4}, - {"cp-processing-board", 4}, - {type = "fluid", name = "sulfuric-acid", amount = 10} - }), - result = "processing-unit", - allow_decomposition = false - } + { type = "item", name = "advanced-circuit", amount = 4 }, + { type = "item", name = "cp-processing-board", amount = 4 }, + { type = "fluid", name = "sulfuric-acid", amount = 5 } + }), + results = { {type = "item", name = "processing-unit", amount = 1} }, + allow_decomposition = false } -bobmods.lib.recipe.set_energy_required('cp-processing-board', 5) -bobmods.lib.recipe.set_energy_required('superior-circuit-board', 5) +lib.set_energy_required('cp-processing-board', 5) +lib.set_energy_required('bob-superior-circuit-board', 5) -local cpadvancedprocessingboard = data.raw.item['advanced-processing-unit'] +local cpadvancedprocessingboard = data.raw.item['bob-advanced-processing-unit'] data.raw.item['cp-advanced-processing-board'] = cpadvancedprocessingboard cpadvancedprocessingboard.name = 'cp-advanced-processing-board' -data.raw.item['advanced-processing-unit'] = +data.raw.item['bob-advanced-processing-unit'] = { type = "item", - name = "advanced-processing-unit", + name = "bob-advanced-processing-unit", icon = "__CircuitProcessing__/graphics/icons/advanced-processing-unit.png", icon_size = 64, icon_mipmaps = 4, subgroup = "sb-circuit-board", @@ -202,106 +169,84 @@ data.raw.item['advanced-processing-unit'] = local advancedplate = "steel-plate" if data.raw.item["angels-plate-chrome"] then advancedplate = "angels-plate-chrome" -elseif data.raw.item["gold-plate"] then - advancedplate = "gold-plate" +elseif data.raw.item["bob-gold-plate"] then + advancedplate = "bob-gold-plate" end local advancedacid = "sulfuric-acid" -if data.raw.fluid["nitric-acid"] then - advancedacid = "nitric-acid" +if data.raw.fluid["bob-nitric-acid"] then + advancedacid = "bob-nitric-acid" end -local cpadvancedprocessingboardrecipe = data.raw.recipe['advanced-processing-unit'] +local cpadvancedprocessingboardrecipe = data.raw.recipe['bob-advanced-processing-unit'] data.raw.recipe['cp-advanced-processing-board'] = cpadvancedprocessingboardrecipe cpadvancedprocessingboardrecipe.name = 'cp-advanced-processing-board' -bobmods.lib.recipe.remove_result('cp-advanced-processing-board', 'advanced-processing-unit') -bobmods.lib.recipe.add_result('cp-advanced-processing-board', 'cp-advanced-processing-board') +data.raw.recipe["cp-advanced-processing-board"].allow_productivity = true + +data.raw.recipe["cp-advanced-processing-board"].results = { + { type = "item", name = "cp-advanced-processing-board", amount = 1 } +} lib.set_main_product('cp-advanced-processing-board', 'cp-advanced-processing-board') -bobmods.lib.recipe.set_energy_required('cp-advanced-processing-board', 5) -bobmods.lib.recipe.set_energy_required('multi-layer-circuit-board', 5) -data.raw.recipe['advanced-processing-unit'] = +lib.set_energy_required('cp-advanced-processing-board', 5) +lib.set_energy_required('bob-multi-layer-circuit-board', 5) + +data.raw.recipe['bob-advanced-processing-unit'] = { type = "recipe", - name = "advanced-processing-unit", - category = "electronics-machine", - normal = - { - enabled = false, - energy_required = 15, - ingredients = lib.checkplate( - {advancedplate, 10}, - { - {"processing-unit", 3}, - {"electronic-circuit", 20}, - {"cp-advanced-processing-board", 9}, - {type = "fluid", name = advancedacid, amount = 5} - }), - result = "advanced-processing-unit", - allow_decomposition = false - }, - expensive = + name = "bob-advanced-processing-unit", + category = electronics_fluid_crafting_category, + enabled = false, + energy_required = 15, + ingredients = lib.checkplate( + { type = "item", name = advancedplate, amount = 10 }, { - enabled = false, - energy_required = 15, - ingredients = lib.checkplate( - {advancedplate, 10}, - { - {"processing-unit", 3}, - {"electronic-circuit", 20}, - {"cp-advanced-processing-board", 9}, - {type = "fluid", name = advancedacid, amount = 10} - }), - result = "advanced-processing-unit", - allow_decomposition = false - } + { type = "item", name = "processing-unit", amount = 3 }, + { type = "item", name = "electronic-circuit", amount = 2 }, + { type = "item", name = "cp-advanced-processing-board", amount = 9}, + { type = "fluid", name = advancedacid, amount = 5 } + }), + results = { {type = "item", name = "bob-advanced-processing-unit", amount = 1} }, + allow_decomposition = false } local cable = { ['copper-cable']=true, - ['tinned-copper-cable']=true, + ['bob-tinned-copper-cable']=true, ['angels-wire-silver']=true, - ['gilded-copper-cable']=true + ['bob-gilded-copper-cable']=true } local components = { - 'basic-electronic-components', - 'electronic-components', - 'intergrated-electronics' + 'bob-basic-electronic-components', + 'bob-electronic-components', + 'bob-intergrated-electronics' } local function doublecable(ingredients) - for k,v in pairs(ingredients) do - local idx = 1 - local amt = 2 - if v.name then - idx = 'name' - amt = 'amount' - end - if cable[v[idx]] then - v[amt] = v[amt] * 2 + for _, ingr in pairs(ingredients) do + if cable[ingr.name] then + ingr.amount = ingr.amount * 2 end end end for _,v in pairs(components) do if data.raw.recipe[v] then - bobmods.lib.recipe.difficulty_split(v) - doublecable(data.raw.recipe[v].normal.ingredients) - doublecable(data.raw.recipe[v].expensive.ingredients) + doublecable(data.raw.recipe[v].ingredients) end end -data.raw.recipe['basic-electronic-components'].normal.result_count = 10 -data.raw.recipe['basic-electronic-components'].expensive.result_count = 6 -bobmods.lib.recipe.set_difficulty_energy_required('basic-electronic-components', 'normal', 4) -bobmods.lib.recipe.set_difficulty_energy_required('basic-electronic-components', 'expensive', 6) +data.raw.recipe["bob-basic-electronic-components"].results[1].amount = 10 +lib.set_energy_required('bob-basic-electronic-components', 4) -local circuits = { - 'cp-advanced-processing-board', - 'cp-processing-board', - 'cp-advanced-circuit-board', - 'cp-electronic-circuit-board' -} -bobmods.lib.module.add_productivity_limitations(circuits) +-- local circuits = { +-- 'cp-advanced-processing-board', +-- 'cp-processing-board', +-- 'cp-advanced-circuit-board', +-- 'cp-electronic-circuit-board' +-- } + +-- TODO figure out what productivity_limitations did: https://github.com/modded-factorio/bobsmods/blob/492bd544746b867b377795f5c6a8d2b8b0bc6a52/boblibrary/module-functions.lua#L16 +-- bobmods.lib.module.add_productivity_limitations(circuits) for k,v in pairs(data.raw.technology) do for ek,ev in pairs(v.effects or {}) do @@ -320,7 +265,7 @@ for k,v in pairs(data.raw.technology) do bobmods.lib.tech.add_prerequisite(k, 'angels-titanium-smelting-1') end break - elseif ev.type == 'unlock-recipe' and ev.recipe == 'advanced-processing-unit' then + elseif ev.type == 'unlock-recipe' and ev.recipe == 'bob-advanced-processing-unit' then table.insert(v.effects, ek, {type = 'unlock-recipe', recipe = 'cp-advanced-processing-board'}) if data.raw.technology['angels-chrome-smelting-1'] then bobmods.lib.tech.add_prerequisite(k, 'angels-chrome-smelting-1') diff --git a/CircuitProcessing/bobmodules.lua b/CircuitProcessing/bobmodules.lua index 0f08c08..f707808 100644 --- a/CircuitProcessing/bobmodules.lua +++ b/CircuitProcessing/bobmodules.lua @@ -1,419 +1,106 @@ +--rewrote all of bobmodules because it was a clusterfuck + local lib = require "lib" ---if not mods['bobmodules'] or not settings.startup['cp-override-modules'].value then -if not mods['bobmodules'] then - return -end -local function takeeffect(effects, name) - for i,v in ipairs(effects or {}) do - if v.recipe == name then - return table.remove(effects, i) - end - end +if not mods['bobmodules'] then + return end +-- TODO why is this even here? I cant find a mention of module-merging or -module-n-combine anywhere in bobs if data.raw.technology['module-merging'] then - data.raw.technology['module-merging'].enabled = false -end - -for _,m in pairs({ - {tech = 'modules', module_name = 'pollution-clean-processor'}, - {tech = 'modules', module_name = 'pollution-create-processor'}, - {tech = 'modules-2', module_name = 'pollution-clean-processor-2'}, - {tech = 'modules-2', module_name = 'pollution-create-processor-2'}, - {tech = 'modules-3', module_name = 'pollution-clean-processor-3'}, - {tech = 'modules-3', module_name = 'pollution-create-processor-3'} -}) do - if data.raw.technology[m.tech] then - bobmods.lib.tech.remove_recipe_unlock(m.tech, m.module_name) - end - lib.hide_recipe(m.module_name) - lib.hide_item(m.module_name) -end - -for i = 1,8 do - for _,s in pairs({'raw-speed-module-', 'raw-productivity-module-', 'pollution-create-module-', 'pollution-clean-module-', 'green-module-', 'god-module-'}) do - local str = s .. i - if data.raw.technology[str] then - data.raw.technology[str] = nil - end - data.raw.module[str] = nil - data.raw.recipe[str] = nil - end - for _,s in pairs({'raw-speed-module-', 'green-module-', 'raw-productivity-module-'}) do - local str = s .. i .. '-combine' - data.raw.recipe[str] = nil - end -end -for _,s in pairs({"speed", "effectivity", "productivity"}) do - local processor2 = takeeffect(data.raw.technology[s.."-module-3"].effects, s.."-processor-2") - if processor2 then - table.insert(data.raw.technology[s.."-module-2"].effects, processor2) - bobmods.lib.tech.add_prerequisite(s.."-module-2", "advanced-electronics-2") - end - local processor3 = takeeffect(data.raw.technology[s.."-module-6"].effects, s.."-processor-3") - if processor3 then - table.insert(data.raw.technology[s.."-module-3"].effects, processor3) - bobmods.lib.tech.remove_prerequisite(s.."-module-3", "advanced-electronics-2") - bobmods.lib.tech.add_prerequisite(s.."-module-3", "advanced-electronics-3") - end - table.insert(data.raw.technology[s.."-module"].effects, - takeeffect(data.raw.technology[s.."-module-2"].effects, s.."-module-2")) - table.insert(data.raw.technology[s.."-module-2"].effects, - takeeffect(data.raw.technology[s.."-module-3"].effects, s.."-module-3")) - table.insert(data.raw.technology[s.."-module-2"].effects, - takeeffect(data.raw.technology[s.."-module-4"].effects, s.."-module-4")) - table.insert(data.raw.technology[s.."-module-3"].effects, - takeeffect(data.raw.technology[s.."-module-5"].effects, s.."-module-5")) - table.insert(data.raw.technology[s.."-module-3"].effects, - takeeffect(data.raw.technology[s.."-module-6"].effects, s.."-module-6")) - table.insert(data.raw.technology[s.."-module-4"].effects, - takeeffect(data.raw.technology[s.."-module-7"].effects, s.."-module-7")) - table.insert(data.raw.technology[s.."-module-4"].effects, - takeeffect(data.raw.technology[s.."-module-8"].effects, s.."-module-8")) - local cost = 50 - bobmods.lib.tech.add_science_pack(s.."-module-2", "chemical-science-pack", 1) - for _,i in pairs({"", "-2", "-3", "-4"}) do - local itemtoname = { - [""] = "-0", - ["-2"] = "-1", - ["-3"] = "-2", - ["-4"] = "-3" - } - data.raw.technology[s.."-module"..i].icon = nil - data.raw.technology[s.."-module"..i].icons = nil - data.raw.technology[s.."-module"..i].unit.count = cost - local directory = "__base__" - if i == "" then - directory = "__CircuitProcessing__" - end - data.raw.technology[s.."-module"..i].icon_size = 256 - data.raw.technology[s.."-module"..i].icon = directory.."/graphics/technology/"..s.."-module"..itemtoname[i]..".png" - data.raw.technology[s.."-module"..i].localised_name = {"item-name."..s.."-module"..itemtoname[i]} - data.raw.technology[s.."-module"..i].upgrade = false - - if i == "-3" or i == "-4" then - bobmods.lib.tech.add_science_pack(s.."-module"..i, "production-science-pack", 1) - end - cost = cost * 2 - end -end -for i = 5,8 do - for _,s in pairs({'speed-module-', 'effectivity-module-', 'productivity-module-'}) do - local str = s .. i - if data.raw.technology[str] then - data.raw.technology[str] = nil - end - end + data.raw.technology['module-merging'].enabled = false end -local replacetech = {} -local replaceingredient = {} -for _,s in pairs({'speed-module', 'effectivity-module', 'productivity-module'}) do - replacetech[s.."-2"] = s - replacetech[s.."-3"] = s.."-2" - replacetech[s.."-4"] = s.."-2" - replacetech[s.."-5"] = s.."-3" - replacetech[s.."-6"] = s.."-3" - replacetech[s.."-7"] = s.."-4" - replacetech[s.."-8"] = s.."-4" - replaceingredient[s] = s.."-2" - replaceingredient[s.."-3"] = s.."-4" - replaceingredient[s.."-5"] = s.."-6" - replaceingredient[s.."-7"] = s.."-8" -end +--remove pollution clean and pollution create processor... +for _,m in pairs({ "", "-2", "-3" }) do + lib.hide_recipe("bob-pollution-clean-processor"..m) + lib.hide_item("bob-pollution-clean-processor"..m) -for tname,tech in pairs(data.raw.technology) do - tname = string.sub(tname, 1, -2) - if tname ~= 'speed-module-' and tname ~= 'effectivity-module-' and tname ~= 'productivity-module-' then - for ek,ev in pairs(tech.prerequisites or {}) do - if replacetech[ev] then - --print("in tech " .. tname .. " replacetech " .. ev .. " with " .. replacetechtech[ev]) - tech.prerequisites[ek] = replacetech[ev] - end - end - end + lib.hide_recipe("bob-pollution-create-processor"..m) + lib.hide_item("bob-pollution-create-processor"..m) end -if data.raw.technology['modules-2'] and data.raw.technology['modules-3'] then - for _,n in pairs({'speed-module', 'productivity-module', 'effectivity-module'}) do - local tech2 = data.raw.technology[n .. '-2'] - table.insert(tech2.prerequisites, 'modules-2') - local tech3 = data.raw.technology[n .. '-3'] - for k,v in pairs(tech3.prerequisites or {}) do - if v == 'modules-2' then - tech3.prerequisites[k] = 'modules-3' - end +-- ...and technologies +for i = 1,5 do + for _,s in pairs({'bob-pollution-create-module-', 'bob-pollution-clean-module-'}) do + local str = s .. i + if data.raw.technology[str] then + data.raw.technology[str].hidden = true + end + data.raw.module[str].hidden = true + lib.hide_recipe(str) end - end end -local function replaceingredients(recipe) - if recipe.normal then - replaceingredients(recipe.normal) - end - if recipe.expensive then - replaceingredients(recipe.expensive) - end - local ingredients = recipe.ingredients or {} - for _,ingredient in pairs(ingredients) do - local nameidx = 1 - if ingredient.name then nameidx = 'name' end - local r = replaceingredient[ingredient[nameidx]] - if r then - ingredient[nameidx] = r - end - end -end - -for _,recipe in pairs(data.raw.recipe) do - replaceingredients(recipe) -end - -local effects = { - ['speed-module-2'] = { speed = {bonus = 0.2}, consumption = {bonus = 0.5}}, - ['speed-module-4'] = { speed = {bonus = 0.3}, consumption = {bonus = 0.6}}, - ['speed-module-6'] = { speed = {bonus = 0.5}, consumption = {bonus = 0.7}}, - ['speed-module-8'] = { speed = {bonus = 0.7}, consumption = {bonus = 0.8}}, - ['effectivity-module-2'] = { consumption = {bonus = -0.3}}, - ['effectivity-module-4'] = { consumption = {bonus = -0.4}}, - ['effectivity-module-6'] = { consumption = {bonus = -0.5}}, - ['effectivity-module-8'] = { consumption = {bonus = -0.6}}, - ['productivity-module-2'] = { - productivity = {bonus = 0.04}, - consumption = {bonus = 0.4}, - pollution = {bonus = 0.05}, - speed = {bonus = -0.10} - }, - ['productivity-module-4'] = { - productivity = {bonus = 0.06}, - consumption = {bonus = 0.6}, - pollution = {bonus = 0.075}, - speed = {bonus = -0.12} - }, - ['productivity-module-6'] = { - productivity = {bonus = 0.08}, - consumption = {bonus = 0.8}, - pollution = {bonus = 0.1}, - speed = {bonus = -0.14} - }, - ['productivity-module-8'] = { - productivity = {bonus = 0.12}, - consumption = {bonus = 1.2}, - pollution = {bonus = 0.15}, - speed = {bonus = -0.15} - } -} - -local gems = { - ['speed-module-6'] = 'sapphire-5', - ['speed-module-8'] = 'amethyst-5', - ['effectivity-module-6'] = 'emerald-5', - ['effectivity-module-8'] = 'topaz-5', - ['productivity-module-6'] = 'ruby-5', - ['productivity-module-8'] = 'diamond-5' -} - -local tint = { - ['speed'] = { - primary = {r = 0.441, g = 0.714, b = 1.000, a = 1.000}, -- #70b6ffff - secondary = {r = 0.388, g = 0.976, b = 1.000, a = 1.000}, -- #63f8ffff - }, - ['effectivity'] = { - primary = { 0, 1, 0 }, - secondary = {r = 0.370, g = 1.000, b = 0.370, a = 1.000}, -- #5eff5eff - }, - ['productivity'] = nil -} - -for _,v in pairs({'speed', 'effectivity', 'productivity'}) do - local beacontint = tint[v] - local processor = v..'-processor' - local processor2 = v..'-processor-2' - local processor3 = v..'-processor-3' - local module = v..'-module' - local module2 = v..'-module-2' - local module3 = v..'-module-3' - local module4 = v..'-module-4' - local module5 = v..'-module-5' - local module6 = v..'-module-6' - local module7 = v..'-module-7' - local module8 = v..'-module-8' - - data.raw.recipe[module].ingredients = lib.checkplate( - {'solder', 1}, - { - {'electronic-circuit', 1}, - {'insulated-cable', 2}, - {'module-contact', 1} - }) - data.raw.recipe[module].energy_required = 7.5 - data.raw.item[module] = data.raw.module[module] - data.raw.module[module] = nil - data.raw.item[module].type = 'item' - data.raw.item[module].icon = "__CircuitProcessing__/graphics/icons/"..v.."-module-0-harness.png" - data.raw.item[module].icon_size = 64 - data.raw.item[module].icon_mipmaps = 4 - data.raw.item[module].localised_name = {"item-name."..v.."-module-0-harness"} - data.raw.item[module].localised_description = "" - - data.raw.recipe[module2].ingredients = { - {module, 4}, - {processor, 5}, - {'advanced-circuit', 5}, - {'module-case', 1}, - {'module-circuit-board', 1} - } - data.raw.recipe[module2].energy_required = 15 - data.raw.module[module2].icon = "__CircuitProcessing__/graphics/icons/"..v.."-module-0.png" - data.raw.module[module2].icon_size = 64 - data.raw.module[module2].icon_mipmaps = 4 - data.raw.module[module2].localised_name = {"item-name."..v.."-module-0"} - data.raw.module[module2].effect = effects[module2] - data.raw.module[module2].beacon_tint = beacontint - data.raw.module[module2].tier = 1 - - data.raw.recipe[module3].ingredients = lib.checkplate( - {'solder', 2}, - { - {module2, 1}, - {'electronic-components', 4}, - {'module-contact', 1} - }) - data.raw.recipe[module3].energy_required = 15 - data.raw.item[module3] = data.raw.module[module3] - data.raw.module[module3] = nil - data.raw.item[module3].type = 'item' - data.raw.item[module3].icon = "__CircuitProcessing__/graphics/icons/"..v.."-module-harness.png" - data.raw.item[module3].icon_size = 64 - data.raw.item[module3].icon_mipmaps = 4 - data.raw.item[module3].localised_name = {"item-name."..v.."-module-1-harness"} - data.raw.item[module3].localised_description = "" - data.raw.recipe[module4].ingredients = { - {module3, 4}, - {processor2, 5}, - {'advanced-circuit', 5}, - {'processing-unit', 5} - } - data.raw.recipe[module4].energy_required = 30 - data.raw.module[module4].icon = "__base__/graphics/icons/"..v.."-module.png" - data.raw.module[module4].icon_size = 64 - data.raw.module[module4].icon_mipmaps = 4 - data.raw.module[module4].localised_name = {"item-name."..v.."-module-1"} - data.raw.module[module4].localised_description = {"item-description."..module} - data.raw.module[module4].effect = effects[module4] - data.raw.module[module4].beacon_tint = beacontint - data.raw.module[module4].tier = 2 - - data.raw.recipe[module5].ingredients = lib.checkplate( - {'solder', 1}, - { - {module4, 1}, - {'electronic-components', 5}, - {'intergrated-electronics', 4}, - {'module-contact', 1} - }) - data.raw.recipe[module5].energy_required = 30 - data.raw.item[module5] = data.raw.module[module5] - data.raw.module[module5] = nil - data.raw.item[module5].type = 'item' - data.raw.item[module5].icon = "__CircuitProcessing__/graphics/icons/"..v.."-module-2-harness.png" - data.raw.item[module5].icon_size = 64 - data.raw.item[module5].icon_mipmaps = 4 - data.raw.item[module5].localised_name = {"item-name."..v.."-module-2-harness"} - data.raw.recipe[module6].ingredients = { - {module5, 4}, - {processor3, 20}, - {'processing-unit', 5}, - {'advanced-processing-unit', 2} - } - local gem = gems[module6] - if data.raw.item[gem] then - table.insert(data.raw.recipe[module6].ingredients, 3, {gem, 1}) - end - data.raw.recipe[module6].energy_required = 60 - data.raw.module[module6].icon = "__base__/graphics/icons/"..v.."-module-2.png" - data.raw.module[module6].icon_size = 64 - data.raw.module[module6].icon_mipmaps = 4 - data.raw.module[module6].localised_name = {"item-name."..v.."-module-2"} - data.raw.module[module6].localised_description = {"item-description."..module} - data.raw.module[module6].effect = effects[module6] - data.raw.module[module6].beacon_tint = beacontint - data.raw.module[module6].tier = 3 - - data.raw.recipe[module7].ingredients = lib.checkplate( - {'solder', 5}, - { - {module6, 1}, - {'electronic-components', 10}, - {'intergrated-electronics', 5}, - {'processing-electronics', 20}, - {'module-contact', 1} - }) - data.raw.recipe[module7].energy_required = 30 - data.raw.item[module7] = data.raw.module[module7] - data.raw.module[module7] = nil - data.raw.item[module7].type = 'item' - data.raw.item[module7].icon = "__CircuitProcessing__/graphics/icons/"..v.."-module-3-harness.png" - data.raw.item[module7].icon_size = 64 - data.raw.item[module7].icon_mipmaps = 4 - data.raw.item[module7].localised_name = {"item-name."..v.."-module-3-harness"} - data.raw.recipe[module8].ingredients = { - {module7, 2}, - {'electronic-circuit', 20}, - {'advanced-circuit', 10}, - {'processing-unit', 5}, - {'advanced-processing-unit', 5} - } - gem = gems[module8] - if data.raw.item[gem] then - table.insert(data.raw.recipe[module8].ingredients, 2, {gem, 1}) - end - data.raw.recipe[module8].energy_required = 60 - data.raw.module[module8].icon = "__base__/graphics/icons/"..v.."-module-3.png" - data.raw.module[module8].icon_size = 64 - data.raw.module[module8].icon_mipmaps = 4 - data.raw.module[module8].localised_name = {"item-name."..v.."-module-3"} - data.raw.module[module8].localised_description = {"item-description."..module} - data.raw.module[module8].effect = effects[module8] - data.raw.module[module8].beacon_tint = beacontint - data.raw.module[module8].tier = 4 -end - -local function makebeacontable() - local ret = {} - for k,v in pairs({{'module-lights', 4}, {'module-mask-box', 4}, {'module-mask-lights', 4}, {'module-slot', 5}}) do - ret['__base__/graphics/entity/beacon/beacon-'..v[1]..'-1.png'] = - {file = '__CircuitProcessing__/graphics/beacon/beacon-'..v[1]..'-1.png', count = v[2]} - ret['__base__/graphics/entity/beacon/hr-beacon-'..v[1]..'-1.png'] = - {file = '__CircuitProcessing__/graphics/beacon/hr-beacon-'..v[1]..'-1.png', count = v[2]} - ret['__base__/graphics/entity/beacon/beacon-'..v[1]..'-2.png'] = - {file = '__CircuitProcessing__/graphics/beacon/beacon-'..v[1]..'-2.png', count = v[2]} - ret['__base__/graphics/entity/beacon/hr-beacon-'..v[1]..'-2.png'] = - {file = '__CircuitProcessing__/graphics/beacon/hr-beacon-'..v[1]..'-2.png', count = v[2]} - end - return ret -end -local beacontable = makebeacontable() - -local function updatepictures(pictures) - local r = beacontable[pictures.filename] - if r then - pictures.filename = r.file - pictures.variation_count = r.count - pictures.line_length = r.count - end - if pictures.hr_version then - updatepictures(pictures.hr_version) - end -end - -for _,b in pairs(data.raw.beacon) do - if b.graphics_set and b.graphics_set.module_visualisations then - for ki,vi in pairs(b.graphics_set.module_visualisations[1].slots) do - for kj, vj in pairs(vi) do - updatepictures(vj.pictures) - end - end - end -end +-- balance cost of modules +for _, module_name in pairs({ "speed", "productivity", "efficiency" }) do + -- modules-1 + lib.replace_recipe_ingredient(module_name.."-module", "electronic-circuit", "electronic-circuit", 5) + lib.add_recipe_ingredient(module_name.."-module", "advanced-circuit", 5) + bobmods.lib.tech.add_prerequisite(module_name.."-module", "advanced-circuit") + + --module-2 + lib.replace_recipe_ingredient(module_name.."-module-2", "advanced-circuit", "advanced-circuit", 5) + lib.replace_recipe_ingredient(module_name.."-module-2", module_name.."-module", module_name.."-module", 4) + lib.add_recipe_ingredient(module_name.."-module-2", "processing-unit", 5) + bobmods.lib.tech.add_prerequisite(module_name.."-module-2", "processing-unit") + + --module-3 + lib.replace_recipe_ingredient(module_name.."-module-3", "processing-unit", "processing-unit", 5) + lib.replace_recipe_ingredient(module_name.."-module-3", module_name.."-module-2", module_name.."-module-2", 4) + lib.add_recipe_ingredient(module_name.."-module-3", "bob-advanced-processing-unit", 3) + bobmods.lib.tech.add_prerequisite(module_name.."-module-3", "bob-advanced-processing-unit") + + --module-4 + lib.replace_recipe_ingredient("bob-"..module_name.."-module-4", module_name.."-module-3", module_name.."-module-3", 3) + lib.add_recipe_ingredient("bob-"..module_name.."-module-4", "advanced-circuit", 6) + lib.add_recipe_ingredient("bob-"..module_name.."-module-4", "processing-unit", 5) + lib.replace_recipe_ingredient("bob-"..module_name.."-module-4", "bob-advanced-processing-unit", "bob-advanced-processing-unit", 4) + + --module-5 + lib.replace_recipe_ingredient("bob-"..module_name.."-module-5", "electronic-circuit", "electronic-circuit", 15) + lib.replace_recipe_ingredient("bob-"..module_name.."-module-5", "advanced-circuit", "advanced-circuit", 10) + lib.replace_recipe_ingredient("bob-"..module_name.."-module-5", "processing-unit", "processing-unit", 5) + lib.replace_recipe_ingredient("bob-"..module_name.."-module-5", "bob-advanced-processing-unit", "bob-advanced-processing-unit", 5) + lib.replace_recipe_ingredient("bob-"..module_name.."-module-5", module_name.."-module-4", module_name.."-module-4", 2) +end + +--balance effects of modules-1 because they are much cheaper as module-0 in 1.1 +lib.add_module_effect("productivity-module", "productivity", 0.03) --was 0.04 +lib.add_module_effect("productivity-module", "speed", -0.1) --was -0.05 + +lib.add_module_effect("speed-module", "speed", 0.15) --was 0.2 +lib.add_module_effect("speed-module", "consumption", 0.55) --was 0.5 + +lib.add_module_effect("efficiency-module", "consumption", -0.3) --was -0.4 + +--balance cost of agricultural modules +lib.replace_recipe_ingredient("angels-bio-yield-module", "efficiency-module", "efficiency-module", 2) +lib.replace_recipe_ingredient("angels-bio-yield-module", "productivity-module", "productivity-module", 2) +lib.replace_recipe_ingredient("angels-bio-yield-module", "angels-token-bio", "angels-token-bio", 5) + +lib.replace_recipe_ingredient("angels-bio-yield-module-2", "angels-bio-yield-module", "angels-bio-yield-module", 4) +lib.replace_recipe_ingredient("angels-bio-yield-module-2", "angels-token-bio", "angels-token-bio", 5) + +lib.replace_recipe_ingredient("angels-bio-yield-module-3", "angels-bio-yield-module-2", "angels-bio-yield-module-2", 4) +lib.replace_recipe_ingredient("angels-bio-yield-module-3", "angels-token-bio", "angels-token-bio", 5) + +lib.replace_recipe_ingredient("angels-bio-yield-module-4", "angels-bio-yield-module-3", "angels-bio-yield-module-3", 3) +lib.replace_recipe_ingredient("angels-bio-yield-module-4", "angels-token-bio", "angels-token-bio", 10) + +lib.replace_recipe_ingredient("angels-bio-yield-module-5", "angels-bio-yield-module-4", "angels-bio-yield-module-4", 2) +lib.replace_recipe_ingredient("angels-bio-yield-module-5", "angels-token-bio", "angels-token-bio", 10) + +--added consumption_modifier to agriculture module since it now has efficiency module as ingredient +lib.add_module_effect("angels-bio-yield-module", "consumption", -0.1) +lib.add_module_effect("angels-bio-yield-module-2", "consumption", -0.1) +lib.add_module_effect("angels-bio-yield-module-3", "consumption", -0.2) +lib.add_module_effect("angels-bio-yield-module-4", "consumption", -0.2) +lib.add_module_effect("angels-bio-yield-module-5", "consumption", -0.3) + +--reworked pollution_modifier of agriculture module since it now lacks the pollution create module +lib.add_module_effect("angels-bio-yield-module", "pollution", nil) +lib.add_module_effect("angels-bio-yield-module-2", "pollution", nil) +lib.add_module_effect("angels-bio-yield-module-3", "pollution", nil) +lib.add_module_effect("angels-bio-yield-module-4", "pollution", nil) +lib.add_module_effect("angels-bio-yield-module-5", "pollution", nil) diff --git a/CircuitProcessing/changelog.txt b/CircuitProcessing/changelog.txt index 207a2ba..9536c1a 100644 --- a/CircuitProcessing/changelog.txt +++ b/CircuitProcessing/changelog.txt @@ -1,4 +1,12 @@ --------------------------------------------------------------------------------------------------- +Version: 0.5.0 +Date: 06.09.2025 + Changes: + - Factorio 2.0 update + - Enabled Angel's Agriculture Modules + - Updated module cost and effects + - Renamed components of Bob's +--------------------------------------------------------------------------------------------------- Version: 0.4.5 Date: 01.01.2023 Changes: diff --git a/CircuitProcessing/data-updates.lua b/CircuitProcessing/data-updates.lua index 61b4595..b28d891 100644 --- a/CircuitProcessing/data-updates.lua +++ b/CircuitProcessing/data-updates.lua @@ -1,44 +1,7 @@ require "bobelectronics" -require "bobmodules" -data.raw.recipe['rocket-control-unit'].normal = nil -data.raw.recipe['rocket-control-unit'].expensive = nil -local module = 'speed-module' -if data.raw.module['speed-module-8'] then - module = 'speed-module-2' +if mods["angelsbioprocessing"] then + require "angelsmodules" end -data.raw.recipe['rocket-control-unit'].ingredients = { - {"advanced-processing-unit", 1}, - {module, 1} -} -data.raw.recipe['rocket-control-unit'].result = 'rocket-control-unit' -data.raw.recipe['rocket-control-unit'].energy_required = 30 -bobmods.lib.tech.add_prerequisite('rocket-control-unit', 'speed-module') -bobmods.lib.tech.add_prerequisite("rocket-control-unit", "advanced-electronics-3") -bobmods.lib.tech.add_science_pack("rocket-control-unit", "production-science-pack", 1) --- Hide Agriculture Modules. Revisit later, once Angel's devs have finished their changes -local function disable(name) - if data.raw.technology[name] then - data.raw.technology[name].enabled = false - data.raw.technology[name].hidden = true - end - if data.raw.recipe[name] then - data.raw.recipe[name].hidden = true - end - if data.raw.module[name] then - data.raw.module[name].flags = {'hidden'} - end -end -for _,v in pairs({ - 'angels-bio-yield-module', - 'angels-bio-yield-module-2', - 'angels-bio-yield-module-3', - 'angels-bio-yield-module-4', - 'angels-bio-yield-module-5', - 'angels-bio-yield-module-6', - 'angels-bio-yield-module-7', - 'angels-bio-yield-module-8' - }) do - disable(v) -end +require "bobmodules" \ No newline at end of file diff --git a/CircuitProcessing/data.lua b/CircuitProcessing/data.lua index 58b5939..5c532ae 100644 --- a/CircuitProcessing/data.lua +++ b/CircuitProcessing/data.lua @@ -1,4 +1,4 @@ if angelsmods and angelsmods.trigger and angelsmods.trigger.smelting_products and angelsmods.trigger.smelting_products["chrome"] then angelsmods.trigger.smelting_products["chrome"].plate = true -end +end \ No newline at end of file diff --git a/CircuitProcessing/info.json b/CircuitProcessing/info.json index ad5044a..6e847c7 100644 --- a/CircuitProcessing/info.json +++ b/CircuitProcessing/info.json @@ -1,7 +1,7 @@ { "name": "CircuitProcessing", - "version": "0.4.5", - "factorio_version": "1.1", + "version": "0.5.0", + "factorio_version": "2.0", "title": "Circuit Processing", "author": "Trainwreck", "contact": "", diff --git a/CircuitProcessing/lib.lua b/CircuitProcessing/lib.lua index 3555b89..e4028c7 100644 --- a/CircuitProcessing/lib.lua +++ b/CircuitProcessing/lib.lua @@ -10,7 +10,7 @@ lib.tablefind = function(table, item) end lib.checkplate = function(plate, rest) - if data.raw.item[plate[1]] then + if data.raw.item[plate.name] then local newtable = table.deepcopy(rest) table.insert(newtable, plate) return newtable @@ -28,12 +28,7 @@ lib.hide_item = function(name) item = data.raw.tool[name] end if item then - if not item.flags then - item.flags = {} - end - if not lib.tablefind(item.flags, "hidden") then - table.insert(item.flags, "hidden") - end + item.hidden = true end end @@ -44,41 +39,62 @@ lib.set_main_product = function(recipe, item) type(item) == "string" and r then - if r.normal then - r.normal.main_product = item - end - if r.expensive then - r.expensive.main_product = item - end - if (not r.normal) and (not r.expensive) then - r.main_product = item - end + r.main_product = item else log(debug.traceback()) end end - lib.hide_recipe = function(recipe) - local r = data.raw.recipe[recipe] - if - type(recipe) == "string" and - r - then - if r.normal then - r.normal.hidden = true - r.normal.enabled = false + local r = data.raw.recipe[recipe] + if + type(recipe) == "string" and + r + then + r.hidden = true + r.enabled = false + else + log(debug.traceback()) end - if r.expensive then - r.expensive.hidden = true - r.expensive.enabled = false +end + +lib.set_energy_required = function(recipe, energy) + local r = data.raw.recipe[recipe] + if type(recipe) == "string" and type(energy) == "number" and r then + r.energy_required = energy + else + log(debug.traceback()) end - if (not r.normal) and (not r.expensive) then - r.hidden = true - r.enabled = false +end + +lib.add_module_effect = function(module_name, effect_name, effect_amount) + local module = data.raw.module[module_name] + + if (not module) then error("Tried to remove effect of non existing module "..module_name) end + + module.effect[effect_name] = effect_amount +end + +-- replaces existing ingredient with new ingredient (only items) +lib.replace_recipe_ingredient = function(recipe_name, old_ingredient, new_ingredient, new_amount) + local recipes = data.raw.recipe + if (not recipes[recipe_name]) then error("Recipe "..recipe_name.." not found while trying to replace ingredient") end + + for _, ingr in pairs(recipes[recipe_name].ingredients) do + if (ingr.name == old_ingredient) then + ingr.name = new_ingredient + ingr.amount = new_amount or ingr.amount + end end - else - log(debug.traceback()) - end end -return lib +-- adds recipe ingredient (only items) +lib.add_recipe_ingredient = function(recipe_name, ingr_name, ingr_amount) + local recipes = data.raw.recipe + if (not recipes[recipe_name]) then error("Recipe "..recipe_name.." not found while trying to add ingredient") end + + recipes[recipe_name].ingredients = recipes[recipe_name].ingredients or {} + + table.insert(recipes[recipe_name].ingredients, { type = "item", name = ingr_name, amount = ingr_amount or 1 }) +end + +return lib \ No newline at end of file