From ece220b4dab7ccffdc8e69d29a0d38e0bd5fedac Mon Sep 17 00:00:00 2001 From: klarkxy <278370456@qq.com> Date: Thu, 6 Apr 2023 20:37:01 +0800 Subject: [PATCH 01/11] Add zh-CN locale --- locale/zh-CN/salt.cfg | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 locale/zh-CN/salt.cfg diff --git a/locale/zh-CN/salt.cfg b/locale/zh-CN/salt.cfg new file mode 100644 index 0000000..a75ed26 --- /dev/null +++ b/locale/zh-CN/salt.cfg @@ -0,0 +1,50 @@ +[entity-name] +salt=盐 + +[autoplace-control-names] +salt=[item=salt] __ENTITY__salt__ + +[item-name] +salt=__ENTITY__salt__ +ferric-chloride=氯化铁 +pcb=PCB +pcb-substrate=__ITEM__pcb__ 基板 + +[item-description] +pcb=印刷电路板 +pcb-substrate=用于蚀刻电路的电路板 + +[fluid-name] +chlorine=氯 +epoxy=环氧树脂 +hydrogen-chloride=氯化氢 +vinyl-chloride=氯乙烯 + +[technology-name] +chlorine-processing=氯气加工 + +[technology-description] + +[recipe-name] + +[recipe-description] + +# Settings + +[mod-setting-name] +bzchlorine-recipe-bypass=绕过配方 +bzchlorine-list=列出修改后的配方 +bzchlorine-salt=生成可开采的盐矿 +bzchlorine-more-intermediates=提供更多氯化物中间体 +bzchlorine-early-salt=如何尽早获得盐 + +[mod-setting-description] +bzchlorine-recipe-bypass=跳过修改这些配方(逗号分隔的列表)。 +bzchlorine-list=如果启用,文本命令 [color=orange]BZList[/color] 会将一个文件转储到脚本输出目录,其中包含已修改配方的完整列表。\n建议在完成其他设置配置后关闭此功能。 + +[string-mod-setting] +bzchlorine-more-intermediates-no=否 +bzchlorine-more-intermediates-yes=是:氯化铁和氯乙烯 +bzchlorine-early-salt-assembler=在早期装配器中(启用流体输入) +bzchlorine-early-salt-mining=在起始区域生成可开采的盐矿 +bzchlorine-early-salt-both=以上两者 From b42b0ea7b4817e4928c5cab1241b37b9868e6971 Mon Sep 17 00:00:00 2001 From: klarkxy <278370456@qq.com> Date: Thu, 6 Apr 2023 20:46:39 +0800 Subject: [PATCH 02/11] Add chinese mod-name and mod-description --- locale/zh-CN/salt.cfg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/locale/zh-CN/salt.cfg b/locale/zh-CN/salt.cfg index a75ed26..5a29215 100644 --- a/locale/zh-CN/salt.cfg +++ b/locale/zh-CN/salt.cfg @@ -48,3 +48,10 @@ bzchlorine-more-intermediates-yes=是:氯化铁和氯乙烯 bzchlorine-early-salt-assembler=在早期装配器中(启用流体输入) bzchlorine-early-salt-mining=在起始区域生成可开采的盐矿 bzchlorine-early-salt-both=以上两者 + + +[mod-name] +bzchlorine=BZ-盐和氯 + +[mod-description] +bzchlorine=在基础游戏中添加盐、氯等。重新设计先进的电路制作。\n\n与Krastorio 2和Space Exploration兼容。BZ Mods的独立作品。 \ No newline at end of file From ea0b51054e6c00c6441a75da7dfdcd8521e88ba1 Mon Sep 17 00:00:00 2001 From: Brevven Date: Sun, 16 Apr 2023 01:43:41 -0700 Subject: [PATCH 03/11] matter --- changelog.txt | 5 +++++ data.lua | 2 ++ info.json | 2 +- matter.lua | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 matter.lua diff --git a/changelog.txt b/changelog.txt index 7bb7ad8..a73bdd1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 0.1.2 +Date: 2023-04-16 + Features: + - K2 matter +--------------------------------------------------------------------------------------------------- Version: 0.1.1 Date: 2023-03-28 Fixes: diff --git a/data.lua b/data.lua index e142430..fadac78 100644 --- a/data.lua +++ b/data.lua @@ -3,6 +3,8 @@ require("prototypes/chlorine") require("prototypes/epoxy") require("prototypes/pcb") +require("matter") + local util = require("data-util"); if util.se6() then diff --git a/info.json b/info.json index 3e9def8..d99f670 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzchlorine", - "version": "0.1.1", + "version": "0.1.2", "factorio_version": "1.1", "title": "Salt & Chlorine", "author": "Brevven", diff --git a/matter.lua b/matter.lua new file mode 100644 index 0000000..236a0eb --- /dev/null +++ b/matter.lua @@ -0,0 +1,15 @@ +-- Matter recipes for Krastorio2 +if mods["Krastorio2"] then + local util = require("data-util"); + + util.k2matter({ + k2matter = { + item_name = "salt", + matter_value = 2, + energy_required = 1, + need_stabilizer = false, + unlocked_by_technology = "salt-matter-processing", + }, + icon = {icon = "__bzchlorine__/graphics/icons/salt.png", icon_size = 128, scale = 1} + }) +end From 6b8ec24e66dc055e79f3a797dd6699b0a8e241e1 Mon Sep 17 00:00:00 2001 From: Brevven Date: Sun, 16 Apr 2023 01:44:23 -0700 Subject: [PATCH 04/11] fix particle --- changelog.txt | 2 ++ prototypes/salt.lua | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index a73bdd1..e93e68c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,8 @@ Version: 0.1.2 Date: 2023-04-16 Features: - K2 matter + Fixes: + - Mining particle graphics update --------------------------------------------------------------------------------------------------- Version: 0.1.1 Date: 2023-03-28 diff --git a/prototypes/salt.lua b/prototypes/salt.lua index 4b95957..04b8bf7 100644 --- a/prototypes/salt.lua +++ b/prototypes/salt.lua @@ -1,9 +1,23 @@ local resource_autoplace = require('resource-autoplace'); local noise = require('noise'); +local futil = require("util"); local util = require("data-util"); if util.me.salt() then + + +local particle = futil.table.deepcopy(data.raw["optimized-particle"]["stone-particle"]) +particle.name = "salt-particle" + +for i, picture in ipairs(particle.pictures) do + local tint = {r=1, g=1, b=1, a=0} + picture.tint = tint + picture.hr_version.tint = tint +end + +data:extend({particle}) + data:extend({ { type = "autoplace-control", @@ -29,7 +43,7 @@ data:extend({ minable = { hardness = 1, - mining_particle = "copper-ore-particle", + mining_particle = "salt-particle", mining_time = 0.5, result = "salt" }, From 2567aeef6615973d9f462d4bc6b1de0239cb16b5 Mon Sep 17 00:00:00 2001 From: Brevven Date: Sun, 16 Apr 2023 01:44:44 -0700 Subject: [PATCH 05/11] k2 electrolysis time halved --- changelog.txt | 2 ++ prototypes/chlorine.lua | 1 + 2 files changed, 3 insertions(+) diff --git a/changelog.txt b/changelog.txt index e93e68c..0465163 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,8 @@ Version: 0.1.2 Date: 2023-04-16 Features: - K2 matter + Changes: + - K2 salt water electrolysis time cut in half (due to higher chlorine demands) Fixes: - Mining particle graphics update --------------------------------------------------------------------------------------------------- diff --git a/prototypes/chlorine.lua b/prototypes/chlorine.lua index 173402d..5ae8136 100644 --- a/prototypes/chlorine.lua +++ b/prototypes/chlorine.lua @@ -80,6 +80,7 @@ data:extend({ }) else util.replace_ingredient("kr-water-electrolysis", "sand", "salt", 2) + util.multiply_time("kr-water-electrolysis", 0.5) end data:extend({ { From e85ca01dd27b293e75884804bcb55dc154c8e2cd Mon Sep 17 00:00:00 2001 From: Brevven Date: Sun, 16 Apr 2023 03:33:17 -0700 Subject: [PATCH 06/11] credit --- README.md | 1 + changelog.txt | 5 +++++ info.json | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 14d4a11..f738ac8 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ See changelog.txt - [Sakuro](https://github.com/sakuro) (ja) - [CV514](https://github.com/CV514) (ru) +- [Klarkxy](https://github.com/klarkxy) (zh-CN) ### Testing - Berkelear diff --git a/changelog.txt b/changelog.txt index 0465163..3f29564 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 0.1.3 +Date: 2023-04-16 + Localization: + - zh-CN thanks to Klarkxy +--------------------------------------------------------------------------------------------------- Version: 0.1.2 Date: 2023-04-16 Features: diff --git a/info.json b/info.json index d99f670..58e2014 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzchlorine", - "version": "0.1.2", + "version": "0.1.3", "factorio_version": "1.1", "title": "Salt & Chlorine", "author": "Brevven", From dee0ce3df003045684c69b677b0439bf9470b6b5 Mon Sep 17 00:00:00 2001 From: Brevven Date: Tue, 26 Dec 2023 07:05:33 -0800 Subject: [PATCH 07/11] k2: bakelite recipe alt --- changelog.txt | 5 +++++ info.json | 2 +- prototypes/chlorine.lua | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3f29564..9178a84 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 0.1.4 +Date: 2023-04-23 + Fixes: + - K2: When used with Natural Gas mod, unlock alternate bakelite recipe +--------------------------------------------------------------------------------------------------- Version: 0.1.3 Date: 2023-04-16 Localization: diff --git a/info.json b/info.json index 58e2014..32df60e 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzchlorine", - "version": "0.1.3", + "version": "0.1.4", "factorio_version": "1.1", "title": "Salt & Chlorine", "author": "Brevven", diff --git a/prototypes/chlorine.lua b/prototypes/chlorine.lua index 5ae8136..9e9787c 100644 --- a/prototypes/chlorine.lua +++ b/prototypes/chlorine.lua @@ -197,7 +197,7 @@ if mods.bzgas then } }) if mods.Krastorio2 then - util.add_unlock("advanced-chemistry", "bakelite-hcl") + util.add_unlock("kr-advanced-chemistry", "bakelite-hcl") else util.add_unlock("chlorine-processing", "bakelite-hcl") end From 03d64c6e3d188a6ae6459bb919b67f78eacba44a Mon Sep 17 00:00:00 2001 From: Brevven Date: Sat, 23 Mar 2024 12:13:22 -0700 Subject: [PATCH 08/11] up --- data-util.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-util.lua b/data-util.lua index 6f24821..0c58ecd 100644 --- a/data-util.lua +++ b/data-util.lua @@ -173,7 +173,7 @@ function util.k2matter(params) }, time = 45, }, - localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}}, + -- (ignore for now) localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}}, }, }) end From e4eb4c4f2a3c0d049ff0d8ba9a1f9e9a7552672c Mon Sep 17 00:00:00 2001 From: Brevven Date: Sat, 23 Mar 2024 14:12:19 -0700 Subject: [PATCH 09/11] up --- control-util.lua | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/control-util.lua b/control-util.lua index cd2b0f2..9000745 100644 --- a/control-util.lua +++ b/control-util.lua @@ -26,4 +26,61 @@ function util.force_enable_recipe(event, recipe_name) end end + +function util.warptorio2_expansion_helper() + if script.active_mods["warptorio2_expansion"] then + function check_container_for_items(container,items) + local has_all =true + for k=1,#items do + if container.get_item_count(items[k].name) Date: Sat, 23 Mar 2024 14:12:41 -0700 Subject: [PATCH 10/11] balance SEK2 energy requirements for electrolysis --- changelog.txt | 7 +++++++ info.json | 2 +- prototypes/chlorine.lua | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 9178a84..23d238a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,11 @@ --------------------------------------------------------------------------------------------------- +Version: 0.1.5 +Date: 2024-03-24 + Changes: + - K2 + SE: Cut the time for salt water electrolysis to balance energy requirements to be close + to what they were prior to SE changes. As of now the time is 1.25s, down from 3.5s; both at + 5.17MW. Before the SE changes, it was 2.5s at 2.58MW. +--------------------------------------------------------------------------------------------------- Version: 0.1.4 Date: 2023-04-23 Fixes: diff --git a/info.json b/info.json index 32df60e..8df3aa4 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzchlorine", - "version": "0.1.4", + "version": "0.1.5", "factorio_version": "1.1", "title": "Salt & Chlorine", "author": "Brevven", diff --git a/prototypes/chlorine.lua b/prototypes/chlorine.lua index 9e9787c..f69c30d 100644 --- a/prototypes/chlorine.lua +++ b/prototypes/chlorine.lua @@ -80,7 +80,11 @@ data:extend({ }) else util.replace_ingredient("kr-water-electrolysis", "sand", "salt", 2) - util.multiply_time("kr-water-electrolysis", 0.5) + if util.se6() then + util.multiply_time("kr-water-electrolysis", 5.0/28) + else + util.multiply_time("kr-water-electrolysis", 0.5) + end end data:extend({ { From 06281ea9cae3f0f756517ae9a0d20fedaafc28ec Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Sun, 5 Oct 2025 08:52:53 +0200 Subject: [PATCH 11/11] Update to 2.0 --- .editorconfig | 3 + .gitignore | 1 + README.md | 1 + compatibility/bob.lua | 4 +- data-util.lua | 228 ++++++++----------------------- info.json | 30 ++-- matter.lua | 21 ++- modules.lua | 13 +- prototypes/assembler-updates.lua | 53 +++---- prototypes/chlorine.lua | 55 ++++---- prototypes/epoxy.lua | 8 +- prototypes/pcb.lua | 32 +++-- prototypes/salt.lua | 80 +++++------ recipe-updates.lua | 8 +- 14 files changed, 196 insertions(+), 341 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitignore diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bbf3e21 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*] +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/README.md b/README.md index f738ac8..9c8f2da 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ See changelog.txt ## Thanks to - [Benjah-bmm27](https://commons.wikimedia.org/wiki/File:Vinyl-chloride-3D-vdW.png) (vinyl chloride icon) - [snouz](https://github.com/snouz) (logo inspiration) +- [cackling fiend](https://mods.factorio.com/user/cackling.fiend) (Update to 2.0) ### Compatibility - [nihilistzsche](https://github.com/nihilistzsche) diff --git a/compatibility/bob.lua b/compatibility/bob.lua index 848bb81..a09b74d 100644 --- a/compatibility/bob.lua +++ b/compatibility/bob.lua @@ -1,10 +1,10 @@ local util = require("data-util"); -if mods.bobelectronics or mods.MDbobelectronics then +if mods.bobelectronics or mods.MDbobelectronics or mods.MDbobelectronics2 then -- FeCL3 is now anhydrous, so hydrate it for bob util.remove_ingredient("ferric-chloride-solution", "iron-ore") - util.remove_ingredient("ferric-chloride-solution", "hydrogen-chloride") + util.remove_ingredient("ferric-chloride-solution", mods["Krastorio2"] and "kr-hydrogen-chloride" or "hydrogen-chloride") util.add_ingredient("ferric-chloride-solution", "ferric-chloride", 5) util.add_ingredient("ferric-chloride-solution", "water", 50) diff --git a/data-util.lua b/data-util.lua index 0c58ecd..4547d4f 100644 --- a/data-util.lua +++ b/data-util.lua @@ -64,17 +64,7 @@ function util.fe_plus(sub) end end -function util.get_stack_size(default) - if mods.Krastorio2 then - local size = get_setting("kr-stack-size") - if size and tonumber(size) then - return tonumber(size) - end - end - return default -end - -function util.k2assets() +function util.k2assets() if mods["Krastorio2Assets"] then return "__Krastorio2Assets__" end @@ -111,8 +101,8 @@ function util.se_landfill(params) category = "hard-recycling", order = "z-b-"..params.ore, subgroup = "terrain", - result = "landfill", - ingredients = {{params.ore, 50}}, + results = {{type="item", name="landfill", amount=1}}, + ingredients = {{type="item", name=params.ore, amount=50}}, } }) util.add_unlock("se-recycling-facility", lname) @@ -123,7 +113,7 @@ end -- k2 matter -- params: {k2matter}, k2baseicon , {icon} function util.k2matter(params) - local matter = require("__Krastorio2__/lib/public/data-stages/matter-util") + local matter = require("__Krastorio2__/prototypes/libraries/matter") if mods["space-exploration"] then params.k2matter.need_stabilizer = true end @@ -169,15 +159,15 @@ function util.k2matter(params) { {"production-science-pack", 1}, {"utility-science-pack", 1}, - {"matter-tech-card", 1} + {"kr-matter-tech-card", 1} }, time = 45, }, - -- (ignore for now) localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}}, + localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}}, }, }) end - matter.createMatterRecipe(params.k2matter) + matter.make_recipes(params.k2matter) end @@ -211,16 +201,16 @@ function util.se_matter(params) energy_required = params.energy_required, enabled = false, ingredients = { - {sedata, 1}, + {type="item", name=sedata, amount=1}, {type="fluid", name="se-particle-stream", amount=50}, {type="fluid", name="se-space-coolant-supercooled", amount=25}, }, results = { - {params.ore, params.quant_out}, - {"se-contaminated-scrap", 1}, - {type=item, name=sedata, amount=1, probability=.99}, - {type=item, name=sejunk, amount=1, probability=.01}, - {type="fluid", name="se-space-coolant-hot", amount=25, catalyst_amount=25}, + {type="item", name=params.ore, amount=params.quant_out}, + {type="item", name="se-contaminated-scrap", amount=1}, + {type="item", name=sedata, amount=1, probability=.99}, + {type="item", name=sejunk, amount=1, probability=.01}, + {type="fluid", name="se-space-coolant-hot", amount=25, ignored_by_productivity=25, ignored_by_stats=25}, } } }) @@ -250,14 +240,14 @@ function util.se_matter(params) energy_required = 30, enabled = false, ingredients = { - {"se-kr-matter-liberation-data", 1}, - {params.ore, params.quant_in}, + {type="item", name="se-kr-matter-liberation-data", amount=1}, + {type="item", name=params.ore, amount=params.quant_in}, {type="fluid", name="se-particle-stream", amount=50}, }, results = { - {type=item, name="se-kr-matter-liberation-data", amount=1, probability=.99}, - {type=item, name=sejunk, amount=1, probability=.01}, - {type="fluid", name="se-particle-stream", amount=params.stream_out, catalyst_amount=50}, + {type="item", name="se-kr-matter-liberation-data", amount=1, probability=.99}, + {type="item", name=sejunk, amount=1, probability=.01}, + {type="fluid", name="se-particle-stream", amount=params.stream_out, ignored_by_productivity=50, ignored_by_stats=50}, } } }) @@ -284,7 +274,7 @@ function util.se_matter(params) {"se-astronomic-science-pack-4", 1}, {"se-energy-science-pack-4", 1}, {"se-material-science-pack-4", 1}, - {"matter-tech-card", 1}, + {"kr-matter-tech-card", 1}, {"se-deep-space-science-pack-1", 1}, } @@ -298,18 +288,6 @@ function util.se_matter(params) end end --- Get the normal prototype for a recipe -- either .normal or the recipe itself -function util.get_normal(recipe_name) - if data.raw.recipe[recipe_name] then - recipe = data.raw.recipe[recipe_name] - if recipe.normal and recipe.normal.ingredients then - return recipe.normal - elseif recipe.ingredients then - return recipe - end - end -end - -- Set/override a technology's prerequisites function util.set_prerequisite(technology_name, prerequisites) local technology = data.raw.technology[technology_name] @@ -376,7 +354,7 @@ function util.add_unlock(technology_name, recipe) end -- Check if a tech unlocks a recipe -function util.check_unlock(technology_name, recipe_name) +function util.check_unlock(technology_name, recipe) local technology = data.raw.technology[technology_name] if technology and technology.effects then for i, effect in pairs(technology.effects) do @@ -421,17 +399,13 @@ end function util.set_enabled(recipe_name, enabled) if data.raw.recipe[recipe_name] then - if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.enabled = enabled end - if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.enabled = enabled end - if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].enabled = enabled end + data.raw.recipe[recipe_name].enabled = enabled end end function util.set_hidden(recipe_name) if data.raw.recipe[recipe_name] then - if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.hidden = true end - if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.hidden = true end - if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].hidden = true end + data.raw.recipe[recipe_name].hidden = true end end @@ -441,8 +415,6 @@ function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity, option if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then me.add_modified(recipe_name) add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity) - add_or_add_to_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity) - add_or_add_to_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity) end end @@ -465,8 +437,6 @@ function util.add_ingredient(recipe_name, ingredient, quantity, options) if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then me.add_modified(recipe_name) add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid) - add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity, is_fluid) - add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity, is_fluid) end end @@ -480,7 +450,7 @@ function add_ingredient(recipe, ingredient, quantity, is_fluid) if is_fluid then table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity}) else - table.insert(recipe.ingredients, {ingredient, quantity}) + table.insert(recipe.ingredients, {type="item", name=ingredient, amount=quantity}) end end end @@ -491,8 +461,6 @@ function util.add_ingredient_raw(recipe_name, ingredient, options) if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then me.add_modified(recipe_name) add_ingredient_raw(data.raw.recipe[recipe_name], ingredient) - add_ingredient_raw(data.raw.recipe[recipe_name].normal, ingredient) - add_ingredient_raw(data.raw.recipe[recipe_name].expensive, ingredient) end end @@ -516,8 +484,6 @@ function util.set_ingredient(recipe_name, ingredient, quantity, options) if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then me.add_modified(recipe_name) set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity) - set_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity) - set_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity) end end @@ -541,29 +507,18 @@ end -- Only works for recipes with multiple products function util.add_product(recipe_name, product, options) if not should_force(options) and bypass(recipe_name) then return end - if data.raw.recipe[recipe_name] and - (data.raw.item[product[1]] or data.raw.item[product.name] or - data.raw.fluid[product[1]] or data.raw.fluid[product.name] - ) then + if data.raw.recipe[recipe_name] and + (data.raw.item[product.name] or data.raw.fluid[product.name]) then add_product(data.raw.recipe[recipe_name], product) - add_product(data.raw.recipe[recipe_name].normal, product) - add_product(data.raw.recipe[recipe_name].expensive, product) end end function add_product(recipe, product) if recipe ~= nil then - if (product[1] and data.raw.item[product[1]]) or - (product.name and data.raw[product.type][product.name]) then - if not recipe.normal then - if recipe.results == nil then - recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}} - end - recipe.result = nil - recipe.result_count = nil - table.insert(recipe.results, product) + if recipe.results == nil then + recipe.results = {} end - end + table.insert(recipe.results, product) end end @@ -571,18 +526,13 @@ end function util.get_ingredient_amount(recipe_name, ingredient_name) local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.normal and recipe.normal.ingredients then - for i, ingredient in pairs(recipe.normal.ingredients) do - if ingredient[1] == ingredient_name then return ingredient[2] end - if ingredient.name == ingredient_name then return ingredient.amount end - end - elseif recipe.ingredients then + if recipe.ingredients then for i, ingredient in pairs(recipe.ingredients) do if ingredient[1] == ingredient_name then return ingredient[2] end if ingredient.name == ingredient_name then return ingredient.amount end end end - return 0 + return 1 end return 0 end @@ -592,14 +542,7 @@ function util.get_amount(recipe_name, product) if not product then product = recipe_name end local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.normal and recipe.normal.results then - for i, result in pairs(recipe.normal.results) do - if result[1] == product then return result[2] end - if result.name == product then return result.amount end - end - elseif recipe.normal and recipe.normal.result_count then - return recipe.normal.result_count - elseif recipe.results then + if recipe.results then for i, result in pairs(recipe.results) do if result[1] == product then return result[2] end if result.name == product then return result.amount end @@ -617,9 +560,7 @@ function util.get_result_count(recipe_name, product) if not product then product = recipe_name end local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.normal and recipe.normal.results then - return #(recipe.normal.results) - elseif recipe.results then + if recipe.results then return #(recipe.results) end return 1 @@ -634,8 +575,6 @@ function util.replace_ingredient(recipe_name, old, new, amount, multiply, option if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then me.add_modified(recipe_name) replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply) - replace_ingredient(data.raw.recipe[recipe_name].normal, old, new, amount, multiply) - replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new, amount, multiply) end end @@ -677,8 +616,6 @@ function util.remove_ingredient(recipe_name, old, options) if data.raw.recipe[recipe_name] then me.add_modified(recipe_name) remove_ingredient(data.raw.recipe[recipe_name], old) - remove_ingredient(data.raw.recipe[recipe_name].normal, old) - remove_ingredient(data.raw.recipe[recipe_name].expensive, old) end end @@ -704,28 +641,23 @@ function util.replace_some_product(recipe_name, old, old_amount, new, new_amount if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then me.add_modified(recipe_name) replace_some_product(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid) - replace_some_product(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount, is_fluid) - replace_some_product(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount, is_fluid) end end -function replace_some_product(recipe, old, old_amount, new, new_amount) +function replace_some_product(recipe, old, old_amount, new, new_amount, is_fluid) if recipe ~= nil then if recipe.result == new then return end if recipe.results then for i, existing in pairs(recipe.results) do - if existing[1] == new or existing.name == new then + if existing.name == new then return end end end - add_product(recipe, {new, new_amount}) + add_product(recipe, {type=is_fluid and "fluid" or "item", name=new, amount=new_amount}) for i, product in pairs(recipe.results) do if product.name == old then product.amount = math.max(1, product.amount - old_amount) - end - if product[1] == old then - product[2] = math.max(1, product[2] - old_amount) end end end @@ -738,8 +670,6 @@ function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amo if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then me.add_modified(recipe_name) replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid) - replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount, is_fluid) - replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount, is_fluid) end end @@ -768,8 +698,6 @@ function util.set_product_amount(recipe_name, product, amount, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then set_product_amount(data.raw.recipe[recipe_name], product, amount) - set_product_amount(data.raw.recipe[recipe_name].normal, product, amount) - set_product_amount(data.raw.recipe[recipe_name].expensive, product, amount) end end @@ -808,8 +736,6 @@ function util.multiply_recipe(recipe_name, multiple, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then multiply_recipe(data.raw.recipe[recipe_name], multiple) - multiply_recipe(data.raw.recipe[recipe_name].normal, multiple) - multiply_recipe(data.raw.recipe[recipe_name].expensive, multiple) end end @@ -817,8 +743,6 @@ function multiply_recipe(recipe, multiple) if recipe then if recipe.energy_required then recipe.energy_required = recipe.energy_required * multiple - else - recipe.energy_required = 0.5 * multiple -- 0.5 is factorio default end if recipe.result_count then recipe.result_count = recipe.result_count * multiple @@ -833,8 +757,11 @@ function multiply_recipe(recipe, multiple) result.amount_min = result.amount_min * multiple result.amount_max = result.amount_max * multiple end - if result.catalyst_amount then - result.catalyst_amount = result.catalyst_amount * multiple + if result.ignored_by_productivity then + result.ignored_by_productivity = result.ignored_by_productivity * multiple + end + if result.ignored_by_stats then + result.ignored_by_stats = result.ignored_by_stats * multiple end end if result[1] then @@ -861,9 +788,8 @@ end -- Returns true if a recipe has an ingredient function util.has_ingredient(recipe_name, ingredient) - return data.raw.recipe[recipe_name] and ( - has_ingredient(data.raw.recipe[recipe_name], ingredient) or - has_ingredient(data.raw.recipe[recipe_name].normal, ingredient)) + return data.raw.recipe[recipe_name] and + has_ingredient(data.raw.recipe[recipe_name], ingredient) end function has_ingredient(recipe, ingredient) @@ -883,8 +809,6 @@ function util.remove_product(recipe_name, old, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then remove_product(data.raw.recipe[recipe_name], old) - remove_product(data.raw.recipe[recipe_name].normal, old) - remove_product(data.raw.recipe[recipe_name].expensive, old) end end @@ -907,8 +831,6 @@ function util.set_main_product(recipe_name, product, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] then set_main_product(data.raw.recipe[recipe_name], product) - set_main_product(data.raw.recipe[recipe_name].normal, product) - set_main_product(data.raw.recipe[recipe_name].expensive, product) end end @@ -922,13 +844,11 @@ end function util.replace_product(recipe_name, old, new, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] then - replace_product(data.raw.recipe[recipe_name], old, new, options) - replace_product(data.raw.recipe[recipe_name].normal, old, new, options) - replace_product(data.raw.recipe[recipe_name].expensive, old, new, options) + replace_product(data.raw.recipe[recipe_name], old, new) end end -function replace_product(recipe, old, new, options) +function replace_product(recipe, old, new) if recipe then if recipe.main_product == old then recipe.main_product = new @@ -968,8 +888,6 @@ function util.set_recipe_time(recipe_name, time, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then set_recipe_time(data.raw.recipe[recipe_name], time) - set_recipe_time(data.raw.recipe[recipe_name].normal, time) - set_recipe_time(data.raw.recipe[recipe_name].expensive, time) end end @@ -987,8 +905,6 @@ function util.multiply_time(recipe_name, factor, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then multiply_time(data.raw.recipe[recipe_name], factor) - multiply_time(data.raw.recipe[recipe_name].normal, factor) - multiply_time(data.raw.recipe[recipe_name].expensive, factor) end end @@ -1006,8 +922,6 @@ function util.add_time(recipe_name, amount, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then add_time(data.raw.recipe[recipe_name], amount) - add_time(data.raw.recipe[recipe_name].normal, amount) - add_time(data.raw.recipe[recipe_name].expensive, amount) end end @@ -1031,7 +945,7 @@ end -- Set recipe subgroup function util.set_subgroup(recipe_name, subgroup, options) if not should_force(options) and bypass(recipe_name) then return end - if data.raw.recipe[recipe_name] and data.raw["item-subgroup"][subgroup] then + if data.raw.recipe[recipe_name] then me.add_modified(recipe_name) data.raw.recipe[recipe_name].subgroup = subgroup end @@ -1050,34 +964,16 @@ function util.add_icon(recipe_name, icon, options) if data.raw.recipe[recipe_name] then me.add_modified(recipe_name) if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) then - if data.raw.recipe[recipe_name].icon then - data.raw.recipe[recipe_name].icons = {{ - icon=data.raw.recipe[recipe_name].icon, - icon_size=data.raw.recipe[recipe_name].icon_size, - icon_mipmaps=data.raw.recipe[recipe_name].icon_mipmaps, - }} - elseif data.raw.item[data.raw.recipe[recipe_name].main_product] then - data.raw.recipe[recipe_name].icons = {{ - icon=data.raw.item[data.raw.recipe[recipe_name].main_product].icon, - icon_size=data.raw.item[data.raw.recipe[recipe_name].main_product].icon_size, - icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].main_product].icon_mipmaps, - }} - elseif data.raw.item[data.raw.recipe[recipe_name].result] then - data.raw.recipe[recipe_name].icons = {{ - icon=data.raw.item[data.raw.recipe[recipe_name].result].icon, - icon_size=data.raw.item[data.raw.recipe[recipe_name].result].icon_size, - icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].result].icon_mipmaps, - }} - elseif data.raw.recipe[recipe_name].normal and - data.raw.item[data.raw.recipe[recipe_name].normal.result] then - data.raw.recipe[recipe_name].icons = {{ - icon=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon, - icon_size=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon_size, - icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon_mipmaps, - }} - end - data.raw.recipe[recipe_name].icon = nil - data.raw.recipe[recipe_name].icon_size = nil + data.raw.recipe[recipe_name].icons = {} + if data.raw.recipe[recipe_name].icon then + data.raw.recipe[recipe_name].icons = {{ + icon=data.raw.recipe[recipe_name].icon, + icon_size=data.raw.recipe[recipe_name].icon_size, + icon_mipmaps=data.raw.recipe[recipe_name].icon_mipmaps, + }} + data.raw.recipe[recipe_name].icon = nil + data.raw.recipe[recipe_name].icon_size = nil + end end table.insert(data.raw.recipe[recipe_name].icons, icon) end @@ -1137,8 +1033,6 @@ function util.add_to_ingredient(recipe, ingredient, amount, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe] then add_to_ingredient(data.raw.recipe[recipe], ingredient, amount) - add_to_ingredient(data.raw.recipe[recipe].normal, ingredient, amount) - add_to_ingredient(data.raw.recipe[recipe].expensive, ingredient, amount) end end @@ -1161,8 +1055,6 @@ function util.add_to_product(recipe_name, product, amount, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] then add_to_product(data.raw.recipe[recipe_name], product, amount) - add_to_product(data.raw.recipe[recipe_name].normal, product, amount) - add_to_product(data.raw.recipe[recipe_name].expensive, product, amount) end end @@ -1285,10 +1177,8 @@ function remove_prior_unlocks(tech, recipe) util.remove_recipe_effect(tech, recipe) if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do - if string.sub(prerequisite, 1, 3) ~= 'ei_' then - -- log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :| - remove_prior_unlocks(prerequisite, recipe) - end + -- log("BZZZ removing prior unlocks for " .. tech ..", checking " .. prerequisite) -- Handy Debug :| + remove_prior_unlocks(prerequisite, recipe) end end end @@ -1330,9 +1220,7 @@ function replace_ingredients_prior_to(tech, old, new, multiplier) if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do -- log("BZZZ checking " .. prerequisite) -- Handy Debug :| - if string.sub(prerequisite, 1, 3) ~= 'ei_' then - replace_ingredients_prior_to(prerequisite, old, new, multiplier) - end + replace_ingredients_prior_to(prerequisite, old, new, multiplier) end end end diff --git a/info.json b/info.json index 8df3aa4..472594c 100644 --- a/info.json +++ b/info.json @@ -1,27 +1,27 @@ { "name": "bzchlorine", - "version": "0.1.5", - "factorio_version": "1.1", + "version": "2.0.0", + "factorio_version": "2.0", "title": "Salt & Chlorine", "author": "Brevven", "contact": "", "homepage": "", "dependencies": [ - "base >= 1.1.0", - "? bzfoundry >= 0.2.1", - "? bztitanium >= 1.2.0", - "? bzlead >= 1.2.0", - "? bzzirconium >= 0.6.0", + "base >= 2.0.0", + "? bzfoundry >= 2.0.0", + "? bztitanium >= 2.0.26", + "? bzlead >= 2.0.28", + "? bzzirconium >= 2.1.13", "? bztungsten >= 0.6.0", - "? bzcarbon >= 0.5.5", - "? bztin >= 0.1.8", - "? bzgas", - "? space-exploration >= 0.5.100", - "? aai-industry", - "(?) aai-loaders", - "? Krastorio2", + "? bzcarbon >= 2.0.21", + "? bztin >= 2.1.15", + "? bzgas >= 2.0.0", + "? space-exploration >= 0.7.34", + "? aai-industry >= 0.6.13", + "(?) aai-loaders >= 0.2.7", + "? Krastorio2 >= 2.0.8", "? bobelectronics", - "? MDbobelectronics", + "? MDbobelectronics2", "? deadlock-beltboxes-loaders", "? DeadlockCrating" ], diff --git a/matter.lua b/matter.lua index 236a0eb..84675cf 100644 --- a/matter.lua +++ b/matter.lua @@ -1,15 +1,12 @@ -- Matter recipes for Krastorio2 if mods["Krastorio2"] then - local util = require("data-util"); - - util.k2matter({ - k2matter = { - item_name = "salt", - matter_value = 2, - energy_required = 1, - need_stabilizer = false, - unlocked_by_technology = "salt-matter-processing", - }, - icon = {icon = "__bzchlorine__/graphics/icons/salt.png", icon_size = 128, scale = 1} - }) + local matter = require("__Krastorio2__/prototypes/libraries/matter"); + local salt_matter = { + material = { type = "item", name = "salt", amount = 1 }, + matter_count = 2, + energy_required = 1, + need_stabilizer = false, + unlocked_by_technology = "salt-matter-processing", + } + matter.make_recipes(salt_matter) end diff --git a/modules.lua b/modules.lua index ac4d9eb..818462f 100644 --- a/modules.lua +++ b/modules.lua @@ -1,16 +1,7 @@ --- Enable prod modules for some recipes -local util = require("data-util") +local util = require("data-util"); for i, recipe in pairs(util.me.recipes) do if data.raw.recipe[recipe] then - for j, module in pairs(data.raw.module) do - if module.effect then - for effect_name, effect in pairs(module.effect) do - if effect_name == "productivity" and effect.bonus > 0 and module.limitation and #module.limitation > 0 then - table.insert(module.limitation, recipe) - end - end - end - end + data.raw.recipe[recipe].allow_productivity = true end end diff --git a/prototypes/assembler-updates.lua b/prototypes/assembler-updates.lua index 1dd3f14..f553779 100644 --- a/prototypes/assembler-updates.lua +++ b/prototypes/assembler-updates.lua @@ -6,26 +6,15 @@ if util.me.early_assemblers() then data.raw["assembling-machine"]["assembling-machine-1"].fluid_boxes = futil.table.deepcopy(data.raw["assembling-machine"]["assembling-machine-2"].fluid_boxes) for i, fb in pairs(data.raw["assembling-machine"]["assembling-machine-1"].fluid_boxes) do if i ~= "off_when_no_fluid_recipe" and fb.pipe_picture then - fb.pipe_picture.north.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-N.png" - fb.pipe_picture.south.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-S.png" - fb.pipe_picture.east.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-E.png" - fb.pipe_picture.west.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-W.png" - - if fb.pipe_picture.north.hr_version then - fb.pipe_picture.north.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png" - fb.pipe_picture.south.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png" - fb.pipe_picture.east.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png" - fb.pipe_picture.west.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png" - end + fb.pipe_picture.north.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png" + fb.pipe_picture.south.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png" + fb.pipe_picture.east.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png" + fb.pipe_picture.west.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png" if fb.pipe_picture.north.layers and fb.pipe_picture.north.layers[1] then - fb.pipe_picture.north.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-N.png" - fb.pipe_picture.south.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-S.png" - fb.pipe_picture.east.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-E.png" - fb.pipe_picture.west.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-W.png" - fb.pipe_picture.north.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png" - fb.pipe_picture.south.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png" - fb.pipe_picture.east.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png" - fb.pipe_picture.west.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png" + fb.pipe_picture.north.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png" + fb.pipe_picture.south.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png" + fb.pipe_picture.east.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png" + fb.pipe_picture.west.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png" fb.pipe_picture.north.layers[2] = nil fb.pipe_picture.south.layers[2] = nil fb.pipe_picture.east.layers[2] = nil @@ -38,25 +27,15 @@ if util.me.early_assemblers() then data.raw["assembling-machine"]["burner-assembling-machine"].fluid_boxes = futil.table.deepcopy(data.raw["assembling-machine"]["assembling-machine-2"].fluid_boxes) for i, fb in pairs(data.raw["assembling-machine"]["burner-assembling-machine"].fluid_boxes) do if i ~= "off_when_no_fluid_recipe" and fb.pipe_picture then - fb.pipe_picture.north.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-N.png" - fb.pipe_picture.south.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-S.png" - fb.pipe_picture.east.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-E.png" - fb.pipe_picture.west.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-W.png" - if fb.pipe_picture.north.hr_version then - fb.pipe_picture.north.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png" - fb.pipe_picture.south.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png" - fb.pipe_picture.east.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png" - fb.pipe_picture.west.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png" - end + fb.pipe_picture.north.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png" + fb.pipe_picture.south.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png" + fb.pipe_picture.east.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png" + fb.pipe_picture.west.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png" if fb.pipe_picture.north.layers and fb.pipe_picture.north.layers[1] then - fb.pipe_picture.north.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-N.png" - fb.pipe_picture.south.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-S.png" - fb.pipe_picture.east.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-E.png" - fb.pipe_picture.west.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-W.png" - fb.pipe_picture.north.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png" - fb.pipe_picture.south.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png" - fb.pipe_picture.east.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png" - fb.pipe_picture.west.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png" + fb.pipe_picture.north.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png" + fb.pipe_picture.south.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png" + fb.pipe_picture.east.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png" + fb.pipe_picture.west.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png" fb.pipe_picture.north.layers[2] = nil fb.pipe_picture.south.layers[2] = nil fb.pipe_picture.east.layers[2] = nil diff --git a/prototypes/chlorine.lua b/prototypes/chlorine.lua index f69c30d..5359cfd 100644 --- a/prototypes/chlorine.lua +++ b/prototypes/chlorine.lua @@ -1,12 +1,16 @@ local util = require("data-util"); +local cl_name = mods.Krastorio2 and "kr-chlorine" or "chlorine" +local hcl_name = mods.Krastorio2 and "kr-hydrogen-chloride" or "hydrogen-chloride" + + if not mods.Krastorio2 then data:extend({ { type = "fluid", - name = "chlorine", + name = cl_name, default_temperature = 25, - heat_capacity = "0.1KJ", + heat_capacity = "0.1kJ", base_color = {r=0.60, g=0.90, b=0.50}, flow_color = {r=0.60, g=1.00, b=0.50}, icon = "__bzchlorine__/graphics/icons/chlorine.png", @@ -15,9 +19,9 @@ data:extend({ }, { type = "fluid", - name = "hydrogen-chloride", + name = hcl_name, default_temperature = 25, - heat_capacity = "0.1KJ", + heat_capacity = "0.1kJ", base_color = {r=0.80, g=0.90, b=0.70}, flow_color = {r=0.80, g=1.00, b=0.70}, icon = "__bzchlorine__/graphics/icons/hcl.png", @@ -36,13 +40,13 @@ data:extend({ icon_size = 64, icon_mipmaps = 4, subgroup = "raw-material", order = "b[chlorine-fe]", - stack_size = util.get_stack_size(100), + stack_size = 100, }, { type = "fluid", name = "vinyl-chloride", default_temperature = 25, - heat_capacity = "0.1KJ", + heat_capacity = "0.1kJ", base_color = {r=0.90, g=0.90, b=0.75}, flow_color = {r=0.90, g=1.00, b=0.75}, icon = "__bzchlorine__/graphics/icons/vinyl-chloride.png", @@ -56,9 +60,9 @@ if not mods.Krastorio2 then data:extend({ { type = "recipe", - name = "chlorine", - results = {{type="fluid", name="chlorine", amount=10}}, - ingredients = {{"salt", 2}}, + name = cl_name, + results = {{type="fluid", name=cl_name, amount=10}}, + ingredients = {{type="item", name="salt", amount=2}}, enabled = false, category = "chemistry", subgroup = "fluid-recipes", @@ -67,10 +71,10 @@ data:extend({ { type = "recipe", name = "hydrogen-chloride-pure", - results = {{type="fluid", name="hydrogen-chloride", amount=20}}, + results = {{type="fluid", name=hcl_name, amount=20}}, ingredients = { {type="fluid", name="water", amount=10}, - {type="fluid", name="chlorine", amount=10}, + {type="fluid", name=cl_name, amount=10}, }, enabled = false, category = "chemistry", @@ -79,7 +83,7 @@ data:extend({ }, }) else - util.replace_ingredient("kr-water-electrolysis", "sand", "salt", 2) + util.replace_ingredient("kr-water-electrolysis", "kr-sand", "salt", 2) if util.se6() then util.multiply_time("kr-water-electrolysis", 5.0/28) else @@ -90,9 +94,9 @@ data:extend({ { type = "recipe", name = "hydrogen-chloride-salt", - results = {{type="fluid", name="hydrogen-chloride", amount=10}}, + results = {{type="fluid", name=hcl_name, amount=10}}, ingredients = { - {"salt", 1}, + {type="item", name="salt", amount=1}, {type="fluid", name="water", amount=5}, {type="fluid", name="sulfuric-acid", amount=5}, }, @@ -108,10 +112,10 @@ data:extend({ { type = "recipe", name = "ferric-chloride", - results = {{"ferric-chloride", 2}}, + results = {{type="item", name="ferric-chloride", amount=2}}, ingredients = { - {"iron-plate", 2}, - {type="fluid", name="chlorine", amount=30}, + {type="item", name="iron-plate", amount=2}, + {type="fluid", name=cl_name, amount=30}, }, enabled = false, category = "chemistry", @@ -120,14 +124,14 @@ data:extend({ { type = "recipe", name = "ferric-chloride-hcl", - results = {{"ferric-chloride", 4}}, + results = {{type="item", name="ferric-chloride", amount=4}}, icons = { {icon = "__bzchlorine__/graphics/icons/ferric-chloride.png", icon_size=64, scale=1}, {icon = "__bzchlorine__/graphics/icons/hcl.png", icon_size=128, scale=0.25, shift={8,-8}}, }, ingredients = { - {"iron-ore", 1}, - {type="fluid", name="hydrogen-chloride", amount=120}, + {type="item", name="iron-ore", amount=1}, + {type="fluid", name=hcl_name, amount=120}, }, enabled = false, category = "chemistry", @@ -138,7 +142,7 @@ data:extend({ name = "vinyl-chloride", results = {{type="fluid", name="vinyl-chloride", amount=20}}, ingredients = { - {type="fluid", name="chlorine", amount=10}, + {type="fluid", name=cl_name, amount=10}, {type="fluid", name="petroleum-gas", amount=20}, }, enabled = false, @@ -159,7 +163,7 @@ data:extend({ {icon = "__bzchlorine__/graphics/technology/salt-tech.png", icon_size = 256, tint={a=.75,r=1,b=1,g=1} }, }, effects = { - { type = "unlock-recipe", recipe = "chlorine" }, + { type = "unlock-recipe", recipe = cl_name }, { type = "unlock-recipe", recipe = "hydrogen-chloride-salt" }, { type = "unlock-recipe", recipe = "hydrogen-chloride-pure" }, }, @@ -185,11 +189,12 @@ if mods.bzgas then { type="recipe", name="bakelite-hcl", - results = {{"bakelite", 3}}, + localised_name = { "item-name.bakelite" }, + results = {{type="item", name="bakelite", amount=3}}, ingredients = { - {data.raw.item["phenol"] and "phenol" or "coal", 1}, + {type="item", name=data.raw.item["phenol"] and "phenol" or "coal", amount=1}, {type="fluid", name="formaldehyde", amount=10}, - {type="fluid", name="hydrogen-chloride", amount=5}, + {type="fluid", name=hcl_name, amount=5}, }, icons = { {icon = "__bzgas__/graphics/icons/bakelite.png", icon_size=128}, diff --git a/prototypes/epoxy.lua b/prototypes/epoxy.lua index 64ba8a6..40226c3 100644 --- a/prototypes/epoxy.lua +++ b/prototypes/epoxy.lua @@ -1,11 +1,13 @@ local util = require("data-util"); +local cl_name = mods.Krastorio2 and "kr-chlorine" or cl_name + data:extend({ { type = "fluid", name = "epoxy", default_temperature = 25, - heat_capacity = "0.1KJ", + heat_capacity = "0.1kJ", base_color = {r=0.90, g=0.95, b=0.90}, flow_color = {r=0.90, g=1.00, b=0.90}, icon = "__bzchlorine__/graphics/icons/epoxy.png", @@ -20,11 +22,11 @@ data:extend({ name = "epoxy", results = { {type="fluid", name="epoxy", amount=10}, - {"salt", 1}, + {type="item", name="salt", amount=1}, }, main_product = "epoxy", ingredients = { - {type="fluid", name="chlorine", amount=10}, + {type="fluid", name=cl_name, amount=10}, {type="fluid", name="petroleum-gas", amount=10}, }, enabled = false, diff --git a/prototypes/pcb.lua b/prototypes/pcb.lua index e3a0977..5f3fe92 100644 --- a/prototypes/pcb.lua +++ b/prototypes/pcb.lua @@ -1,5 +1,7 @@ local util = require("data-util"); +local hcl_name = mods.Krastorio2 and "kr-hydrogen-chloride" or hcl_name + data:extend({ { type = "item", @@ -8,10 +10,10 @@ data:extend({ icon_size = 128, subgroup = "intermediate-product", order = "f[advanced-circuit][pcb-substrate]", - stack_size = util.get_stack_size(200), + stack_size = 200, }, }) -if (not mods.bobelectronics and not mods.MDbobelectronics) then +if not (mods.bobelectronics or mods.MDbobelectronics or mods.MDbobelectronics2) then data:extend({ { type = "item", @@ -20,7 +22,7 @@ data:extend({ icon_size = 128, subgroup = "intermediate-product", order = "f[advanced-circuit][pcb]", - stack_size = util.get_stack_size(200), + stack_size = 200, }, }) @@ -31,44 +33,44 @@ data:extend({ type = "recipe", name = "pcb-substrate", results = { - {"pcb-substrate", 12}, + {type="item", name="pcb-substrate", amount=12}, }, ingredients = { {type="fluid", name="epoxy", amount=30}, - {"plastic-bar", 3}, + {type="item", name="plastic-bar", amount=3}, }, enabled = false, category = "chemistry", energy_required = 6, }, }) -util.add_unlock("advanced-electronics", "pcb-substrate") +util.add_unlock("advanced-circuit", "pcb-substrate") -- These updates should be in data phase util.replace_some_ingredient("pcb-substrate", "plastic-bar", 1, "silica", 3, {force=true}) -if (not mods.bobelectronics and not mods.MDbobelectronics) then +if not (mods.bobelectronics or mods.MDbobelectronics or mods.MDbobelectronics2) then data:extend({ { type = "recipe", name = "pcb", results = { - {"pcb", 4}, + {type="item", name="pcb", amount=4}, }, ingredients = util.me.more() and { - {"pcb-substrate", 4}, - {"copper-plate", 1}, - {"ferric-chloride", 2}, + {type="item", name="pcb-substrate", amount=4}, + {type="item", name="copper-plate", amount=1}, + {type="item", name="ferric-chloride", amount=2}, {type="fluid", name="water", amount=20}, } or { - {"pcb-substrate", 4}, - {"copper-plate", 1}, - {type="fluid", name="hydrogen-chloride", amount=30} + {type="item", name="pcb-substrate", amount=4}, + {type="item", name="copper-plate", amount=1}, + {type="fluid", name=hcl_name, amount=30} }, enabled = false, category = "crafting-with-fluid", energy_required = 8, }, }) -util.add_unlock("advanced-electronics", "pcb") +util.add_unlock("advanced-circuit", "pcb") end diff --git a/prototypes/salt.lua b/prototypes/salt.lua index 04b8bf7..102045c 100644 --- a/prototypes/salt.lua +++ b/prototypes/salt.lua @@ -1,5 +1,4 @@ local resource_autoplace = require('resource-autoplace'); -local noise = require('noise'); local futil = require("util"); local util = require("data-util"); @@ -13,7 +12,6 @@ particle.name = "salt-particle" for i, picture in ipairs(particle.pictures) do local tint = {r=1, g=1, b=1, a=0} picture.tint = tint - picture.hr_version.tint = tint end data:extend({particle}) @@ -27,10 +25,6 @@ data:extend({ order = "b-e" }, { - type = "noise-layer", - name = "salt" - }, - { type = "resource", icon_size = 128, name = "salt", @@ -64,20 +58,12 @@ data:extend({ { sheet = { - filename = "__bzchlorine__/graphics/entity/ores/salt.png", - priority = "extra-high", - size = 64, - frame_count = 8, - variation_count = 8, - hr_version = - { - filename = "__bzchlorine__/graphics/entity/ores/hr-salt.png", - priority = "extra-high", - size = 128, - frame_count = 8, - variation_count = 8, - scale = 0.5 - } + filename = "__bzchlorine__/graphics/entity/ores/hr-salt.png", + priority = "extra-high", + size = 128, + frame_count = 8, + variation_count = 8, + scale = 0.5 } }, }, @@ -86,24 +72,24 @@ data:extend({ local richness = data.raw.resource["salt"].autoplace.richness_expression local probability = data.raw.resource["salt"].autoplace.probability_expression -if not util.me.starting_patch() then - -- Modify salt autoplace richness: - -- After 500 tiles it's standard - -- After 250 tiles it scales up - data.raw.resource["salt"].autoplace.richness_expression = - richness * noise.if_else_chain( - noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(500)), - (noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")) - 275)/475, - 1) - - data.raw.resource["salt"].autoplace.probability_expression = - probability * noise.if_else_chain( - noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(249)), - 0, - noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(250)), - 0.3, - 1) -end +--if not util.me.starting_patch() then +-- -- Modify salt autoplace richness: +-- -- After 500 tiles it's standard +-- -- After 250 tiles it scales up +-- data.raw.resource["salt"].autoplace.richness_expression = +-- richness * noise.if_else_chain( +-- noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(500)), +-- (noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")) - 275)/475, +-- 1) +-- +-- data.raw.resource["salt"].autoplace.probability_expression = +-- probability * noise.if_else_chain( +-- noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(249)), +-- 0, +-- noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(250)), +-- 0.3, +-- 1) +--end end data:extend({ @@ -113,20 +99,20 @@ data:extend({ icon_size = 128, icon = "__bzchlorine__/graphics/icons/salt.png", pictures = { - {filename="__bzchlorine__/graphics/icons/salt.png", size=128, scale=0.125}, - {filename="__bzchlorine__/graphics/icons/salt-1.png", size=128, scale=0.125}, - {filename="__bzchlorine__/graphics/icons/salt-2.png", size=128, scale=0.125}, - {filename="__bzchlorine__/graphics/icons/salt-3.png", size=128, scale=0.125}, - {filename="__bzchlorine__/graphics/icons/salt-4.png", size=128, scale=0.125}, + {filename="__bzchlorine__/graphics/icons/salt.png", size=128, scale=0.25}, + {filename="__bzchlorine__/graphics/icons/salt-1.png", size=128, scale=0.25}, + {filename="__bzchlorine__/graphics/icons/salt-2.png", size=128, scale=0.25}, + {filename="__bzchlorine__/graphics/icons/salt-3.png", size=128, scale=0.25}, + {filename="__bzchlorine__/graphics/icons/salt-4.png", size=128, scale=0.25}, }, subgroup = "raw-resource", order = "t-c-a", - stack_size = util.get_stack_size(50) + stack_size = 50 }, { type = "recipe", name = "salt", - result = "salt", + results = {{type="item", name="salt", amount=1}}, ingredients = {{type="fluid", name="water", amount=100}}, enabled = not not mods["aai-industry"], category = "crafting-with-fluid", @@ -138,10 +124,10 @@ if mods.Krastorio2 then { type = "recipe", name = "salt-filtration", - result = "salt", + results = {{type="item", name="salt", amount=1}}, ingredients = {{type="fluid", name="water", amount=100}}, enabled = false, - category = mods.Krastorio2 and "fluid-filtration", + category = mods.Krastorio2 and "kr-fluid-filtration", energy_required = 0.4, }, }) diff --git a/recipe-updates.lua b/recipe-updates.lua index 289a041..245cf95 100644 --- a/recipe-updates.lua +++ b/recipe-updates.lua @@ -23,7 +23,7 @@ util.add_ingredient("uranium-processing", "salt", 1) if mods.Krastorio2 or util.is_foundry() then util.replace_some_ingredient("steel-plate", "iron-plate", 1, "salt", 1) end -util.add_ingredient("kr-biomass-growing", "salt", 1) +util.add_ingredient("kr-biomass", "salt", 1) util.add_ingredient("kr-energy-storage", "ferric-chloride", 10) -- Space Exploration @@ -39,16 +39,16 @@ if not mods.Krastorio2 then util.add_product("se-iridium-powder", {type="fluid", name="chlorine", amount=19, catalyst_amount=19}) end -util.replace_some_ingredient("se-vitamelange-bloom", "sand", 10, "salt", 1) +util.replace_some_ingredient("se-vitamelange-bloom", mods["Krastorio2"] and "kr-sand" or "sand", 10, "salt", 1) util.add_ingredient("se-nutrient-gel", "salt", 1) util.add_ingredient("se-vitalic-epoxy", "epoxy", 16) util.multiply_recipe("se-space-water", 10) util.replace_some_ingredient("se-space-water", "water", 10, "salt", 1) -util.add_ingredient("se-bio-sludge-decontamination", "chlorine", 1) +util.add_ingredient("se-bio-sludge-decontamination", mods.Krastorio2 and "kr-chloring" or "chlorine", 1) util.add_ingredient("se-bio-electrics-data", "salt", 1) -util.add_ingredient("se-holmium-chloride", "hydrogen-chloride", 2) +util.add_ingredient("se-holmium-chloride", mods["Krastorio2"] and "kr-hydrogen-chloride" or "hydrogen-chloride", 2) util.replace_some_ingredient("se-space-coolant", "copper-plate", 1, "salt", 1) util.replace_some_ingredient("se-space-coolant-cryonite", "copper-plate", 1, "salt", 1)