diff --git a/Makefile b/Makefile index 11be59f..5b5cf20 100644 --- a/Makefile +++ b/Makefile @@ -24,10 +24,14 @@ copy: link mkdir -p ../$(v) cp -rf * ../$(v) rm -f ../$(v).zip - cd ..; zip -9 -r -y $(v).zip $(v) -x "*.xcf" -x "*.git*" -x "*.bak" -x "*.blend*" + #cd ..; zip -9 -r -y $(v).zip $(v) -x "*.xcf" -x "*.git*" -x "*.bak" -x "*.blend*" install: lint-changelog copy - cp -f ../$(v).zip ../../mods/ + # Next 3 lines are dev only (uncomment zip lines and comment these) + rm -rf ../../mods/$(v) + mkdir ../../mods/$(v) + cp -r * ../../mods/$(v) + #cp -f ../$(v).zip ../../mods/ lint-changelog: copy python3 ../da-changelog-tools_0.0.14/changelog-checker.py --changelog ../$(v).zip diff --git a/carbon-fiber-recipe-updates.lua b/carbon-fiber-recipe-updates.lua index d7bf6e6..a115cd9 100644 --- a/carbon-fiber-recipe-updates.lua +++ b/carbon-fiber-recipe-updates.lua @@ -1,12 +1,12 @@ local util = require("data-util"); if util.me.use_fiber() then - util.replace_ingredient("low-density-structure", "plastic-bar", "carbon-fiber") - util.replace_ingredient("se-low-density-structure-beryllium", "plastic-bar", "carbon-fiber") - util.replace_ingredient("combat-shotgun", "wood", "carbon-fiber") - - util.add_ingredient("exoskeleton-equipment", "carbon-fiber", 10) - + if not mods["space-age"] then + util.replace_ingredient("low-density-structure", "plastic-bar", "carbon-fiber") + util.replace_ingredient("se-low-density-structure-beryllium", "plastic-bar", "carbon-fiber") + util.add_ingredient("exoskeleton-equipment", "carbon-fiber", 10) + util.replace_ingredient("combat-shotgun", "wood", "carbon-fiber") + end util.replace_some_ingredient("flying-fortress", util.titanium_plate, 1000, "carbon-fiber", 2000) util.replace_some_ingredient("flying-fortress", "steel-plate", 1000, "carbon-fiber", 2000) end diff --git a/carbon-fiber.lua b/carbon-fiber.lua deleted file mode 100644 index fb80c2d..0000000 --- a/carbon-fiber.lua +++ /dev/null @@ -1,90 +0,0 @@ -local util = require("data-util"); - -if util.me.use_fiber() then -data:extend({ - { - type = "item", - name = "polyacrylonitrile", - icon = "__bzcarbon__/graphics/icons/pan.png", - icon_size = 128, - subgroup = "intermediate-product", - order = "g[graphite-acrylic-fiber]", - stack_size = util.get_stack_size(100), - }, - { - type = "recipe", - name = "polyacrylonitrile", - category = "chemistry", - order = "d[graphite-carbon-fiber]", - enabled = false, - energy_required = 1, - ingredients = data.raw.fluid["ammonia"] and - { - {type="fluid", name="petroleum-gas", amount=5}, - {type="fluid", name="ammonia", amount=5}, - } or { - {type="fluid", name="petroleum-gas", amount=10}, - }, - results = { - {type="item", name= "polyacrylonitrile", amount=1}, - }, - }, -}) - -data:extend({ - { - type = "item", - name = "carbon-fiber", - icon = "__bzcarbon__/graphics/icons/carbon-fiber.png", - icon_size = 128, - subgroup = "intermediate-product", - order = "g[graphite-carbon-fiber]", - stack_size = util.get_stack_size(100), - }, - { - type = "recipe", - name = "carbon-fiber", - category = "advanced-crafting", - order = "d[graphite-carbon-fiber]", - enabled = false, - energy_required = 24, - ingredients = { - {type="fluid", name="epoxy", amount = 20}, - {"plastic-bar", 2}, - {"polyacrylonitrile", 4}, - }, - results = { - {type="item", name= "carbon-fiber", amount=8}, - }, - }, -}) -util.replace_some_ingredient("carbon-fiber", "plastic", 1, "silica", 2, {force=true}) -data:extend({ - { - type = "technology", - name = "carbon-fiber", - icon_size = 256, - icon = "__bzcarbon__/graphics/technology/carbon-fiber.png", - effects = { - {type="unlock-recipe", recipe="polyacrylonitrile"}, - {type="unlock-recipe", recipe="carbon-fiber"}, - }, - unit = - { - count = 30, - ingredients = - { - {"automation-science-pack", 1}, - {"logistic-science-pack", 1}, - {"chemical-science-pack", 1}, - }, - time = 10, - }, - prerequisites = {"chemical-science-pack", "plastics"}, - order = "b-b" - }, -}) - util.add_prerequisite("low-density-structure", "carbon-fiber") - util.add_prerequisite("exoskeleton-equipment", "carbon-fiber") - util.add_prerequisite("military-3", "carbon-fiber") -end diff --git a/carbon-recipe-final-stacking.lua b/carbon-recipe-final-stacking.lua index 11f021d..b57cf81 100644 --- a/carbon-recipe-final-stacking.lua +++ b/carbon-recipe-final-stacking.lua @@ -2,7 +2,7 @@ local util = require("data-util"); -if deadlock then +if deadlock and deadlock["add_stack"] then deadlock.add_stack("flake-graphite", "__bzcarbon__/graphics/icons/stacked/flake-graphite-stacked.png", "deadlock-stacking-1", 64) deadlock.add_stack("graphite", "__bzcarbon__/graphics/icons/stacked/graphite-stacked.png", "deadlock-stacking-1", 128) deadlock.add_stack("diamond", "__bzcarbon__/graphics/icons/stacked/diamond-stacked.png" , "deadlock-stacking-2", 128) diff --git a/carbon-recipe-modules.lua b/carbon-recipe-modules.lua deleted file mode 100644 index cde8d58..0000000 --- a/carbon-recipe-modules.lua +++ /dev/null @@ -1,26 +0,0 @@ --- Enable prod modules for all recipes -local util = require("data-util"); - -local recipes = util.me.recipes - --- Add all *-nanotubes recipes that exist -local ending = "-nanotubes" -for i, recipe in pairs(data.raw.recipe) do - if recipe.name:sub(-#ending) == ending then - table.insert(recipes, recipe.name) - end -end - -for i, recipe in pairs(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 - end -end diff --git a/carbon-recipe-updates.lua b/carbon-recipe-updates.lua index 77aea7a..559e634 100644 --- a/carbon-recipe-updates.lua +++ b/carbon-recipe-updates.lua @@ -21,6 +21,9 @@ end util.add_effect("advanced-material-processing-2", {type="unlock-recipe", recipe="crucible"}) for i, ingredient in pairs(util.me.crucible_ingredients) do util.add_ingredient("crucible", ingredient, 5) + if data.raw.item[ingredient] then + util.add_to_product("crucible", "crucible", 1) + end end for i, furnace in pairs(util.me.furnaces) do util.add_ingredient(furnace, "crucible", 1) @@ -29,6 +32,21 @@ for i, furnace in pairs(util.me.furnaces) do end end +-- space age +if mods["space-age"] then + util.add_ingredient("big-mining-drill", "diamond", 10) + util.add_prerequisite("big-mining-drill", "diamond-processing-2") + util.replace_ingredient("quantum-processor", "tungsten-carbide", "diamond", 2) + if data.raw.fluid["vacuum"] then + util.add_ingredient("graphite-synthesis", "vacuum", 4) + end + util.remove_product("scrap-recycling", "solder") + util.add_product("scrap-recycling", util.item("rough-diamond", 1, .01)) + util.set_product_probability("scrap-recycling", "processing-unit", 0.03) + util.add_ingredient("cryogenic-plant", "graphene", 20) + util.add_ingredient("fluoroketone", "graphene", 1) +end + -- fullerenes & nanotubes if util.me.use_fullerenes() then util.add_prerequisite("graphene", "fullerenes") @@ -37,6 +55,10 @@ if util.me.use_fullerenes() then if not mods.Krastorio2 then util.replace_some_ingredient("slowdown-capsule", "coal", 4, "fullerenes", 40) end + util.add_ingredient("capture-bot-rocket", "fullerenes", 10) + util.add_ingredient("biolab", "fullerenes", 50) + util.add_ingredient("overgrowth-yumako-soil", "fullerenes", 50) + util.add_ingredient("overgrowth-jellynut-soil", "fullerenes", 50) -- K2 util.add_ingredient("kr-biter-virus", "fullerenes", 100) @@ -56,10 +78,13 @@ if util.me.use_carbon_black() then -- Plastic from carbon black, carbon black from oil processing util.replace_ingredient("plastic-bar", "coal", "carbon-black") - util.add_product("basic-oil-processing", {"carbon-black", 1}) - util.add_product("advanced-oil-processing", {"carbon-black", 1}) - util.add_product("light-oil-cracking", {"carbon-black", 1}) - util.add_product("heavy-oil-cracking", {"carbon-black", 1}) + util.add_product("basic-oil-processing", util.item("carbon-black", 1)) + util.add_product("advanced-oil-processing", util.item("carbon-black", 1)) + util.add_product("light-oil-cracking", util.item("carbon-black", 1)) + util.add_product("heavy-oil-cracking", util.item("carbon-black", 1)) + -- More outlets for carbon black now, so can make it here too + util.add_product("simple-coal-liquefaction", util.item("carbon-black", 1)) + util.add_product("coal-liquefaction", util.item("carbon-black", 1)) --K2 if mods.bztitanium then @@ -91,7 +116,8 @@ elseif data.raw.recipe["speed-module-4"] then util.add_ingredient("productivity-module-4", "diamond", 6) else util.add_ingredient("speed-module-2", "diamond", 1) - util.add_ingredient("effectivity-module-2", "diamond", 1) + util.add_ingredient("efficiency-module-2", "diamond", 1) + util.add_ingredient("quality-module-2", "diamond", 1) util.add_ingredient("productivity-module-2", "diamond", 1) end util.add_ingredient("laser-turret", "diamond", 1) diff --git a/carbon-recipe.lua b/carbon-recipe.lua index 3fd3fd3..b8938d3 100644 --- a/carbon-recipe.lua +++ b/carbon-recipe.lua @@ -4,6 +4,9 @@ local graphite_category = "advanced-crafting" if mods["space-exploration"] then graphite_category = "pulverising" end +if mods["space-age"] then + graphite_category = "basic-crushing" +end if mods.Krastorio2 then graphite_category = "crushing" end @@ -19,12 +22,13 @@ data:extend({ icon = "__bzcarbon__/graphics/icons/graphite.png", icon_size = 128, pictures = { - {filename="__bzcarbon__/graphics/icons/graphite.png", size=128, scale=0.125}, - {filename="__bzcarbon__/graphics/icons/graphite-1.png", size=128, scale=0.125}, - {filename="__bzcarbon__/graphics/icons/graphite-2.png", size=128, scale=0.125}, + {filename="__bzcarbon__/graphics/icons/graphite.png", size=128, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/graphite-1.png", size=128, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/graphite-2.png", size=128, scale=0.25}, }, subgroup = "raw-material", order = "g[graphite]", + weight = 1*kg, stack_size = util.get_stack_size(100) }, { @@ -35,28 +39,28 @@ data:extend({ icons = (mods["Krastorio2"] and { { icon = "__bzcarbon__/graphics/icons/graphite.png", icon_size = 128}, - { icon = "__bzcarbon__/graphics/icons/flake-graphite.png", icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}}, + { icon = "__bzcarbon__/graphics/icons/flake-graphite.png", icon_size = 128, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}}, } or nil), - normal = (mods["Krastorio2"] and - { - enabled = false, - energy_required = 5, - ingredients = {{"flake-graphite", 10}}, - results = {{type="item", name= "graphite", amount=10}}, - } or - { - enabled = false, - energy_required = 0.5, - ingredients = {{"flake-graphite", 1}}, - result = "graphite" - }), - expensive = - { - enabled = false, - energy_required = 1, - ingredients = {{"flake-graphite", 2}}, - result = "graphite" - } + -- normal = (mods["Krastorio2"] and + -- { + -- enabled = false, + -- energy_required = 5, + -- ingredients = {util.item("flake-graphite", 10)}, + -- results = {{type="item", name= "graphite", amount=10}}, + -- } or + + enabled = false, + allow_productivity=true, + energy_required = 0.5, + ingredients = {util.item("flake-graphite", 1)}, + results = {util.item("graphite")}, + -- expensive = + -- { + -- enabled = false, + -- energy_required = 1, + -- ingredients = {util.item("flake-graphite", 2)}, + -- result = "graphite" + -- } }, { type = "technology", @@ -90,8 +94,8 @@ if not util.me.use_flake_graphite() then order = "d[graphite]", enabled = false, energy_required = 0.5, - ingredients = {{"coke", 1}}, - results = {{"graphite", 2}}, + ingredients = {util.item("coke", 1)}, + results = {util.item("graphite", 2)}, } }) else @@ -105,8 +109,8 @@ if not util.me.use_flake_graphite() then order = "d[graphite]", enabled = false, energy_required = 0.5, - ingredients = {{"coal", 1}}, - results = {{"graphite", 1}, {type="item", name="stone", amount=1, probability=0.05}}, + ingredients = {util.item("coal", 1)}, + results = {util.item("graphite", 1), {type="item", name="stone", amount=1, probability=0.05}}, } }) end @@ -124,7 +128,7 @@ end if mods.Krastorio2 then util.add_prerequisite("graphite-processing", "kr-crusher") else - util.add_prerequisite("graphite-processing", "automation") + -- util.add_prerequisite("graphite-processing", "automation") end @@ -138,8 +142,8 @@ data:extend({ order = "d[graphite]", enabled = false, energy_required = 0.5, - ingredients = {{"flake-graphite", 2}}, - result = "graphite" + ingredients = {util.item("flake-graphite", 2)}, + results = {util.item("graphite")}, } }) util.add_effect("graphite-processing", { type = "unlock-recipe", recipe = "graphite-se" }) @@ -157,8 +161,8 @@ data:extend({ order = "d[graphite]", enabled = true, energy_required = 0.5, - ingredients = {{"flake-graphite", 1}}, - results = {{"graphite", 2}}, + ingredients = {util.item("flake-graphite", 1)}, + results = {util.item("graphite", 2)}, } }) end @@ -172,6 +176,7 @@ data:extend({ icon_size = 128, subgroup = "raw-material", order = "g[diamond]", + weight = 4*kg, stack_size = util.get_stack_size(100) }, { @@ -179,31 +184,23 @@ data:extend({ name = "synthetic-diamond", category = "diamond-synthesis", order = "d[diamond]", - icons = (mods["Krastorio2"] and + icons = (util.me.use_rough_diamond() and { { icon = "__bzcarbon__/graphics/icons/diamond.png", icon_size = 128}, { icon = "__bzcarbon__/graphics/icons/graphite-2.png", icon_size = 128, scale=0.125, shift= {-8, -8}}, } or nil), - normal = (mods["Krastorio2"] and - { - enabled = false, - energy_required = 20, - ingredients = {{"graphite", 10}}, - results = {{type="item", name= "diamond", amount=1}}, - } or - { - enabled = false, - energy_required = 20, - ingredients = {{"graphite", 10}}, - result = "diamond" - }), - expensive = - { - enabled = false, - energy_required = 30, - ingredients = {{"graphite", 20}}, - result = "diamond" - } + allow_productivity=true, + enabled = false, + energy_required = 20, + ingredients = {util.item("graphite", mods["space-age"] and 20 or 10)}, + results = {util.item("diamond")}, + -- expensive = + -- { + -- enabled = false, + -- energy_required = 30, + -- ingredients = {util.item("graphite", 20)}, + -- result = "diamond" + -- } }, util.me.use_rough_diamond() and { type = "recipe", @@ -216,32 +213,31 @@ data:extend({ { icon = "__bzcarbon__/graphics/icons/diamond.png", icon_size = 128}, { icon = "__bzcarbon__/graphics/icons/rough-diamond.png", icon_size = 64, scale=0.25, shift= {-8, -8}}, } or {{ icon = "__bzcarbon__/graphics/icons/diamond.png", icon_size = 128}}), - normal = (mods["Krastorio2"] and - { - enabled = false, - energy_required = 20, - ingredients = {{"rough-diamond", 1}}, - results = { - {type="item", name= "diamond", amount=1, probability=0.8}, - {type="item", name= "stone", amount=1, probability=0.2} - }, - } or - { - enabled = false, - energy_required = 20, - ingredients = {{"rough-diamond", 1}}, - results = { - {type="item", name= "diamond", amount=1, probability=0.8}, - {type="item", name= "stone", amount=1, probability=0.2} - }, - }), - expensive = - { - enabled = false, - energy_required = 40, - ingredients = {{"rough-diamond", 1}}, - result = "diamond" - } + -- normal = (mods["Krastorio2"] and + -- { + -- enabled = false, + -- energy_required = 20, + -- ingredients = {util.item("rough-diamond", 1)}, + -- results = { + -- {type="item", name= "diamond", amount=1, probability=0.8}, + -- {type="item", name= "stone", amount=1, probability=0.2} + -- }, + -- } or + enabled = false, + allow_productivity=true, + energy_required = 20, + ingredients = {util.item("rough-diamond", 1)}, + results = { + {type="item", name= "diamond", amount=1, probability=0.8}, + {type="item", name= "stone", amount=1, probability=0.2} + }, + -- expensive = + -- { + -- enabled = false, + -- energy_required = 40, + -- ingredients = {util.item("rough-diamond", 1)}, + -- result = "diamond" + -- } } or nil, }) data:extend({ @@ -256,7 +252,7 @@ data:extend({ type = "unlock-recipe", recipe = "synthetic-diamond" }, - util.me.use_rough_diamond() and { + util.me.use_rough_diamond() and not mods["space-age"] and { type = "unlock-recipe", recipe = "diamond-processing" } or nil, @@ -285,6 +281,7 @@ data:extend({ icon_size = 128, subgroup = "intermediate-product", order = "g[graphite]", + weight = 2*kg, stack_size = util.get_stack_size(200) }, { @@ -293,8 +290,9 @@ data:extend({ category = "chemistry", order = "d[graphite]", enabled = false, + allow_productivity=true, energy_required = 6, - ingredients = mods.Krastorio2 and { + ingredients = (mods["space-age"] or mods.Krastorio2) and { {type="item", name="graphite", amount=1}, {type="fluid", name="ammonia", amount=5}, {type="fluid", name="sulfuric-acid", amount=5}, @@ -303,7 +301,7 @@ data:extend({ {type="fluid", name="water", amount=10}, {type="fluid", name="sulfuric-acid", amount=10}, }, - result = "graphene" + results = {util.item("graphene")}, }, { type = "technology", @@ -338,6 +336,16 @@ data:extend({ order = "b-b" }, }) +if mods["space-age"] then + util.set_prerequisite("graphene", {"agricultural-science-pack"}) + util.set_tech_recipe("graphene", { + {"automation-science-pack", 1}, + {"logistic-science-pack", 1}, + {"chemical-science-pack", 1}, + {"agricultural-science-pack", 1}, + }) +end + -- fullerenes if util.me.use_fullerenes() then @@ -349,14 +357,16 @@ data:extend({ icon_size = 128, subgroup = "intermediate-product", order = "g[graphite-fullerenes]", + weight = 2*kg, stack_size = util.get_stack_size(200), }, { type = "recipe", name = "fullerenes", - category = "chemistry", + category = mods["space-age"] and "electronics-or-assembling" or "advanced-crafting", order = "d[graphite-fullerenes]", enabled = false, + allow_productivity=true, energy_required = 1, ingredients = mods.Krastorio2 and { @@ -366,8 +376,7 @@ data:extend({ { {type="item", name="graphite", amount=2}, }, - result = "fullerenes", - result_count = 20, + results = {util.item("fullerenes", 20)}, }, { type = "technology", @@ -402,6 +411,7 @@ data:extend({ icon_size = 128, subgroup = "intermediate-product", order = "g[graphite-nanotubes]", + weight = 2*kg, stack_size = util.get_stack_size(200), }, { @@ -414,6 +424,7 @@ data:extend({ subgroup = "intermediate-product", order = "d[graphite-nanotubes]", enabled = false, + allow_productivity=true, energy_required = 20, ingredients = { {type="item", name="fullerenes", amount=1}, @@ -477,6 +488,7 @@ data:extend({ icon_size = 64, icon_mipmaps = 3, subgroup = "intermediate-product", order = "g[graphite-carbon-black]", + weight = 1*kg, stack_size = util.get_stack_size(100), }, { @@ -487,6 +499,7 @@ data:extend({ category = "chemistry", order = "d[graphite-carbon-black]", enabled = false, + allow_productivity=true, energy_required = 1, ingredients = { {type="item", name="coal", amount=1}, @@ -505,12 +518,12 @@ data:extend({ category = "chemistry", order = "d[graphite]", enabled = false, + allow_productivity=true, energy_required = 1, ingredients = { {type="item", name="carbon-black", amount=10}, }, - result = "graphite", - result_count = 1, + results = {util.item("graphite", 1)}, }, }) end @@ -523,6 +536,7 @@ data:extend({ icon = "__bzcarbon__/graphics/icons/crucible.png", icon_size = 128, subgroup = "intermediate-product", order = "g[crucible]", + weight = 4*kg, stack_size = 50, }, { @@ -531,12 +545,12 @@ data:extend({ category = "crafting", order = "d[graphite]", enabled = false, + allow_productivity=true, energy_required = 3, ingredients = { {type="item", name="graphite", amount=5}, }, - result = "crucible", - result_count = 1, + results = {util.item("crucible", 1)}, }, }) @@ -557,3 +571,84 @@ if mods["space-exploration"] and string.sub(mods["space-exploration"], 1, 3) == util.set_item_subgroup("fullerenes", "carbon") util.set_item_subgroup("nanotubes", "carbon") end + +-- Set early tech tree +util.set_tech_trigger("graphite-processing", {type = "mine-entity", entity = "graphite"}) +util.add_prerequisite("graphite-processing", "steam-power") + +if mods["space-age"] then + data:extend({ + { + type = "surface-property", + name = "oxygen", + default_value = 19, + }, + -- make graphite from diamonds on some surfaces + { + type = "recipe", + name = "graphitization", + icons = { + {icon = "__bzcarbon__/graphics/icons/graphite.png", icon_size = 128}, + {icon = "__bzcarbon__/graphics/icons/rough-diamond.png", icon_size = 128, scale = 0.125, shift={-8,-8}}, + }, + category = "smelting", + order = "d[graphite]", + enabled = false, + allow_productivity=true, + energy_required = 16, + surface_conditions = { + {property = "oxygen", max = 20}, + }, + ingredients = { + {type="item", name="rough-diamond", amount=1}, + }, + show_amount_in_title = false, + results = {util.item("graphite", 10)}, + }, + { + type = "technology", + name = "diamond-processing-2", + icon_size = 128, + icon = "__bzcarbon__/graphics/icons/diamond.png", + effects = + { + { + type = "unlock-recipe", + recipe = "graphitization" + }, + { + type = "unlock-recipe", + recipe = "diamond-processing" + }, + }, + research_trigger = { + type = "mine-entity", + entity = "diamond", + }, + prerequisites = {"planet-discovery-vulcanus"}, + order = "b-b" + }, + -- Graphite from spoilage via carbon + { + type = "recipe", + name = "graphite-synthesis", + category = "organic-or-chemistry", + order = "d[graphite]", + enabled = false, + allow_productivity=true, + energy_required = 8/3, + ingredients = { + {type="item", name="carbon", amount=1}, + }, + results = {util.item("graphite", 1)}, + }, + }) + util.add_unlock("biochamber", "graphite-synthesis") + util.set_recipe_time("burnt-spoilage", 4) + util.set_surface_property("nauvis", "oxygen", 21) + util.set_surface_property("gleba", "oxygen", 30) + util.set_surface_property("fulgora", "oxygen", 15) + util.set_surface_property("vulcanus", "oxygen", 12) + util.set_surface_property("aquilo", "oxygen", 10) + util.set_surface_property("space-platform", "oxygen", 0) +end diff --git a/carbon-util.lua b/carbon-util.lua index 5e50e7a..47c9acf 100644 --- a/carbon-util.lua +++ b/carbon-util.lua @@ -11,6 +11,7 @@ function cutil.nanotube_recipe(recipe_name, item_name, tech) local new_recipe = futil.table.deepcopy(data.raw.recipe[recipe_name]) new_recipe.name = recipe_name.."-nanotubes" + new_recipe.localised_name = {"item-name."..item_name} new_recipe.icons = { { icon = data.raw.item[item_name].icon, icon_size = data.raw.item[item_name].icon_size}, { icon = "__bzcarbon__/graphics/icons/nanotube.png", icon_size = 128, scale=0.125, shift= {-8, -8}}, diff --git a/changelog.txt b/changelog.txt index 0e75a80..05f2139 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,14 @@ --------------------------------------------------------------------------------------------------- +Version: 2.0.0 +Date: 2025-01-21 + Changes: + - Update to Factorio 2.0 and Space Age, can be added to existing games. + Use /bz-regenerate to see help on regenerating ore patches (especially useful on Vulcanus) + - Space Age: Diamond ore patches are only on Vulcanus. Graphite is on Nauvis + - Updates to Space Age carbon fiber (Note: 2.0 vanilla carbon fiber is not yet available) + - New graphics for flake graphite, rough diamonds and some other items. + - Improved graphics for graphite and diamond ore patches. +--------------------------------------------------------------------------------------------------- Version: 0.5.9 Date: 2024-02-17 Fixes: diff --git a/control-util.lua b/control-util.lua index 9000745..c21f3aa 100644 --- a/control-util.lua +++ b/control-util.lua @@ -2,6 +2,8 @@ local me = require("me") local util = {} util.me = me +local regenerate_command = "bz-regenerate" +local list_command = "bz-list" function decode(data) if type(data) == "string" then return data end @@ -12,8 +14,22 @@ function decode(data) return table.concat(str, "") end -function util.get_list() - local p = game.item_prototypes[me.name.."-list"] +function util.check_fluid_mining() + if me.fluid_mining then + for i, force in pairs(game.forces) do + if ( + (force.technologies["uranium-processing"] and force.technologies["uranium-processing"].researched) or + (force.technologies["titanium-processing"] and force.technologies["titanium-processing"].researched) or + false + ) then + force.technologies["fluid-mining"].researched = true + end + end + end +end + +function get_list() + local p = prototypes.item[me.name.."-list"] if p then data = p.localised_description return decode(data) @@ -26,6 +42,39 @@ function util.force_enable_recipe(event, recipe_name) end end +function list(event) + if event.command and string.lower(event.command) == "bz-list" then + local player = game.players[event.player_index] + if player and player.connected then + local list = get_list() + if list and #list>0 then + local filename = util.me.name..".txt" + helpers.write_file(filename, list, false, event.player_index) + player.print("Wrote recipes to script-output/"..filename) + else + player.print("Please change your mod startup setting for this mod's modified recipes list.") + end + end + end +end + +function util.add_command_handler() + script.on_event(defines.events.on_console_command, route) +end + +function route(event) + if event.command == regenerate_command then regenerate_ore(event) end + if event.command == list_command then list(event) end +end + +function util.add_list_command_handler() + util.add_command_handler() + + if not commands.commands[list_command] then + commands.add_command(list_command, "", function() end) + end +end + function util.warptorio2_expansion_helper() if script.active_mods["warptorio2_expansion"] then @@ -81,6 +130,169 @@ function util.warptorio2_expansion_helper() end end +local usage_regenerate = [[ +Recommend saving the game before running this command. +Usage: /bz-regenerate all +or /bz-regenerate [ ] + planet must be an internal name like nauvis + resource must be an internal name like lead-ore or titanium-ore + frequency, size, and richness are optional, but all or none must be provided, and each should be a number between 0.166 and 6, where 1 is default setting. +Regenerates ore patches. If frequency/size/richness are provided, the planet will use those settings from now on, as well. + - Separate arguments with spaces, do not use < >, [ ], quotes or other symbols + - This action can take a while for larger maps! + - Ores can sometimes overlap on regeneration. This can sometimes hide ore patches. If none seem to be made for a resource, regenerate just that resource and tweak frequency/size. +]] +function util.add_regenerate_command_handler() + util.add_command_handler() + + if not commands.commands[regenerate_command] then + commands.add_command( regenerate_command, usage_regenerate, function() end) + end +end + +function regenerate_ore(event) + if event.command == regenerate_command then + local params = {} + for w in event.parameters:gmatch("%S+") do table.insert(params, w) end + if #params == 1 and params[1] == "all" then + for _, resource in pairs(me.resources) do + if prototypes.entity[resource[1]] then + game.print("Regenerating "..resource[1]) + game.regenerate_entity(resource[1]) + end + end + return + end + if not (#params == 2 or #params == 5) then + game.print(usage_regenerate) + return + end + local planet = params[1] + for _, resource in pairs(me.resources) do + if not game.surfaces[planet] then + game.print("Could not find surface for "..planet..". May not exist, or may not yet be explored.") + return + end + if resource[1] == params[2] and resource[2] == planet then + if #params == 5 then + local settings = {frequency=params[3], size=params[4], richness=params[5]} + local map_gen_settings = game.surfaces[planet].map_gen_settings + map_gen_settings.autoplace_controls[resource[1]] = settings + map_gen_settings.autoplace_settings.entity.settings[resource[1]] = settings + game.surfaces[planet].map_gen_settings = map_gen_settings + game.print("Set "..resource[1].." on "..planet.." to "..serpent.line(settings)) + end + game.print("Regenerating "..resource[1]) + game.surfaces[planet].regenerate_entity(resource[1]) + end + end + end +end + +function util.ore_fix() + ore_fix("nauvis") + ore_fix("vulcanus") + if game.surfaces.tenebris then + ore_fix("tenebris") + end +end + +function ore_fix(surface_name) + for _, resource in pairs(me.resources) do + if resource[2] == surface_name then + if game.surfaces[resource[2]] then + local map_gen_settings = game.surfaces[surface_name].map_gen_settings + if map_gen_settings.autoplace_controls[resource[1]] == nil then + map_gen_settings.autoplace_controls[resource[1]] = {} + end + if map_gen_settings.autoplace_settings.entity.settings[resource[1]] == nil then + map_gen_settings.autoplace_settings.entity.settings[resource[1]] = {} + end + game.surfaces[surface_name].map_gen_settings = map_gen_settings + end + end + end +end + + +-- A workaround for generating ores until this bug is fixed: +-- https://forums.factorio.com/viewtopic.php?f=7&t=124996&p=655013#p655013 +function util.ore_workaround(event) + for i, ore in pairs(util.me.ores_for_workaround) do + if ( + event.surface and + event.surface.map_gen_settings and + event.surface.map_gen_settings.autoplace_controls and + event.surface.map_gen_settings.autoplace_controls["titanium-ore"] + ) then + return + end + if event.surface.name ~= "nauvis" then return end + if math.random() < settings.global[util.me.name.."-ore-workaround-probability"].value then + util.generate_ore(event, ore.name, ore.amount, ore.tiles) + end + end +end + +-- The majority of this function was written by Eradicator, see https://forums.factorio.com/viewtopic.php?t=72723 +function util.generate_ore(event, name, amount, tiles) + local biases = {[0] = {[0] = 1}} + local t = 1 + + repeat + t = t + util.grow(biases,t,tiles) + until t >= tiles + + local pos = {x=event.position.x*32, y=event.position.y*32} + local multiplier = math.max(math.abs(event.position.x), math.abs(event.position.y)) + if multiplier < 10 then return end -- don't generate too close to start + local total_bias = 0 + for x,_ in pairs(biases) do for y,bias in pairs(_) do + total_bias = total_bias + bias + end end + + for x,_ in pairs(biases) do for y,bias in pairs(_) do + local entity = { + name = name, + amount = amount * (bias/total_bias) * multiplier, + force = 'neutral', + position = {pos.x+x,pos.y+y}, + } + if event.surface.can_place_entity(entity) then + event.surface.create_entity(entity) + end + end end + +end + +-- The majority of this function was written by Eradicator, see https://forums.factorio.com/viewtopic.php?t=72723 +function util.grow(grid,t,tiles) + local w_max = 256 + local h_max = 256 + local abs = math.abs + local old = {} + local new_count = 0 + for x,_ in pairs(grid) do for y,__ in pairs(_) do + table.insert(old,{x,y}) + end end + for _,pos in pairs(old) do + local x,y = pos[1],pos[2] + local bias = grid[x][y] + for dx=-1,1,1 do for dy=-1,1,1 do + local a,b = x+dx, y+dy + if (math.random() > 0.9) and (abs(a) < w_max) and (abs(b) < h_max) then + grid[a] = grid[a] or {} + if not grid[a][b] then + grid[a][b] = 1 - (t/tiles) + new_count = new_count + 1 + if (new_count+t) == tiles then return new_count end + end + end + end end + end + return new_count + end + return util diff --git a/control.lua b/control.lua index 4c5d275..5f8af1e 100644 --- a/control.lua +++ b/control.lua @@ -1,18 +1,9 @@ local util = require("control-util") -function on_console_chat(event) - if event.message and string.lower(event.message) == "bzlist" then - local player = game.players[event.player_index] - if player and player.connected then - local list = util.get_list() - if list and #list>0 then - local filename = util.me.name..".txt" - game.write_file(filename, list, false, event.player_index) - player.print("Wrote recipes to script-output/"..filename) - end - end - end -end -script.on_event(defines.events.on_console_chat, on_console_chat) +script.on_init(util.check_fluid_mining) +script.on_event(defines.events.on_console_command, util.list) +script.on_configuration_changed(util.ore_fix) +util.add_list_command_handler() +util.add_regenerate_command_handler() util.warptorio2_expansion_helper() diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 5ba00ea..333f854 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -2,12 +2,28 @@ require("carbon-recipe-final-stacking") require("carbon-recipe-final-k2") require("carbon-recipe-final-se") require("carbon-recipe-final-rrr") -require("low-density-structure-nanotubes") +require("nanotubes-final") require("compatibility/vtkdeepcoremining") -require("carbon-recipe-modules") -- Should be last import, need in both updates and final-fixes +local futil = require("util") local util = require("data-util"); +-- supercapacitors with graphene cloned from supercapacitors with activated carbon +if data.raw.recipe["supercapacitor"] then + local new_recipe = futil.table.deepcopy(data.raw.recipe["supercapacitor"]) + new_recipe.name = new_recipe.name.."-graphene" + new_recipe.localised_name = {"item-name.supercapacitor"} + new_recipe.icons = { + { icon = data.raw.item["supercapacitor"].icon, icon_size = data.raw.item["supercapacitor"].icon_size}, + { icon = "__bzcarbon__/graphics/icons/graphene.png", icon_size = 128, scale=0.125, shift= {-8, -8}, tint={1,1,1}}, + } + new_recipe.icon = nil + new_recipe.icon_size = nil + data:extend({new_recipe}) + util.replace_ingredient(new_recipe.name, "activated-carbon", "graphene", 1) + util.add_unlock("electromagnetic-plant", new_recipe.name) +end + -- Green circuits in final fixes due to K2 shenanigans if mods.MDbobelectronics or mods.bobelectronics then @@ -93,34 +109,29 @@ util.remove_ingredient("electric-furnace", "cuw") -- support new tungsten -- Vanilla burner phase tweaks -- green circuits after electronics if not mods.Krastorio2 and not mods["aai-industry"] and not mods.bzaluminum then - util.replace_ingredient("offshore-pump", "electronic-circuit", "copper-cable") - util.replace_ingredient("lab", "electronic-circuit", "copper-cable") - util.replace_ingredient("electric-mining-drill", "electronic-circuit", "copper-cable") - util.replace_ingredient("assembling-machine-1", "electronic-circuit", "copper-plate") - util.replace_ingredient("radar", "electronic-circuit", "copper-plate") - util.replace_ingredient("splitter", "electronic-circuit", "copper-cable", 20) + util.replace_ingredient("electric-mining-drill", "electronic-circuit", "copper-cable", 6) + + -- Most of this can go post 2.0 + -- util.replace_ingredient("offshore-pump", "electronic-circuit", "copper-cable") + -- util.replace_ingredient("lab", "electronic-circuit", "copper-cable") + -- util.replace_ingredient("assembling-machine-1", "electronic-circuit", "copper-plate") + -- util.replace_ingredient("radar", "electronic-circuit", "copper-plate") + -- util.replace_ingredient("splitter", "electronic-circuit", "copper-cable", 20) -- Keep repair pack raw ingredients the same: - util.remove_ingredient("repair-pack", "electronic-circuit") - util.add_ingredient("repair-pack", "copper-cable", 6) - util.set_ingredient("repair-pack", "iron-gear-wheel", 3) + -- util.remove_ingredient("repair-pack", "electronic-circuit") + -- util.add_ingredient("repair-pack", "copper-cable", 6) + -- util.set_ingredient("repair-pack", "iron-gear-wheel", 3) - util.add_effect("electronics", { type = "unlock-recipe", recipe = "electronic-circuit" }) - util.add_effect("electronics", { type = "unlock-recipe", recipe = "inserter" }) - util.add_effect("electronics", { type = "unlock-recipe", recipe = "long-handed-inserter" }) - util.remove_recipe_effect("automation", "long-handed-inserter") - util.set_enabled("electronic-circuit", false) - util.set_enabled("inserter", false) - util.add_prerequisite("logistic-science-pack", "electronics") + -- util.add_effect("electronics", { type = "unlock-recipe", recipe = "electronic-circuit" }) + -- util.add_effect("electronics", { type = "unlock-recipe", recipe = "inserter" }) + -- util.add_effect("electronics", { type = "unlock-recipe", recipe = "long-handed-inserter" }) + -- util.remove_recipe_effect("automation", "long-handed-inserter") + -- util.set_enabled("electronic-circuit", false) + -- util.set_enabled("inserter", false) + -- util.add_prerequisite("logistic-science-pack", "electronics") end -if not mods["aai-industry"] then - if not mods.Krastorio2 then - util.set_enabled("electric-mining-drill", true) - end -end - - if mods["aai-industry"] then -- AAI Industry now unlocks steam much later. Move it to an earlier sensible location in the tech tree. util.set_prerequisite("steam-power", {"basic-fluid-handling"}) @@ -137,7 +148,6 @@ if mods.modmashsplintersubspacelogistics then for i, item in pairs({"graphite", "diamond"}) do if data.raw.item["super-container-for-"..item] then for i, icon in pairs(data.raw.item["super-container-for-"..item].icons) do - log(serpent.dump(icon)) if string.find(icon.icon, item) then icon.size = 128 icon.scale = icon.scale / 2 @@ -164,7 +174,6 @@ if mods.modmashsplintersubspacelogistics then end end for i, technology in pairs(data.raw.technology) do - log(technology.name) if string.find(technology.name, "containment") then if technology.icons then for j, icon in pairs(technology.icons) do @@ -179,6 +188,9 @@ if mods.modmashsplintersubspacelogistics then end end end +util.redo_recycling() +util.size_recycler_output() +util.use_fluid_mining_final() -- Must be last util.create_list() diff --git a/data-updates.lua b/data-updates.lua index 4d8cdb9..210272b 100644 --- a/data-updates.lua +++ b/data-updates.lua @@ -5,22 +5,24 @@ require("carbon-matter") require("strange-matter") require("compatibility/248k") require("compatibility/orewashing") -require("carbon-recipe-modules") -- Should be last import, need in both updates and final-fixes -- require("omni") local util = require("data-util"); +util.add_gleba_rock("flake-graphite") +util.add_gleba_rock("rough-diamond", 2, 3) if mods.Asteroid_Mining then - require("__Asteroid_Mining__.scripts.addmodule") - if util.me.use_flake_graphite() then - amfunc.addtype("flake-graphite", {a = 0,r = 0.0,g = 0.2,b = 0.5}) + if util.me.use_flake_graphite() and not data.raw.item["asteroid-flake-graphite"] then + util.addtype("flake-graphite", {a = 0,r = 0.0,g = 0.2,b = 0.5}) end - if util.me.use_rough_diamond() then - amfunc.addtype("rough-diamond", {a = 0,r = 0.0,g = 0.2,b = 0.8}) + if util.me.use_rough_diamond() and not data.raw.item["asteroid-rough-diamond"] then + util.addtype("rough-diamond", {a = 0,r = 0.0,g = 0.2,b = 0.8}) end end +util.redo_recycling() + require("compatibility/crafting-efficiency") -- Must be last util.create_list() diff --git a/data-util.lua b/data-util.lua index 0c58ecd..9b471b3 100644 --- a/data-util.lua +++ b/data-util.lua @@ -2,6 +2,7 @@ -- This file will be overwritten in mod zipfiles, edit bzlib/data-util.lua -- WARNING WARNING WARNING +local futil = require("util") local me = require("me") local util = {} @@ -11,6 +12,10 @@ util.get_setting = util.me.get_setting util.titanium_plate = "" util.titanium_processing = "" +util.A = {{"automation-science-pack", 1}} +util.AL = {{"automation-science-pack", 1}, {"logistic-science-pack", 1}} +util.ALC = {{"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}} + if mods["FactorioExtended-Plus-Core"] then util.titanium_plate = "titanium-alloy" else @@ -23,6 +28,28 @@ else util.titanium_processing = "titanium-processing" end +util.vacuum_icon = { icon="__base__/graphics/icons/fluid/steam.png", tint={r=.1, g=.1, b=.5, a=.5} } +util.vacuum_icon_small = { icon="__base__/graphics/icons/fluid/steam.png", tint={r=.1, g=.1, b=.5, a=.5}, scale=0.25, shift={-8,-8}, } +util.vacuum_vis = {r=.1, g=.1, b=.5} + +function util.item(item, quantity, probability) + if not quantity then + quantity = 1 + end + if probability then + return {type="item", name=item, amount=quantity, probability=probability} + else + return {type="item", name=item, amount=quantity} + end +end + +function util.fluid(fluid, quantity) + if not quantity then + quantity = 10 + end + return {type="fluid", name=fluid, amount=quantity} +end + function util.se6() return mods["space-exploration"] and mods["space-exploration"] >= "0.6" end @@ -91,6 +118,301 @@ function util.contains(table, sought) return false end +-- copies a recipe, giving the copy a new name +function util.copy_recipe(recipe_name, new_recipe_name) + if data.raw.recipe[recipe_name] then + new_recipe = futil.table.deepcopy(data.raw.recipe[recipe_name]) + new_recipe.name = new_recipe_name + data:extend({new_recipe}) + end +end + +-- Add the gleba rock. If it exists, still add resource to mine from it +function util.add_gleba_rock(resource, amount_min, amount_max) + if (not data.raw.planet.gleba or + not data.raw.planet.gleba.map_gen_settings or -- attempted compatibility fixes + not data.raw.planet.gleba.map_gen_settings.autoplace_settings or + not data.raw.planet.gleba.map_gen_settings.autoplace_settings.entity or + not data.raw.planet.gleba.map_gen_settings.autoplace_settings.entity.settings + ) then return end + if not data.raw["simple-entity"]["gleba-rock"] then + local autoplace_utils = require("autoplace_utils") + local hit_effects = require ("__base__.prototypes.entity.hit-effects") + local sounds = require ("__base__.prototypes.entity.sounds") + local decorative_trigger_effects = require("__base__.prototypes.decorative.decorative-trigger-effects") + data.raw.planet.gleba.map_gen_settings.autoplace_settings.entity.settings["gleba-rock"] = {} + data:extend({ + { + type = "simple-entity", + name = "gleba-rock", + localised_name = {"entity-name.big-rock"}, + flags = {"placeable-neutral", "placeable-off-grid"}, + icon = "__base__/graphics/icons/big-sand-rock.png", + subgroup = "grass", + order = "b[decorative]-l[rock]-a[big]", + deconstruction_alternative = "big-rock", + collision_box = {{-0.75, -0.75}, {0.75, 0.75}}, + selection_box = {{-1.0, -1.0}, {1.0, 0.75}}, + damaged_trigger_effect = hit_effects.rock(), + render_layer = "object", + max_health = 500, + autoplace = { + control = "gleba_plants", + order = "z[gleba]-a[rock]-b[big]", + probability_expression = "max(main_probability, invasion_tall_probability)", + richness_expression = "random_penalty_at(3, 1)", + tile_restriction = { + "highland-yellow-rock", + "highland-dark-rock", + "highland-dark-rock-2", + }, + local_expressions = { + main_box = "gleba_select(gleba_moisture, 0, 0.25, 0.01, -10, 1) - 1", + main_probability = "min(0.08, 0.15 * (main_box + gleba_plants_noise_b - 0.45) * control:gleba_plants:size)", -- bigger patches, denser + invasion_tall_box = "gleba_select(gleba_moisture, 0, 0.35, 0.01, -10, 1) - 1", + invasion_tall_probability = "min(0.05, 0.15 * (invasion_tall_box + gleba_plants_noise_b - 0.4) * control:gleba_plants:size)", -- smaller patches, sparser + } + }, + + dying_trigger_effect = decorative_trigger_effects.big_rock(), + minable = + { + mining_particle = "stone-particle", + mining_time = 2, + results = { + {type = "item", name = "stone", amount_min = 5, amount_max = 10}, + } + }, + resistances = + { + { + type = "fire", + percent = 100 + } + }, + map_color = {129, 105, 78}, + count_as_rock_for_filtered_deconstruction = true, + mined_sound = sounds.deconstruct_bricks(1.0), + impact_category = "stone", + pictures = + { + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-01.png", + width = 209, + height = 138, + shift = {0.304688, -0.4}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-02.png", + width = 165, + height = 129, + shift = {0.0, 0.0390625}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-03.png", + width = 151, + height = 139, + shift = {0.151562, 0.0}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-04.png", + width = 216, + height = 110, + shift = {0.390625, 0.0}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-05.png", + width = 154, + height = 147, + shift = {0.328125, 0.0703125}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-06.png", + width = 154, + height = 132, + shift = {0.16875, -0.1}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-07.png", + width = 193, + height = 130, + shift = {0.3, -0.2}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-08.png", + width = 136, + height = 117, + shift = {0.0, 0.0}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-09.png", + width = 157, + height = 115, + shift = {0.1, 0.0}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-10.png", + width = 198, + height = 153, + shift = {0.325, -0.1}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-11.png", + width = 190, + height = 115, + shift = {0.453125, 0.0}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-12.png", + width = 229, + height = 126, + shift = {0.539062, -0.015625}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-13.png", + width = 151, + height = 125, + shift = {0.0703125, 0.179688}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-14.png", + width = 137, + height = 117, + shift = {0.160938, 0.0}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-15.png", + width = 201, + height = 141, + shift = {0.242188, -0.195312}, + scale = 0.5 + }, + { + filename = "__base__/graphics/decorative/sand-rock/big-sand-rock-16.png", + width = 209, + height = 154, + shift = {0.351562, -0.1}, + scale = 0.5 + } + } + }, + }) + local probability = data.raw["simple-entity"]["gleba-rock"].autoplace.probability_expression + -- A lot more common near starting point when aps gleba + local factor = (mods["any-planet-start"] and me.get_setting("aps-planet") == "gleba" and 20) or 1 + data.raw["simple-entity"]["gleba-rock"].autoplace.probability_expression = probability..[[* + if(distance_from_nearest_point{x = x, y = y, points = starting_positions} < 200, ]]..factor..[[, + if(distance_from_nearest_point{x = x, y = y, points = starting_positions} < 700, + 100/(distance_from_nearest_point{x = x, y = y, points = starting_positions} - 100), 0.17)) + ]] + + end + if data.raw.item[resource] then + amount_min = (amount_min or 10) * ((mods["any-planet-start"] and me.get_setting("aps-planet") == "gleba" and 4) or 1) + amount_max = (amount_max or 20) * ((mods["any-planet-start"] and me.get_setting("aps-planet") == "gleba" and 4) or 1) + util.add_minable_result( + "simple-entity", "gleba-rock", + {type="item", name=resource, amount_min=amount_min, amount_max=amount_max}) + end +end + +-- Replace 'uranium-mining' tech with 'fluid-mining', defaulting to same costs +function util.add_fluid_mining() + if data.raw.technology["fluid-mining"] then return end + data:extend({ + { + type = "technology", + name = "fluid-mining", + icon = "__"..util.me.name.."__/graphics/technology/fluid-mining.png", + icon_size = 256, + effects = + { + { + type = "mining-with-fluid", + modifier = true + } + }, + prerequisites = {"chemical-science-pack", "concrete"}, + unit = + { + count = 100, + ingredients = + { + {"automation-science-pack", 1}, + {"logistic-science-pack", 1}, + {"chemical-science-pack", 1} + }, + time = 30, + } + } + }) +end + +-- Final fix to make sure nothing uses "uranium-mining" +function util.use_fluid_mining_final() + for i, tech in pairs(data.raw.technology) do + if tech.prerequisites then + for j, pre in pairs(tech.prerequisites) do + if pre == "uranium-mining" then + util.add_prerequisite(tech.name, "fluid-mining") + util.remove_prerequisite(tech.name, "uranium-mining") + break + end + end + end + end + util.remove_raw("technology", "uranium-mining") +end + + +-- Add vacuum if it hasn't been added yet +function util.add_vacuum() + if not data.raw.fluid.vacuum then + data:extend({ + { + type = "fluid", + name = "vacuum", + icons = { util.vacuum_icon, }, + visualization_color = util.vacuum_vis, + subgroup = "fluid", + order = "d[vacuum]", + default_temperature = 1500, + max_temperature = 2000, + gas_temperature = 0, + heat_capacity = "0.01kJ", + base_color = {0.9, 0.9, 0.9}, + flow_color = {0.8, 0.8, 0.9}, + auto_barrel = false, + }, + }) + end +end + +-- If Hot metals mod is enabled, mark these metals as hot +function util.add_hot_metals(metals) + if HotMetals and HotMetals.items then + for _, metal in pairs(metals) do + if data.raw.item[metal] or (metal.name and data.raw.item[metal.name]) then + table.insert(HotMetals.items, metal) + end + end + end +end + -- se landfill -- params: ore, icon_size @@ -298,15 +620,12 @@ function util.se_matter(params) end end +-- deprecated -- 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 + return recipe end end @@ -415,72 +734,108 @@ end function util.set_tech_recipe(technology_name, ingredients) local technology = data.raw.technology[technology_name] if technology then + if not technology.unit then + -- set a sane unit just in case + technology.unit = {time = 30, count = 50} + end technology.unit.ingredients = ingredients + technology.research_trigger = nil + end +end + +-- Set technology trigger +function util.set_tech_trigger(technology_name, trigger) + local technology = data.raw.technology[technology_name] + if technology then + technology.unit = nil + technology.research_trigger = trigger end 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 +-- adds a crafting category if it doesn't exist, also optionally allowing handcrafting +function util.add_new_crafting_category(category, by_hand) + if not data.raw["recipe-category"][category] then + data:extend({{ + type="recipe-category", + name=category, + }}) + end + if by_hand then + for i, character in pairs(data.raw.character) do + if character.crafting_categories then + table.insert(character.crafting_categories, category) + end + end + end +end + + -- Add a given quantity of ingredient to a given recipe function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity, options) if not should_force(options) and bypass(recipe_name) then return end - if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then + if data.raw.recipe[recipe_name] and util.get_item(ingredient) then me.add_modified(recipe_name) + prepare_redo_recycling(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 function add_or_add_to_ingredient(recipe, ingredient, quantity) if recipe ~= nil and recipe.ingredients ~= nil then for i, existing in pairs(recipe.ingredients) do - if existing[1] == ingredient or existing.name == ingredient then + if existing.name == ingredient then add_to_ingredient(recipe, ingredient, quantity) return end end - table.insert(recipe.ingredients, {ingredient, quantity}) + table.insert(recipe.ingredients, util.item(ingredient, quantity)) end end +function util.get_item(name) + if data.raw.item[name] then return data.raw.item[name] end + if data.raw.armor[name] then return data.raw.armor[name] end + if data.raw.fluid[name] then return data.raw.fluid[name] end + if data.raw.capsule[name] then return data.raw.capsule[name] end + if data.raw["space-platform-starter-pack"] and data.raw["space-platform-starter-pack"][name] then return data.raw["space-platform-starter-pack"][name] end + -- TODO add more subtypes of item here + return nil +end + -- Add a given quantity of ingredient to a given recipe function util.add_ingredient(recipe_name, ingredient, quantity, options) if not should_force(options) and bypass(recipe_name) then return end local is_fluid = not not data.raw.fluid[ingredient] - if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then + if data.raw.recipe[recipe_name] and (util.get_item(ingredient) or is_fluid) then me.add_modified(recipe_name) + prepare_redo_recycling(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 function add_ingredient(recipe, ingredient, quantity, is_fluid) if recipe ~= nil and recipe.ingredients ~= nil then for i, existing in pairs(recipe.ingredients) do - if existing[1] == ingredient or existing.name == ingredient then + if existing.name == ingredient then return end end 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 @@ -488,21 +843,17 @@ end -- Add a given ingredient prototype to a given recipe function util.add_ingredient_raw(recipe_name, ingredient, options) if not should_force(options) and bypass(recipe_name) then return end - if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then + if data.raw.recipe[recipe_name] and data.raw.item[ingredient.name] then me.add_modified(recipe_name) + prepare_redo_recycling(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 function add_ingredient_raw(recipe, ingredient) if recipe ~= nil and recipe.ingredients ~= nil then for i, existing in pairs(recipe.ingredients) do - if ( - (existing[1] and (existing[1] == ingredient[1] or existing[1] == ingredient.name)) or - (existing.name and (existing.name == ingredient[1] or existing.name == ingredient.name)) - ) then + if existing.name == ingredient.name then return end end @@ -515,19 +866,15 @@ function util.set_ingredient(recipe_name, ingredient, quantity, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then me.add_modified(recipe_name) + prepare_redo_recycling(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 function set_ingredient(recipe, ingredient, quantity) if recipe ~= nil and recipe.ingredients ~= nil then for i, existing in pairs(recipe.ingredients) do - if existing[1] == ingredient then - existing[2] = quantity - return - elseif existing.name == ingredient then + if existing.name == ingredient then existing.amount = quantity existing.amount_min = nil existing.amount_max = nil @@ -542,43 +889,31 @@ end 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] + (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 product.name and data.raw[product.type][product.name] 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) end end end --- Get the amount of the ingredient, will check base/normal not expensive +-- Get the amount of the ingredient 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 @@ -587,27 +922,23 @@ function util.get_ingredient_amount(recipe_name, ingredient_name) return 0 end --- Get the amount of the result, will check base/normal not expensive +-- Get the amount of the result (currently ignores probability) 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 + if result.name == product then + if result.amount then + return result.amount + elseif result.amount_min then + return (result.amount_min + result.amount_max) / 2 + end + end end - elseif recipe.result_count then - return recipe.result_count end - return 1 + return 0 end return 0 end @@ -617,9 +948,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 @@ -631,18 +960,17 @@ end -- Use amount to set an amount. If that amount is a multiplier instead of an exact amount, set multiply true. function util.replace_ingredient(recipe_name, old, new, amount, multiply, options) if not should_force(options) and bypass(recipe_name) then return end - if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then + if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) and (data.raw.item[old] or data.raw.fluid[old]) then me.add_modified(recipe_name) + prepare_redo_recycling(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 function replace_ingredient(recipe, old, new, amount, multiply) if recipe ~= nil and recipe.ingredients ~= nil then for i, existing in pairs(recipe.ingredients) do - if existing[1] == new or existing.name == new then + if existing.name == new then return end end @@ -656,16 +984,6 @@ function replace_ingredient(recipe, old, new, amount, multiply) ingredient.amount = amount end end - end - if ingredient[1] == old then - ingredient[1] = new - if amount then - if multiply then - ingredient[2] = amount * ingredient[2] - else - ingredient[2] = amount - end - end end end end @@ -676,9 +994,8 @@ function util.remove_ingredient(recipe_name, old, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] then me.add_modified(recipe_name) + prepare_redo_recycling(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 @@ -686,7 +1003,7 @@ function remove_ingredient(recipe, old) index = -1 if recipe ~= nil and recipe.ingredients ~= nil then for i, ingredient in pairs(recipe.ingredients) do - if ingredient.name == old or ingredient[1] == old then + if ingredient.name == old then index = i break end @@ -703,9 +1020,8 @@ function util.replace_some_product(recipe_name, old, old_amount, new, new_amount local is_fluid = not not data.raw.fluid[new] -- NOTE CURRENTLY UNUSUED if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then me.add_modified(recipe_name) + prepare_redo_recycling(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 @@ -714,18 +1030,15 @@ function replace_some_product(recipe, old, old_amount, new, new_amount) 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, util.item(new, 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 @@ -737,47 +1050,61 @@ function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amo local is_fluid = not not data.raw.fluid[new] if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then me.add_modified(recipe_name) + prepare_redo_recycling(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 function replace_some_ingredient(recipe, old, old_amount, new, new_amount, is_fluid) if recipe ~= nil and recipe.ingredients ~= nil then for i, existing in pairs(recipe.ingredients) do - if existing[1] == new or existing.name == new then + if existing.name == new then return end end for i, ingredient in pairs(recipe.ingredients) do if ingredient.name == old then ingredient.amount = math.max(1, ingredient.amount - old_amount) - end - if ingredient[1] == old then - ingredient[2] = math.max(1, ingredient[2] - old_amount) end end add_ingredient(recipe, new, new_amount, is_fluid) end end +-- set the probability of a product. +function util.set_product_probability(recipe_name, product, probability, options) + if not should_force(options) and bypass(recipe_name) then return end + if data.raw.recipe[recipe_name] then + me.add_modified(recipe_name) + prepare_redo_recycling(recipe_name) + set_product_probability(data.raw.recipe[recipe_name], product, probability) + end +end + +function set_product_probability(recipe, product, probability) + if recipe then + if recipe.results then + for i, result in pairs(recipe.results) do + if result.name == product then + result.probability = probability + end + end + end + end +end + -- set the amount of a product. function util.set_product_amount(recipe_name, product, amount, options) if not should_force(options) and bypass(recipe_name) then return end - me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then + me.add_modified(recipe_name) + prepare_redo_recycling(recipe_name) 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 function set_product_amount(recipe, product, amount) if recipe then - if recipe.result_count then - recipe.result_count = amount - end if recipe.results then for i, result in pairs(recipe.results) do if result.name == product then @@ -790,9 +1117,6 @@ function set_product_amount(recipe, product, amount) result.amount = amount end end - if result[1] == product then - result[2] = amount - end end end if not recipe.results and not recipe.result_count then @@ -805,11 +1129,10 @@ end -- multiply the cost, energy, and results of a recipe by a multiple function util.multiply_recipe(recipe_name, multiple, options) if not should_force(options) and bypass(recipe_name) then return end - me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then + me.add_modified(recipe_name) + prepare_redo_recycling(recipe_name) 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 @@ -820,9 +1143,6 @@ function multiply_recipe(recipe, 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 - end if recipe.results then for i, result in pairs(recipe.results) do if result.name then @@ -837,23 +1157,29 @@ function multiply_recipe(recipe, multiple) result.catalyst_amount = result.catalyst_amount * multiple end end - if result[1] then - result[2] = result[2] * multiple - end end end - if not recipe.results and not recipe.result_count then - -- implicit one item result - recipe.result_count = multiple - end + multiply_ingredients(recipe, multiple) + end +end + +-- multiply the ingredient cost of a recipe +function util.multiply_ingredients(recipe_name, multiple, options) + if not should_force(options) and bypass(recipe_name) then return end + if data.raw.recipe[recipe_name] then + me.add_modified(recipe_name) + prepare_redo_recycling(recipe_name) + multiply_ingredients(data.raw.recipe[recipe_name], multiple) + end +end + +function multiply_ingredients(recipe, multiple) + if recipe then if recipe.ingredients then for i, ingredient in pairs(recipe.ingredients) do if ingredient.name then ingredient.amount = ingredient.amount * multiple end - if ingredient[1] then - ingredient[2] = ingredient[2] * multiple - end end end end @@ -861,15 +1187,14 @@ 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) if recipe ~= nil and recipe.ingredients ~= nil then for i, existing in pairs(recipe.ingredients) do - if existing[1] == ingredient or existing.name == ingredient then + if existing.name == ingredient then return true end end @@ -880,11 +1205,10 @@ end -- Remove a product from a recipe, WILL NOT remove the only product function util.remove_product(recipe_name, old, options) if not should_force(options) and bypass(recipe_name) then return end - me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then + me.add_modified(recipe_name) + prepare_redo_recycling(recipe_name) 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 @@ -892,7 +1216,7 @@ function remove_product(recipe, old) index = -1 if recipe ~= nil and recipe.results ~= nil then for i, result in pairs(recipe.results) do - if result.name == old or result[1] == old then + if result.name == old then index = i break end @@ -907,8 +1231,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 @@ -923,8 +1245,6 @@ 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) end end @@ -940,7 +1260,6 @@ function replace_product(recipe, old, new, options) if recipe.results then for i, result in pairs(recipe.results) do if result.name == old then result.name = new end - if result[1] == old then result[1] = new end end end end @@ -965,11 +1284,10 @@ end -- Set energy required function util.set_recipe_time(recipe_name, time, options) if not should_force(options) and bypass(recipe_name) then return end - me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then + me.add_modified(recipe_name) + prepare_redo_recycling(recipe_name) 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 @@ -984,11 +1302,10 @@ end -- Multiply energy required function util.multiply_time(recipe_name, factor, options) if not should_force(options) and bypass(recipe_name) then return end - me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then + me.add_modified(recipe_name) + prepare_redo_recycling(recipe_name) 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 @@ -1003,11 +1320,10 @@ end -- Add to energy required function util.add_time(recipe_name, amount, options) if not should_force(options) and bypass(recipe_name) then return end - me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then + me.add_modified(recipe_name) + prepare_redo_recycling(recipe_name) 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 @@ -1019,11 +1335,19 @@ function add_time(recipe, amount) end end +-- Set localised name +function util.set_localised_name(recipe_name, localised_name) + if data.raw.recipe[recipe_name] then + data.raw.recipe[recipe_name].localised_name = localised_name + end +end + -- Set recipe category function util.set_category(recipe_name, category, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] and data.raw["recipe-category"][category] then me.add_modified(recipe_name) + prepare_redo_recycling(recipe_name) data.raw.recipe[recipe_name].category = category end end @@ -1068,13 +1392,6 @@ function util.add_icon(recipe_name, icon, options) 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 @@ -1094,6 +1411,17 @@ function util.set_icons(recipe_name, icons, options) end end +-- Set tech icons +function util.set_tech_icons(technology, icons, options) + if not should_force(options) and bypass(technology) then return end + if data.raw.technology[technology] then + me.add_modified(technology) + data.raw.technology[technology].icons = icons + data.raw.technology[technology].icon = nil + data.raw.technology[technology].icon_size = nil + end +end + -- Set recipe icons function util.set_item_icons(item_name, icons) if data.raw.item[item_name] then @@ -1133,25 +1461,41 @@ function util.add_crafting_category(entity_type, entity, category) end end +-- Add crafting category to all entities that have another category +function util.add_crafting_category_if(entity_type, category, other_category) + if data.raw[entity_type] and data.raw["recipe-category"][category] and data.raw["recipe-category"][other_category] then + for _, entity in pairs(data.raw[entity_type]) do + local found_good = false + local found_bad = false + for _, existing in pairs(entity.crafting_categories) do + if existing == other_category then + found_good = true + end + if existing == category then + found_bad = true + end + end + if found_good and not found_bad then + table.insert(entity.crafting_categories, category) + end + end + end +end + + 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 function add_to_ingredient(recipe, it, amount) - if recipe ~= nil and recipe.ingredients ~= nil then + if recipe and recipe.ingredients then for i, ingredient in pairs(recipe.ingredients) do if ingredient.name == it then ingredient.amount = ingredient.amount + amount return - end - if ingredient[1] == it then - ingredient[2] = ingredient[2] + amount - return end end end @@ -1161,8 +1505,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 @@ -1176,10 +1518,6 @@ function add_to_product(recipe, product, amount) if result.name == product then result.amount = result.amount + amount return - end - if result[1] == product then - result[2] = result[2] + amount - return end end end @@ -1187,19 +1525,34 @@ end -- Adds a result to a mineable type function util.add_minable_result(t, name, result) - if data.raw[t] and data.raw[t][name] and data.raw[t][name].minable then + if data.raw[t] and data.raw[t][name] and data.raw[t][name].minable and data.raw.item[result.name] then if data.raw[t][name].minable.result and not data.raw[t][name].minable.results then data.raw[t][name].minable.results = { - {data.raw[t][name].minable.result ,data.raw[t][name].minable.count}} + util.item(data.raw[t][name].minable.result ,data.raw[t][name].minable.count)} data.raw[t][name].minable.result = nil data.raw[t][name].minable.result_count = nil end if data.raw[t][name].minable.results then + for _, other in pairs(data.raw[t][name].minable.results) do + if other.name == result.name then return end -- don't add if already present + end table.insert(data.raw[t][name].minable.results, result) + else + data.raw[t][name].minable.results = {result} end end end +function util.set_surface_property(surface, condition, value) + if not data.raw["surface-property"][condition] then return end + if data.raw.surface[surface] then + data.raw.surface[surface].surface_properties[condition] = value + end + if data.raw.planet[surface] then + data.raw.planet[surface].surface_properties[condition] = value + end +end + local function insert(nodes, node, value) table.insert(node, value) -- store as parameter @@ -1251,7 +1604,9 @@ function util.create_list() icon = "__core__/graphics/empty.png", icon_size = 1, stack_size = 1, - flags = {"hidden", "hide-from-bonus-gui"} + hidden = true, + hidden_in_factoriopedia = true, + flags = {"hide-from-bonus-gui"} }}) end @@ -1282,6 +1637,7 @@ end function remove_prior_unlocks(tech, recipe) local technology = data.raw.technology[tech] if technology then + log("Removing prior unlocks for ".. tech) util.remove_recipe_effect(tech, recipe) if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do @@ -1317,6 +1673,7 @@ function util.replace_ingredients_prior_to(tech, old, new, multiplier) end function replace_ingredients_prior_to(tech, old, new, multiplier) + log("Replacing for tech "..tech) local technology = data.raw.technology[tech] if technology then if technology.effects then @@ -1382,4 +1739,326 @@ function util.set_vtk_dcm_ingredients() end end +-- Set correct number of outputs for recyclers +function util.size_recycler_output() + if data.raw.recipe["scrap-recycling"] and data.raw.recipe["scrap-recycling"].results then + for i, entity in pairs(data.raw.furnace) do + if util.contains(entity.crafting_categories, "recycling-or-hand-crafting") then + if entity.result_inventory_size < #data.raw.recipe["scrap-recycling"].results then + entity.result_inventory_size = #data.raw.recipe["scrap-recycling"].results + end + end + end + else + local most = 0 + for i, recipe in pairs(data.raw.recipe) do + if data.raw.recipe.ingredients and #data.raw.recipe.ingredients > most then + most = #data.raw.recipe.ingredients + end + end + for i, entity in pairs(data.raw.furnace) do + if util.contains(entity.crafting_categories, "recycling-or-hand-crafting") then + if entity.result_inventory_size < most then + entity.result_inventory_size = most + end + end + end + end +end + + +-- Save recycling metadata that is later removed by quality mod. Call near end of data.lua +function util.prepare_recycling_helper() + if mods.quality then + for _, recipe in pairs(data.raw.recipe) do + recipe.auto_recycle_helper = recipe.auto_recycle + end + end +end + +-- Recalculate recycling recipes, call near end of data-updates.lua, after calling +-- util.prepare_recycling_helper from data.lua +function util.redo_recycling() + if mods.quality then + local recycling = require("__quality__.prototypes.recycling") + for _, recipe in pairs(data.raw.recipe) do + recipe.auto_recycle = recipe.auto_recycle_helper -- keeping this outside conditional to improve fidelity across multiple mods + if recipe.redo_recycling then + recycling.generate_recycling_recipe(recipe) + end + end + -- Find all recycling recipes that result in armor and make sure not to output more than 1 + for _, recipe in pairs(data.raw.recipe) do + if recipe.name:find("recycling") then + for _, product in pairs(recipe.results) do + if data.raw.armor[product.name] then + if product.amount then + if product.amount > .99 then + product.amount = 1 + product.extra_count_fraction = nil + end + end + end + end + end + end + end +end + +-- Preps the recipe to have recycling recalculated. Expects the recipe exists. +function prepare_redo_recycling(recipe_name) + data.raw.recipe[recipe_name].redo_recycling = true +end + +-- Change furnace output count +function util.set_minimum_furnace_outputs(category, count) + for i, entity in pairs(data.raw.furnace) do + if entity.result_inventory_size ~= nil and entity.result_inventory_size < count and util.contains(entity.crafting_categories, category) then + entity.result_inventory_size = count + end + end +end + + +-- According to https://mods.factorio.com/mod/Asteroid_Mining, the +-- following function is under this MIT license (similar license, different author): +-- +-- Copyright (c) 2021 Silari +-- Permission is hereby granted, free of charge, to any person obtaining a copy of +-- this software and associated documentation files (the "Software"), to deal in +-- the Software without restriction, including without limitation the rights to +-- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +-- the Software, and to permit persons to whom the Software is furnished to do so, +-- subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in all +-- copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +-- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +-- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +-- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +-- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +function util.addtype(name,atint,desc) --,pictures) + require("__Asteroid_Mining__/scripts/icons.lua") -- Has generateicons function + + local allowprod = settings.startup["astmine-allowprod"].value + local useminer = settings.startup["astmine-enableminer"].value + local hiderec = not settings.startup["astmine-hiderecipes"].value + local recenabled = false + + local chunkstacksize = 1000 + if mods["space-exploration"] then + chunkstacksize = 200 + end + + --Adds given recipe to prod modules allowed list + function addmodules(name) + if useminer then -- Only add these if we're actually enabled. + table.insert(data.raw.module["productivity-module"].limitation, name) + table.insert(data.raw.module["productivity-module-2"].limitation, name) + table.insert(data.raw.module["productivity-module-3"].limitation, name) + end + end + + --Result for processing resource specific chunks + local normal = { -- Gives 4000 chunks on average + { + amount_min = 3, + amount_max = 5, + probability = 1 + } + } + local chunkamount = 1000 + + -- Space age makes rockets cost 1/20th as much. Give less materials, same ratio. + if mods["space-age"] then + chunkamount = 50 + end + + --ITEM: Miner-module, which is what we send into space to get the asteroid-mixed item + local minermodule = { + icon = "__Asteroid_Mining__/graphics/mining-sat.png", + icon_mipmaps = 4, + icon_size = 64, + name = "miner-module", + localised_name = {"item-name.miner-module", "Mixed"}, + localised_description = {"item-description.miner-module", "mixed"}, + order = "n[miner-module]", + rocket_launch_products = {{ + name="asteroid-mixed", + amount=chunkamount, + type="item" + }}, + send_to_orbit_mode = "automated", + stack_size = 1, + subgroup = subminer, + type = "item" + } + --Make a new item with the given name+"-chunk" and recipe to turn into name + --eg addtype('iron-ore') makes iron-ore-chunk and recipe for iron-ore-chunk->100 iron-ore + --log("Making new items for " .. name) + --ITEM Resource chunk for this item + + local suffix = "-chunk" + -- Sometimes we need to override the default suffix because the item name already exists. + -- TODO - change this so it automatically detects name-chunk item exists and change suffix - BUT + -- that would cause issues if 'name' is in more than one module - eg angels/bobs overlap, bob+bzlead, etc. + -- Maybe add in something that tracks what 'name's have been added and skip it if it has. + if string.find(name,"angels-ore",1,true) then + suffix = "-chunk-am" + end + --log(name .. " name:suffix " .. suffix) + + local reschunk = { + icons = { + { + icon = "__Asteroid_Mining__/graphics/resource-chunk.png", + icon_mipmaps = 4, + icon_size = 64 + }, + { + icon = "__Asteroid_Mining__/graphics/resource-chunk-mask.png", + icon_mipmaps = 4, + icon_size = 64, + tint = atint + } + }, + name = name .. suffix, + localised_name = {"item-name.resource-chunk", {"item-name." .. name}}, + localised_description = {"item-description.resource-chunk", {"item-name." .. name}}, + order = "d[asteroidchunk-" .. name .. "]", + stack_size = 25, + subgroup = subchunk, + type = "item" + } + + --RECIPE Turn resource chunk into 24 of item + local procreschunk = { + allow_decomposition = false, + always_show_products = true, + category = reccategory, + enabled = hiderec, + energy_required = 5, + ingredients = { + { + name=name .. suffix, + amount=1, + type="item" + } + }, + name = name .. suffix, + order = "d[asteroidchunk-" .. name .. "]", + localised_name = {"recipe-name.resource-chunk", {"item-name." .. name}}, + localised_description = {"recipe-description.resource-chunk", {"item-name." .. name}}, + results = {{name=name,amount=24,type="item"}}, + type = "recipe" + } + if desc == nil then + desc = "" + end + + --ITEM Resource specific asteroid chunk. + local newasteroid = { + icons = { + { + icon = "__Asteroid_Mining__/graphics/asteroid-chunk.png", + icon_mipmaps = 4, + icon_size = 64 + }, + { + icon = "__Asteroid_Mining__/graphics/asteroid-chunk-mask.png", + icon_mipmaps = 4, + icon_size = 64, + tint = atint + } + }, + name = "asteroid-" .. name, + localised_name = {"item-name.asteroid-chunk", {"item-name." .. name}}, + localised_description = {"item-description.asteroid-chunk", {"item-name." .. name}, desc}, + order = "k[zasteroid-" .. name .. "]", + stack_size = chunkstacksize, + subgroup = subchunk, + type = "item" + } + --log(serpent.block(newasteroid)) + --We need to set the result name to the name of our resource chunk + mynormal = table.deepcopy(normal) + mynormal[1].name = name .. suffix + mynormal[1].type = "item" + --Expensive mode is gone. + --myexpensive = table.deepcopy(expensive) + --myexpensive[1].name = name .. suffix + + --RECIPE: Processing the asteroid chunks into resource chunks + local processasteroid = { + allow_decomposition = false, + category = reccategory, + name = "asteroid-" .. name, + localised_name = {"recipe-name.asteroid-chunk", {"item-name." .. name}}, + localised_description = {"recipe-description.asteroid-chunk", {"item-name." .. name}}, + order = "k[zasteroid-" .. name .. "]", + ingredients = {{name="asteroid-" .. name,amount=1,type="item"}}, + results = mynormal, + always_show_products = true, + enabled = hiderec, + energy_required = 10, + --subgroup = subchunk, + type = "recipe" + } + + --ITEM Miner module to get resource specific asteroids. + local minerres = table.deepcopy(minermodule) + minerres.name = "miner-module-" .. name + minerres.rocket_launch_products = {{ + name="asteroid-" .. name, + amount=chunkamount, + type="item" + }} + minerres.order = "n[miner-module" .. name .. "]" + minerres.icons = generateicons(name,atint) --Generate icon layers using given item + minerres.localised_name = {"item-name.miner-module", {"item-name." .. name}} + minerres.localised_description = {"item-description.miner-module", {"item-name." .. name}} + + --RECIPE: Recipe to make miner module to get resource specific asteroids. Always the default category + local newminer = { + enabled = recenabled, + ingredients = { + { + name="electric-mining-drill", + amount=5, + type="item" + }, + { + name="radar", + amount=5, + type="item" + }, + { + name=name, + amount=5, + type="item" + } + }, + name = "miner-module-" .. name, + results = {{name="miner-module-" .. name,amount=1,type="item"}}, + type = "recipe" + } + data:extend{reschunk,procreschunk,newasteroid,processasteroid} + if useminer then -- Disabled in 1.0 for the new generation system, once in place. + data:extend{minerres,newminer} + --This makes the miner module available when rocket silo is researched + table.insert(data.raw.technology["rocket-silo"].effects, {type = "unlock-recipe", recipe = "miner-module-" .. name}) + if not hiderec then + table.insert(data.raw.technology["rocket-silo"].effects, {type = "unlock-recipe", recipe = "asteroid-" .. name}) + table.insert(data.raw.technology["rocket-silo"].effects, {type = "unlock-recipe", recipe = name .. suffix}) + end + end + if allowprod then -- Setting to enable prod module usage in asteroid processing + addmodules(processasteroid.name) + end +end +-- END of alternate licenscing + return util diff --git a/data.lua b/data.lua index 2ca8f99..4fed562 100644 --- a/data.lua +++ b/data.lua @@ -1,12 +1,14 @@ -require("graphite") -require("graphite-particle") -require("diamond") -require("diamond-particle") +require("prototypes.basic-crusher") +require("prototypes.graphite") +require("prototypes.graphite-particle") +require("prototypes.diamond") +require("prototypes.diamond-particle") require("carbon-recipe") require("carbon-recipe-k2") -- must be after carbon-recipe require("carbon-recipe-se") -require("carbon-fiber") +require("prototypes.activated-carbon") +require("prototypes.carbon-fiber") local util = require("data-util"); @@ -16,6 +18,18 @@ if mods["aai-vehicles-miner"] then data.raw.fluid.steam.auto_barrel = true end +util.add_fluid_mining() +util.set_tech_trigger("fluid-mining", {type="craft-fluid", fluid="steam", amount=500}) +util.set_prerequisite("fluid-mining", {"steam-power"}) +util.add_unlock("steam-power", "copper-cable") +util.add_unlock("steam-power", "small-electric-pole") +util.set_prerequisite("electric-mining-drill", {"steam-power"}) +util.set_tech_trigger("electric-mining-drill", {type="craft-item", item="small-electric-pole", count=10}) +util.set_prerequisite("graphite-processing", {"fluid-mining", "electric-mining-drill"}) +util.add_prerequisite("uranium-processing", "sulfur-processing") + +util.add_unlock("graphite-processing", "basic-crusher") + -- Must be last util.create_list() diff --git a/graphics/entity/ores/diamond.png b/graphics/entity/ores/diamond.png deleted file mode 100644 index 0c681ed..0000000 Binary files a/graphics/entity/ores/diamond.png and /dev/null differ diff --git a/graphics/entity/ores/graphite.png b/graphics/entity/ores/graphite.png deleted file mode 100644 index a869375..0000000 Binary files a/graphics/entity/ores/graphite.png and /dev/null differ diff --git a/graphics/entity/ores/hr-diamond.png b/graphics/entity/ores/hr-diamond.png index f50ba16..54f427f 100644 Binary files a/graphics/entity/ores/hr-diamond.png and b/graphics/entity/ores/hr-diamond.png differ diff --git a/graphics/entity/ores/hr-diamond.xcf b/graphics/entity/ores/hr-diamond.xcf index 3d4b84b..c794067 100644 Binary files a/graphics/entity/ores/hr-diamond.xcf and b/graphics/entity/ores/hr-diamond.xcf differ diff --git a/graphics/entity/ores/hr-graphite.png b/graphics/entity/ores/hr-graphite.png index 65311b2..97da069 100644 Binary files a/graphics/entity/ores/hr-graphite.png and b/graphics/entity/ores/hr-graphite.png differ diff --git a/graphics/entity/ores/hr-graphite.xcf b/graphics/entity/ores/hr-graphite.xcf index 7ab3db7..334f450 100644 Binary files a/graphics/entity/ores/hr-graphite.xcf and b/graphics/entity/ores/hr-graphite.xcf differ diff --git a/graphics/icons/activated-carbon.png b/graphics/icons/activated-carbon.png new file mode 100644 index 0000000..3a24252 Binary files /dev/null and b/graphics/icons/activated-carbon.png differ diff --git a/graphics/icons/carbon-fiber.png b/graphics/icons/carbon-fiber.png index bc282bb..c522e39 100644 Binary files a/graphics/icons/carbon-fiber.png and b/graphics/icons/carbon-fiber.png differ diff --git a/graphics/icons/flake-graphite-1.png b/graphics/icons/flake-graphite-1.png index 14252aa..4d50d6b 100644 Binary files a/graphics/icons/flake-graphite-1.png and b/graphics/icons/flake-graphite-1.png differ diff --git a/graphics/icons/flake-graphite-1.xcf b/graphics/icons/flake-graphite-1.xcf deleted file mode 100644 index 658f8c6..0000000 Binary files a/graphics/icons/flake-graphite-1.xcf and /dev/null differ diff --git a/graphics/icons/flake-graphite-2.png b/graphics/icons/flake-graphite-2.png index 30d7886..4bb261f 100644 Binary files a/graphics/icons/flake-graphite-2.png and b/graphics/icons/flake-graphite-2.png differ diff --git a/graphics/icons/flake-graphite-2.xcf b/graphics/icons/flake-graphite-2.xcf deleted file mode 100644 index 5ca8717..0000000 Binary files a/graphics/icons/flake-graphite-2.xcf and /dev/null differ diff --git a/graphics/icons/flake-graphite-3.png b/graphics/icons/flake-graphite-3.png index 4a7bc75..9285dfb 100644 Binary files a/graphics/icons/flake-graphite-3.png and b/graphics/icons/flake-graphite-3.png differ diff --git a/graphics/icons/flake-graphite-3.xcf b/graphics/icons/flake-graphite-3.xcf deleted file mode 100644 index 7c5dd6b..0000000 Binary files a/graphics/icons/flake-graphite-3.xcf and /dev/null differ diff --git a/graphics/icons/flake-graphite-4.png b/graphics/icons/flake-graphite-4.png new file mode 100644 index 0000000..783570f Binary files /dev/null and b/graphics/icons/flake-graphite-4.png differ diff --git a/graphics/icons/flake-graphite.png b/graphics/icons/flake-graphite.png index ab6659c..533d42e 100644 Binary files a/graphics/icons/flake-graphite.png and b/graphics/icons/flake-graphite.png differ diff --git a/graphics/icons/flake-graphite.xcf b/graphics/icons/flake-graphite.xcf deleted file mode 100644 index 3340943..0000000 Binary files a/graphics/icons/flake-graphite.xcf and /dev/null differ diff --git a/graphics/icons/pan.png b/graphics/icons/pan.png index f9a155e..4e8acce 100644 Binary files a/graphics/icons/pan.png and b/graphics/icons/pan.png differ diff --git a/graphics/icons/rough-diamond-1.png b/graphics/icons/rough-diamond-1.png index 7285518..e31fa27 100644 Binary files a/graphics/icons/rough-diamond-1.png and b/graphics/icons/rough-diamond-1.png differ diff --git a/graphics/icons/rough-diamond-1.xcf b/graphics/icons/rough-diamond-1.xcf deleted file mode 100644 index 37d6e36..0000000 Binary files a/graphics/icons/rough-diamond-1.xcf and /dev/null differ diff --git a/graphics/icons/rough-diamond-2.png b/graphics/icons/rough-diamond-2.png index 56dd1d7..971bf5d 100644 Binary files a/graphics/icons/rough-diamond-2.png and b/graphics/icons/rough-diamond-2.png differ diff --git a/graphics/icons/rough-diamond-2.xcf b/graphics/icons/rough-diamond-2.xcf deleted file mode 100644 index 7fa2811..0000000 Binary files a/graphics/icons/rough-diamond-2.xcf and /dev/null differ diff --git a/graphics/icons/rough-diamond-3.png b/graphics/icons/rough-diamond-3.png index a36d235..2a0779c 100644 Binary files a/graphics/icons/rough-diamond-3.png and b/graphics/icons/rough-diamond-3.png differ diff --git a/graphics/icons/rough-diamond-3.xcf b/graphics/icons/rough-diamond-3.xcf deleted file mode 100644 index e2afeff..0000000 Binary files a/graphics/icons/rough-diamond-3.xcf and /dev/null differ diff --git a/graphics/icons/rough-diamond-4.png b/graphics/icons/rough-diamond-4.png new file mode 100644 index 0000000..3ff48f4 Binary files /dev/null and b/graphics/icons/rough-diamond-4.png differ diff --git a/graphics/icons/rough-diamond.png b/graphics/icons/rough-diamond.png index 0c723c1..ce7d38e 100644 Binary files a/graphics/icons/rough-diamond.png and b/graphics/icons/rough-diamond.png differ diff --git a/graphics/icons/rough-diamond.xcf b/graphics/icons/rough-diamond.xcf deleted file mode 100644 index 22a1513..0000000 Binary files a/graphics/icons/rough-diamond.xcf and /dev/null differ diff --git a/graphics/technology/fluid-mining.png b/graphics/technology/fluid-mining.png new file mode 100644 index 0000000..158b582 Binary files /dev/null and b/graphics/technology/fluid-mining.png differ diff --git a/info.json b/info.json index 7ed829c..e868729 100644 --- a/info.json +++ b/info.json @@ -1,14 +1,16 @@ { "name": "bzcarbon", - "version": "0.5.9", - "factorio_version": "1.1", + "version": "2.0.0", + "factorio_version": "2.0", "title": "Graphite & Diamonds", "author": "Brevven", "contact": "", "homepage": "", "dependencies": [ "base >= 1.1.0", + "? space-age", "? bztitanium", + "? bzsilicon", "? bzzirconium", "? bzfoundry", "? space-exploration", @@ -19,6 +21,6 @@ "? deadlock-beltboxes-loaders", "? DeadlockCrating" ], - "description": "Adds elemental carbon items to the game, including graphite, diamonds, graphene, and optionally fullerenes, nanotubes, etc.\n\nCompatible with RSO, Krastorio 2, Space Exploration, and more. A standalone piece of BZ Mods" + "description": "Adds elemental carbon items to the game, including graphite, diamonds, graphene, and more.\n\nCompatible with Space Age, and more. A standalone piece of BZ Mods" } diff --git a/locale/de/carbon.cfg b/locale/de/carbon.cfg index e46aceb..e5a7bb0 100644 --- a/locale/de/carbon.cfg +++ b/locale/de/carbon.cfg @@ -45,6 +45,7 @@ nanotubes=Ein nützliches, fortgeschrittenes Material graphite=__ITEM__graphite__ graphite-dust=__ITEM__graphite-dust__ synthetic-diamond=__ITEM__diamond__ +graphite-synthesis=Graphit-Synthese diamond-processing=__ITEM__diamond__ graphene=__ITEM__graphene__ heavy-water-graphene=[fluid=heavy-water] mit __ITEM__graphene__ @@ -53,9 +54,6 @@ nanotubes=__ITEM__nanotubes__ carbon-black=__ITEM__carbon-black__ graphite-carbon-black=__ITEM__graphite__ aus __ITEM__carbon-black__ nanomaterial-nanotubes=__ITEM__se-nanomaterial__ aus __ITEM__nanotubes__ -low-density-structure=__ITEM__low-density-structure__ -low-density-structure-RS=__ITEM__low-density-structure__ -low-density-structure-nanotubes=__ITEM__low-density-structure__ se-low-density-structure-beryllium=__ITEM__low-density-structure__ [recipe-description] diff --git a/locale/en/carbon.cfg b/locale/en/carbon.cfg index 1b33862..664a1fe 100644 --- a/locale/en/carbon.cfg +++ b/locale/en/carbon.cfg @@ -8,6 +8,7 @@ flake-graphite-patch-ore=__ENTITY__flake-graphite-patch__ ore rough-diamond-patch=__ITEM__rough-diamond__ patch rough-diamond-patch-chunk=__ENTITY__rough-diamond-patch__ chunk rough-diamond-patch-ore=__ENTITY__rough-diamond-patch__ ore +basic-crusher=Basic crusher [entity-description] wpe_broken_lab=To repair, insert 100[item=iron-plate], 100[item=iron-gear-wheel], 50[item=repair-pack] @@ -22,6 +23,7 @@ rough-diamond=Rough diamond graphite=Graphite graphite-dust=Graphite dust compressed-graphite=Compressed graphite +basic-crusher=Basic crusher diamond=Diamond graphene=Graphene @@ -29,6 +31,7 @@ fullerenes=Fullerenes nanotubes=Nanotubes carbon-black=Carbon black crucible=Crucible +activated-carbon=Activated carbon carbon-fiber=Carbon fiber polyacrylonitrile=Polyacrylonitrile @@ -51,31 +54,34 @@ flake-graphite-synthesis=Graphite synthesis carbon-matter-processing=Elemental carbon conversion enriched-graphite=Graphite enrichment carbon-fiber=__ITEM__carbon-fiber__ +fluid-mining=Fluid mining [technology-description] +fluid-mining=Allows supply of fluids to mining drills to enable mining of certain resources. graphite-processing=Process flake graphite into usable graphite diamond-processing=Process or create diamonds. Used for grinding, drilling, high tech electronics, etc. graphene=A useful nanomaterial made from simple graphite fullerenes=Isolate fullerenes by zapping carbon nanotubes=A useful advanced material +carbon-fiber=Created with the oils from the jellynut, polyacrylonitrile can be spun, strengthened and then woven to provide the basis for strong materials. [recipe-name] graphite=__ITEM__graphite__ graphite-dust=__ITEM__graphite-dust__ synthetic-diamond=__ITEM__diamond__ +graphite-synthesis=Graphite synthesis diamond-processing=__ITEM__diamond__ graphene=__ITEM__graphene__ heavy-water-graphene=[fluid=heavy-water] with __ITEM__graphene__ fullerenes=__ITEM__fullerenes nanotubes=__ITEM__nanotubes__ carbon-black=__ITEM__carbon-black__ -graphite-carbon-black=__ITEM__graphite__ from __ITEM__carbon-black__ +graphite-carbon-black=Graphitization of carbon black +graphitization=Graphitization of diamonds nanomaterial-nanotubes=__ITEM__se-nanomaterial__ from __ITEM__nanotubes__ -low-density-structure=__ITEM__low-density-structure__ -low-density-structure-RS=__ITEM__low-density-structure__ -low-density-structure-nanotubes=__ITEM__low-density-structure__ se-low-density-structure-beryllium=__ITEM__low-density-structure__ dirty-water-filtration-graphite=Filter dirty water [item=flake-graphite] +ammonia-from-spoilage=Ammonia from spoilage vtk-deepcore-mining-ore-chunk-refining-graphite-focus=__ITEM__graphite__ focused ore chunk refining vtk-deepcore-mining-ore-chunk-refining-diamond-focus=__ITEM__diamond__ focused ore chunk refining @@ -84,6 +90,13 @@ vtk-deepcore-mining-diamond-chunk-refining=__ITEM__rough-diamond__ chunk refinin [recipe-description] graphite-carbon-black=Convert excess carbon black to graphite at an unfavorable ratio. +graphite-synthesis=Synthesize graphite from expired biomatter and other hydrocarbons + +[surface-property-name] +oxygen=Atmospheric oxygen + +[surface-property-unit] +oxygen=__1__ % # Settings diff --git a/locale/ja/carbon.cfg b/locale/ja/carbon.cfg index 0754070..0ddcfdd 100644 --- a/locale/ja/carbon.cfg +++ b/locale/ja/carbon.cfg @@ -60,6 +60,7 @@ nanotubes=有用な先進素材 graphite=__ITEM__graphite__ graphite-dust=__ITEM__graphite-dust__ synthetic-diamond=__ITEM__diamond__ +graphite-synthesis=グラファイト合成 diamond-processing=__ITEM__diamond__ graphene=__ITEM__graphene__ heavy-water-graphene=[fluid=heavy-water] (__ITEM__graphene__ を使用) @@ -68,9 +69,6 @@ nanotubes=__ITEM__nanotubes__ carbon-black=__ITEM__carbon-black__ graphite-carbon-black=__ITEM__graphite__ (__ITEM__carbon-black__ から) nanomaterial-nanotubes=__ITEM__se-nanomaterial__ (__ITEM__nanotubes__ から) -low-density-structure=__ITEM__low-density-structure__ -low-density-structure-RS=__ITEM__low-density-structure__ -low-density-structure-nanotubes=__ITEM__low-density-structure__ se-low-density-structure-beryllium=__ITEM__low-density-structure__ dirty-water-filtration-graphite=汚水をろ過 [item=flake-graphite] diff --git a/locale/ko/carbon.cfg b/locale/ko/carbon.cfg index 7e56b57..9974d02 100644 --- a/locale/ko/carbon.cfg +++ b/locale/ko/carbon.cfg @@ -45,6 +45,7 @@ nanotubes=유용한 고급 재료 graphite=__ITEM__graphite__ graphite-dust=__ITEM__graphite-dust__ synthetic-diamond=__ITEM__diamond__ +graphite-synthesis=흑연 합성 diamond-processing=__ITEM__diamond__ graphene=__ITEM__graphene__ heavy-water-graphene=__ITEM__graphene__을 포함한 [fluid=heavy-water] @@ -53,9 +54,6 @@ nanotubes=__ITEM__nanotubes__ carbon-black=__ITEM__carbon-black__ graphite-carbon-black=__ITEM__carbon-black__으로부터 __ITEM__graphite__ nanomaterial-nanotubes=__ITEM__nanotubes__으로부터 __ITEM__se-nanomaterial__ -low-density-structure=__ITEM__low-density-structure__ -low-density-structure-RS=__ITEM__low-density-structure__ -low-density-structure-nanotubes=__ITEM__low-density-structure__ se-low-density-structure-beryllium=__ITEM__low-density-structure__ [recipe-description] diff --git a/locale/pl/carbon.cfg b/locale/pl/carbon.cfg index 0905a7b..efa7a40 100644 --- a/locale/pl/carbon.cfg +++ b/locale/pl/carbon.cfg @@ -45,6 +45,7 @@ nanotubes=Przydatny zaawansowany materiał graphite=Grafit graphite-dust=Pył grafitowy synthetic-diamond=Syntetyczny diament +graphite-synthesis=Synteza grafitu diamond-processing=Przetwarzanie diamentów graphene=Grafen heavy-water-graphene=[fluid=heavy-water] z grafenem diff --git a/locale/ru/carbon.cfg b/locale/ru/carbon.cfg index 164e792..a916c52 100644 --- a/locale/ru/carbon.cfg +++ b/locale/ru/carbon.cfg @@ -60,6 +60,7 @@ nanotubes=Полезный продвинутый материал. graphite=__ITEM__graphite__ graphite-dust=__ITEM__graphite-dust__ synthetic-diamond=__ITEM__diamond__ +graphite-synthesis=Синтез графита diamond-processing=__ITEM__diamond__ graphene=__ITEM__graphene__ heavy-water-graphene=[fluid=heavy-water] с примесью графена @@ -68,9 +69,6 @@ nanotubes=__ITEM__nanotubes__ carbon-black=__ITEM__carbon-black__ graphite-carbon-black=Переработка технического углерода для получения графита nanomaterial-nanotubes=Переработка нанотрубок для получения __ITEM__se-nanomaterial__ -low-density-structure=__ITEM__low-density-structure__ -low-density-structure-RS=__ITEM__low-density-structure__ -low-density-structure-nanotubes=__ITEM__low-density-structure__ se-low-density-structure-beryllium=__ITEM__low-density-structure__ dirty-water-filtration-graphite=Фильтрация грязной воды [item=flake-graphite] diff --git a/locale/zh-CN/bzcarbon.cfg b/locale/zh-CN/bzcarbon.cfg index c910830..2ea5d6d 100644 --- a/locale/zh-CN/bzcarbon.cfg +++ b/locale/zh-CN/bzcarbon.cfg @@ -56,6 +56,7 @@ nanotubes=一种有用的高级材料 graphite=__ITEM__graphite__ graphite-dust=__ITEM__graphite-dust__ synthetic-diamond=__ITEM__diamond__ +graphite-synthesis=石墨合成 diamond-processing=__ITEM__diamond__ graphene=__ITEM__graphene__ heavy-water-graphene=[fluid=heavy-water](__ITEM__graphene__) @@ -64,9 +65,6 @@ nanotubes=__ITEM__nanotubes__ carbon-black=__ITEM__carbon-black__ graphite-carbon-black=__ITEM__graphite__(__ITEM__carbon-black__) nanomaterial-nanotubes=__ITEM__se-nanomaterial__(__ITEM__nanotubes__) -low-density-structure=__ITEM__low-density-structure__ -low-density-structure-RS=__ITEM__low-density-structure__ -low-density-structure-nanotubes=__ITEM__low-density-structure__ se-low-density-structure-beryllium=__ITEM__low-density-structure__ dirty-water-filtration-graphite=过滤脏水[item=flake-graphite] @@ -111,4 +109,4 @@ bzcarbon-reuse-yes=启用 bzcarbon-reuse-no=不启用 [mod-name] -bzcarbon=BZ-石墨和金刚石 \ No newline at end of file +bzcarbon=BZ-石墨和金刚石 diff --git a/me.lua b/me.lua index 528de5b..d34ad63 100644 --- a/me.lua +++ b/me.lua @@ -1,6 +1,8 @@ local me = {} me.name = "bzcarbon" +me.resources = {} -- see end of file + me.list = {} me.recipes = { -- recipes that allow productivity @@ -22,8 +24,13 @@ me.recipes = { -- recipes that allow productivity -- NOTE: Carbon black recipes do not allow prod modules } +function has_mod(name) + if mods then return mods[name] end + if script.active_mods then return script.active_mods[name] end +end + function me.use_fiber() - return me.get_setting("bzcarbon-enable-carbon-fiber") == "yes" + return mods["space-age"] or me.get_setting("bzcarbon-enable-carbon-fiber") == "yes" end function me.use_fullerenes() @@ -42,11 +49,11 @@ function me.use_carbon_black() end function me.use_rough_diamond() - return mods["rso-mod"] or me.get_setting("bzcarbon-enable-rough-diamond") == "yes" + return has_mod("rso-mod") or has_mod("space-age") or me.get_setting("bzcarbon-enable-rough-diamond") == "yes" end function me.use_flake_graphite() - return mods["rso-mod"] or me.get_setting("bzcarbon-enable-flake-graphite") == "yes" + return has_mod("rso-mod") or me.get_setting("bzcarbon-enable-flake-graphite") == "yes" end function me.foundry_enable() @@ -73,15 +80,12 @@ function me.add_modified(name) end end -me.crucible_ingredients = {"tungsten-plate", "zirconia", "silica"} -if (mods and mods.bzaluminum) or (game and game.active_mods and game.active_mods.bzaluminum) then - table.insert(me.crucible_ingredients, "alumina") -else - table.insert(me.crucible_ingredients, "stone-brick") -end +me.crucible_ingredients = {"zirconia", "silica", "alumina", "stone-brick"} me.furnaces = { "electric-furnace", + "foundry", -- Space Age + "basic-foundry", -- BZ Tin "electric-foundry", -- BZ "industrial-furnace", -- AAI "se-casting-machine", -- SE @@ -102,5 +106,15 @@ me.furnaces = { "5d-industrial-furnace", } +if me.use_flake_graphite() then + table.insert(me.resources, {"graphite", "nauvis"}) +end +if me.use_rough_diamond() then + if has_mod("space-age") then + table.insert(me.resources, {"diamond", "vulcanus"}) + else + table.insert(me.resources, {"diamond", "nauvis"}) + end +end return me diff --git a/low-density-structure-nanotubes.lua b/nanotubes-final.lua similarity index 75% rename from low-density-structure-nanotubes.lua rename to nanotubes-final.lua index 94025ec..6871c46 100644 --- a/low-density-structure-nanotubes.lua +++ b/nanotubes-final.lua @@ -3,4 +3,5 @@ local cutil = require("carbon-util") if util.me.use_fullerenes() then cutil.nanotube_recipe("low-density-structure") + cutil.nanotube_recipe("space-platform-foundation") end diff --git a/prototypes/activated-carbon.lua b/prototypes/activated-carbon.lua new file mode 100644 index 0000000..c56e301 --- /dev/null +++ b/prototypes/activated-carbon.lua @@ -0,0 +1,63 @@ +local util = require("data-util"); + +if mods["space-age"] then +local precursor = "solid-fuel" +if mods["wood-industry"] then precursor = "charcoal" end + data:extend({ + { + type = "item", + name = "activated-carbon", + icon = "__bzcarbon__/graphics/icons/activated-carbon.png", + icon_size = 128, + subgroup = "intermediate-product", + order = "g[activated-carbon]", + stack_size = util.get_stack_size(100), + }, + { + type = "recipe", + name = "activated-carbon", + category = "chemistry", + order = "d[graphite-carbon-fiber]", + enabled = false, + energy_required = 2.5, + ingredients = data.raw.fluid["ammonia"] and + { + util.item(precursor), + util.fluid("steam"), + (mods.bztitanium or mods.bzzirconium) and util.fluid("vacuum") or nil + }, + results = { + {type="item", name= "activated-carbon", amount=1}, + }, + }, + }) + if util.me.use_carbon_black() then + data:extend({ + { + type = "recipe", + name = "activated-carbon-black", + localised_name = {"item-name.activated-carbon"}, + icons = { + { icon = "__bzcarbon__/graphics/icons/activated-carbon.png", icon_size = 128}, + { icon = "__bzcarbon__/graphics/icons/carbon-black.png", icon_size = 64, scale = 0.25, shift = {-8, -8}}, + }, + category = "chemistry", + order = "d[graphite-carbon-fiber]", + enabled = false, + energy_required = 2.5, + ingredients = data.raw.fluid["ammonia"] and + { + util.item("carbon-black", 5), + util.fluid("steam"), + (mods.bztitanium or mods.bzzirconium) and util.fluid("vacuum") or nil + }, + results = { + {type="item", name= "activated-carbon", amount=1}, + }, + }, + }) + end + util.add_unlock("advanced-oil-processing", "activated-carbon") + util.add_unlock("advanced-oil-processing", "activated-carbon-black") + util.add_ingredient("supercapacitor", "activated-carbon", 10) +end diff --git a/prototypes/basic-crusher.lua b/prototypes/basic-crusher.lua new file mode 100644 index 0000000..506eb88 --- /dev/null +++ b/prototypes/basic-crusher.lua @@ -0,0 +1,184 @@ +local futil = require("util") +local util = require("data-util"); +local item_sounds = require("__base__.prototypes.item_sounds") +local sounds = require("__base__.prototypes.entity.sounds") +local hit_effects = require("__base__.prototypes.entity.hit-effects") + +if mods["space-age"] and not data.raw.furnace["basic-crusher"] then +-- note that crusher is a space age asset and as such can only be used with space age + +local graphics = require("__space-age__.prototypes.entity.crusher-pictures") +graphics.integration_patch.north.scale = graphics.integration_patch.north.scale * 0.5 +graphics.integration_patch.east.scale = graphics.integration_patch.east.scale * 0.5 +graphics.integration_patch.south.scale = graphics.integration_patch.south.scale * 0.5 +graphics.integration_patch.west.scale = graphics.integration_patch.west.scale * 0.5 +graphics.animation.north.layers[1].scale = graphics.animation.north.layers[1].scale * 0.5 +graphics.animation.north.layers[2].scale = graphics.animation.north.layers[2].scale * 0.5 +graphics.animation.south.layers[1].scale = graphics.animation.south.layers[1].scale * 0.5 +graphics.animation.south.layers[2].scale = graphics.animation.south.layers[2].scale * 0.5 +graphics.animation.east.layers[1].scale = graphics.animation.east.layers[1].scale * 0.5 +graphics.animation.east.layers[2].scale = graphics.animation.east.layers[2].scale * 0.5 +graphics.animation.west.layers[1].scale = graphics.animation.west.layers[1].scale * 0.5 +graphics.animation.west.layers[2].scale = graphics.animation.west.layers[2].scale * 0.5 +graphics.working_visualisations.layers.north_animation.scale = graphics.working_visualisations.layers.north_animation.scale * 0.5 +graphics.working_visualisations.layers.east_animation.scale = graphics.working_visualisations.layers.east_animation.scale * 0.5 +graphics.working_visualisations.layers.south_animation.scale = graphics.working_visualisations.layers.south_animation.scale * 0.5 +graphics.working_visualisations.layers.west_animation.scale = graphics.working_visualisations.layers.west_animation.scale * 0.5 + +graphics.integration_patch.north.shift[1] = graphics.integration_patch.north.shift[1] * 0.5 +graphics.integration_patch.north.shift[2] = graphics.integration_patch.north.shift[2] * 0.5 +graphics.integration_patch.south.shift[1] = graphics.integration_patch.south.shift[1] * 0.5 +graphics.integration_patch.south.shift[2] = graphics.integration_patch.south.shift[2] * 0.5 +graphics.integration_patch.east.shift[1] = graphics.integration_patch.east.shift[1] * 0.5 +graphics.integration_patch.east.shift[2] = graphics.integration_patch.east.shift[2] * 0.5 +graphics.integration_patch.west.shift[1] = graphics.integration_patch.west.shift[1] * 0.5 +graphics.integration_patch.west.shift[2] = graphics.integration_patch.west.shift[2] * 0.5 +graphics.animation.north.layers[1].shift[1] = graphics.animation.north.layers[1].shift[1] * 0.5 +graphics.animation.north.layers[1].shift[2] = graphics.animation.north.layers[1].shift[2] * 0.5 +graphics.animation.north.layers[2].shift[1] = graphics.animation.north.layers[2].shift[1] * 0.5 +graphics.animation.north.layers[2].shift[2] = graphics.animation.north.layers[2].shift[2] * 0.5 +graphics.animation.south.layers[1].shift[1] = graphics.animation.south.layers[1].shift[1] * 0.5 +graphics.animation.south.layers[1].shift[2] = graphics.animation.south.layers[1].shift[2] * 0.5 +graphics.animation.south.layers[2].shift[1] = graphics.animation.south.layers[2].shift[1] * 0.5 +graphics.animation.south.layers[2].shift[2] = graphics.animation.south.layers[2].shift[2] * 0.5 +graphics.animation.east.layers[1].shift[1] = graphics.animation.east.layers[1].shift[1] * 0.5 +graphics.animation.east.layers[1].shift[2] = graphics.animation.east.layers[1].shift[2] * 0.5 +graphics.animation.east.layers[2].shift[1] = graphics.animation.east.layers[2].shift[1] * 0.5 +graphics.animation.east.layers[2].shift[2] = graphics.animation.east.layers[2].shift[2] * 0.5 +graphics.animation.west.layers[1].shift[1] = graphics.animation.west.layers[1].shift[1] * 0.5 +graphics.animation.west.layers[1].shift[2] = graphics.animation.west.layers[1].shift[2] * 0.5 +graphics.animation.west.layers[2].shift[1] = graphics.animation.west.layers[2].shift[1] * 0.5 +graphics.animation.west.layers[2].shift[2] = graphics.animation.west.layers[2].shift[2] * 0.5 +graphics.working_visualisations.layers.north_animation.shift[1] = graphics.working_visualisations.layers.north_animation.shift[1] * 0.5 +graphics.working_visualisations.layers.north_animation.shift[2] = graphics.working_visualisations.layers.north_animation.shift[2] * 0.5 +graphics.working_visualisations.layers.south_animation.shift[1] = graphics.working_visualisations.layers.south_animation.shift[1] * 0.5 +graphics.working_visualisations.layers.south_animation.shift[2] = graphics.working_visualisations.layers.south_animation.shift[2] * 0.5 +graphics.working_visualisations.layers.east_animation.shift[1] = graphics.working_visualisations.layers.east_animation.shift[1] * 0.5 +graphics.working_visualisations.layers.east_animation.shift[2] = graphics.working_visualisations.layers.east_animation.shift[2] * 0.5 +graphics.working_visualisations.layers.west_animation.shift[1] = graphics.working_visualisations.layers.west_animation.shift[1] * 0.5 +graphics.working_visualisations.layers.west_animation.shift[2] = graphics.working_visualisations.layers.west_animation.shift[2] * 0.5 + + +util.add_new_crafting_category("basic-crushing", true) + +data:extend({ + { + type = "item", + name = "basic-crusher", + icon = "__space-age__/graphics/icons/crusher.png", + subgroup = "production-machine", + order = "s[crusher]", + inventory_move_sound = item_sounds.drill_inventory_move, + pick_sound = item_sounds.drill_inventory_pickup, + drop_sound = item_sounds.drill_inventory_move, + place_result = "basic-crusher", + stack_size = 10, + weight = 50*kg + }, + { + type = "furnace", + name = "basic-crusher", + source_inventory_size = 1, + result_inventory_size = 1, + icon = "__space-age__/graphics/icons/crusher.png", + flags = {"placeable-neutral", "placeable-player", "player-creation"}, + minable = {mining_time = 0.5, result = "basic-crusher"}, + -- fast_replaceable_group = "", + max_health = 350, + corpse = "electric-furnace-remnants", + dying_explosion = "electric-furnace-explosion", + circuit_wire_max_distance = 9, + circuit_connector = circuit_connector_definitions["crusher"], + resistances = + { + { + type = "fire", + percent = 80 + } + }, + collision_box = {{-0.4, -0.8}, {0.4, 0.8}}, + -- collision_box = {{-0.7, -1.2}, {0.7, 1.2}}, + surface_conditions = + { + { + property = "gravity", + min = 0.1, + -- max = + } + }, + selection_box = {{-.5, -1}, {.5, 1}}, + damaged_trigger_effect = hit_effects.entity(), + module_slots = 0, + icons_positioning = + { + {inventory_index = defines.inventory.furnace_modules, shift = {0, 0.3}} + }, + icon_draw_specification = { scale=0.5}, + allowed_effects = {"consumption", "speed", "productivity", "pollution", "quality"}, + crafting_categories = {"basic-crushing"}, + crafting_speed = 2, + energy_usage = "100kW", + heating_energy = "200kW", + energy_source = + { + type = "electric", + usage_priority = "secondary-input", + emissions_per_minute = { pollution = 1 } + }, + open_sound = sounds.electric_large_open, + close_sound = sounds.electric_large_close, + working_sound = + { + sound = + { + filename = "__space-age__/sound/entity/crusher/crusher-loop.ogg", + volume = 0.8 + }, + audible_distance_modifier = 0.6, + fade_in_ticks = 4, + fade_out_ticks = 20, + max_sounds_per_type = 3 + }, + graphics_set = graphics, + water_reflection = + { + pictures = + { + filename = "__space-age__/graphics/entity/crusher/crusher-reflection.png", + priority = "extra-high", + width = 24, + height = 24, + shift = futil.by_pixel(5, 40-32), + variation_count = 1, + scale = 5 + }, + rotate = false, + orientation_to_variation = false + } + }, + { + type = "recipe", + name = "basic-crusher", + enabled = false, + ingredients = + { + {type = "item", name = "steel-plate", amount = 10}, + {type = "item", name = "iron-plate", amount = 10}, + {type = "item", name = "iron-gear-wheel", amount = 10}, + + }, + energy_required = 2.5, + results = {{type="item", name="basic-crusher", amount=1}} + }, +}) +if mods["aai-industry"] then + util.add_unlock("sand-processing", "basic-crusher") + util.add_prerequisite("sand-processing", "steel-processing") +else + util.add_unlock("automation-2", "basic-crusher") +end +util.add_prerequisite("silica-processing", "automation-2") +end +-- For graphite we can't have steel as an ingredient. +util.remove_ingredient("basic-crusher", "steel-plate") +util.add_to_ingredient("basic-crusher", "iron-plate", 20) diff --git a/prototypes/carbon-fiber.lua b/prototypes/carbon-fiber.lua new file mode 100644 index 0000000..39d8637 --- /dev/null +++ b/prototypes/carbon-fiber.lua @@ -0,0 +1,123 @@ +local util = require("data-util"); + +if util.me.use_fiber() then +if mods["space-age"] then + -- ammonia from spoilage for polyacrylonitrile and for graphene + data:extend({ + { + type = "recipe", + name = "ammonia-from-spoilage", + category = "organic", + icons = { + {icon = "__space-age__/graphics/icons/fluid/ammonia.png", icon_size = 64}, + {icon = "__space-age__/graphics/icons/spoilage.png", icon_size = 64, scale= 0.25, shift = {-8,-8}}, + }, + enabled = false, + energy_required = 5, + ingredients = { + util.item("spoilage", 1), + }, + results = { + util.fluid("ammonia", 10), + }, + } + }) +end +data:extend({ + { + type = "item", + name = "polyacrylonitrile", + icon = "__bzcarbon__/graphics/icons/pan.png", + icon_size = 128, + subgroup = "intermediate-product", + order = "g[graphite-acrylic-fiber]", + stack_size = util.get_stack_size(100), + }, + { + type = "recipe", + name = "polyacrylonitrile", + category = "chemistry", + order = "d[graphite-carbon-fiber]", + enabled = false, + energy_required = 1, + ingredients = data.raw.fluid["ammonia"] and + { + {type="fluid", name="petroleum-gas", amount=5}, + {type="fluid", name="ammonia", amount=5}, + } or { + {type="fluid", name="petroleum-gas", amount=10}, + }, + results = { + {type="item", name= "polyacrylonitrile", amount=1}, + }, + }, +}) +if mods["space-age"] then + util.set_category("polyacrylonitrile", "organic") + util.remove_ingredient("polyacrylonitrile", "petroleum-gas") + util.add_ingredient("polyacrylonitrile", "jelly", 10) + util.add_ingredient("polyacrylonitrile", "jelly", 10) + util.add_ingredient("polyacrylonitrile", "ammonia", 10) + util.add_ingredient("carbon-fiber", "ammonia", 10) + util.replace_ingredient("carbon-fiber", "carbon", "polyacrylonitrile") + util.set_item_icons("carbon-fiber", { {icon = "__bzcarbon__/graphics/icons/carbon-fiber.png", icon_size = 128,} }) + util.add_unlock("biochamber", "ammonia-from-spoilage") +else + data:extend({ + { + type = "item", + name = "carbon-fiber", + icon = "__bzcarbon__/graphics/icons/carbon-fiber.png", + icon_size = 128, + subgroup = "intermediate-product", + order = "g[graphite-carbon-fiber]", + stack_size = util.get_stack_size(100), + }, + { + type = "recipe", + name = "carbon-fiber", + category = "advanced-crafting", + order = "d[graphite-carbon-fiber]", + enabled = false, + energy_required = 24, + ingredients = { + {type="fluid", name="epoxy", amount = 20}, + {"plastic-bar", 2}, + {"polyacrylonitrile", 4}, + }, + results = { + {type="item", name= "carbon-fiber", amount=8}, + }, + }, + }) + data:extend({ + { + type = "technology", + name = "carbon-fiber", + icon_size = 256, + icon = "__bzcarbon__/graphics/technology/carbon-fiber.png", + effects = { + {type="unlock-recipe", recipe="polyacrylonitrile"}, + {type="unlock-recipe", recipe="carbon-fiber"}, + }, + unit = + { + count = 30, + ingredients = + { + {"automation-science-pack", 1}, + {"logistic-science-pack", 1}, + {"chemical-science-pack", 1}, + }, + time = 10, + }, + prerequisites = {"chemical-science-pack", "plastics"}, + order = "b-b" + }, + }) + util.replace_some_ingredient("carbon-fiber", "plastic", 1, "silica", 2, {force=true}) + util.add_prerequisite("low-density-structure", "carbon-fiber") + util.add_prerequisite("exoskeleton-equipment", "carbon-fiber") + util.add_prerequisite("military-3", "carbon-fiber") +end +end diff --git a/diamond-particle.lua b/prototypes/diamond-particle.lua similarity index 100% rename from diamond-particle.lua rename to prototypes/diamond-particle.lua diff --git a/diamond.lua b/prototypes/diamond.lua similarity index 54% rename from diamond.lua rename to prototypes/diamond.lua index 5c432f3..7b7acf5 100644 --- a/diamond.lua +++ b/prototypes/diamond.lua @@ -1,26 +1,35 @@ local resource_autoplace = require('resource-autoplace'); -local noise = require('noise'); local util = require("data-util"); if util.me.use_rough_diamond() then +local planet = mods["space-age"] and "vulcanus" or "nauvis" + +resource_autoplace.initialize_patch_set("diamond", true) +data.raw.planet[planet].map_gen_settings.autoplace_controls["diamond"] = {} +data.raw.planet[planet].map_gen_settings.autoplace_settings.entity.settings["diamond"] = {} +if mods.tenebris then + data.raw.planet.tenebris.map_gen_settings.autoplace_controls["diamond"] = {} + data.raw.planet.tenebris.map_gen_settings.autoplace_settings.entity.settings["diamond"] = {} +end + data:extend({ { type = "autoplace-control", category = "resource", name = "diamond", richness = true, - order = "b-e" - }, - { - type = "noise-layer", - name = "diamond" + order = mods["space-age"] and "b-d-a" or "a-g", }, + -- { + -- type = "noise-layer", + -- name = "diamond" + -- }, { type = "resource", - icon_size = 64, icon_mipmaps = 3, name = "diamond", icon = "__bzcarbon__/graphics/icons/rough-diamond.png", + icon_size = 128, flags = {"placeable-neutral"}, order="a-b-a", map_color = {r=0.30, g=0.54, b=0.92}, @@ -35,45 +44,38 @@ data:extend({ autoplace = resource_autoplace.resource_autoplace_settings{ name = "diamond", - order = "b-z", - base_density = 0.5, - base_spots_per_km2 = 0.5, - has_starting_area_placement = false, - regular_rq_factor_multiplier = 0.6, + order = mods["space-age"] and "b-d-a" or "a-g", + base_density = mods["space-age"] and 6 or 0.5, + base_spots_per_km2 = mods["space-age"] and 1.3 or 0.5, + has_starting_area_placement = not not mods["space-age"], + regular_rq_factor_multiplier = mods["space-age"] and 1 or 0.6, }, stage_counts = {15000, 9500, 5500, 2900, 1300, 400, 150, 80}, - stages = - { - sheet = - { - filename = "__bzcarbon__/graphics/entity/ores/diamond.png", - priority = "extra-high", - size = 64, - frame_count = 8, - variation_count = 8, - hr_version = + stages = + { + sheet = { - filename = "__bzcarbon__/graphics/entity/ores/hr-diamond.png", + filename = "__bzcarbon__/graphics/entity/ores/hr-diamond.png", priority = "extra-high", size = 128, frame_count = 8, variation_count = 8, scale = 0.5 } - } }, }, { type = "item", name = "rough-diamond", - icon_size = 64, icon_mipmaps = 3, + icon_size = 128, icon = "__bzcarbon__/graphics/icons/rough-diamond.png", pictures = { - {filename="__bzcarbon__/graphics/icons/rough-diamond.png", size=64, scale=0.25}, - {filename="__bzcarbon__/graphics/icons/rough-diamond-1.png", size=64, scale=0.25}, - {filename="__bzcarbon__/graphics/icons/rough-diamond-2.png", size=64, scale=0.25}, - {filename="__bzcarbon__/graphics/icons/rough-diamond-3.png", size=64, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/rough-diamond.png", size=128, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/rough-diamond-1.png", size=128, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/rough-diamond-2.png", size=128, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/rough-diamond-3.png", size=128, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/rough-diamond-4.png", size=128, scale=0.25}, }, subgroup = "raw-resource", order = "t-c-a", diff --git a/graphite-particle.lua b/prototypes/graphite-particle.lua similarity index 53% rename from graphite-particle.lua rename to prototypes/graphite-particle.lua index ea8a9df..703192f 100644 --- a/graphite-particle.lua +++ b/prototypes/graphite-particle.lua @@ -8,135 +8,71 @@ data:extend( pictures = { { - filename = "__bzcarbon__/graphics/entity/particle/graphite-particle-1.png", - priority = "extra-high", - width = 16, - height = 16, - frame_count = 1, - hr_version = - { filename = "__bzcarbon__/graphics/entity/particle/hr-graphite-particle-1.png", priority = "extra-high", width = 32, height = 32, frame_count = 1, scale = 0.5 - } }, { - filename = "__bzcarbon__/graphics/entity/particle/graphite-particle-2.png", - priority = "extra-high", - width = 16, - height = 16, - frame_count = 1, - hr_version = - { filename = "__bzcarbon__/graphics/entity/particle/hr-graphite-particle-2.png", priority = "extra-high", width = 32, height = 32, frame_count = 1, scale = 0.5 - } }, { - filename = "__bzcarbon__/graphics/entity/particle/graphite-particle-3.png", - priority = "extra-high", - width = 16, - height = 16, - frame_count = 1, - hr_version = - { filename = "__bzcarbon__/graphics/entity/particle/hr-graphite-particle-3.png", priority = "extra-high", width = 32, height = 32, frame_count = 1, scale = 0.5 - } }, { - filename = "__bzcarbon__/graphics/entity/particle/graphite-particle-4.png", - priority = "extra-high", - width = 16, - height = 16, - frame_count = 1, - hr_version = - { filename = "__bzcarbon__/graphics/entity/particle/hr-graphite-particle-4.png", priority = "extra-high", width = 32, height = 32, frame_count = 1, scale = 0.5 - } } }, shadows = { { - filename = "__bzcarbon__/graphics/entity/particle/graphite-particle-shadow-1.png", - priority = "extra-high", - width = 16, - height = 16, - frame_count = 1, - hr_version = - { filename = "__bzcarbon__/graphics/entity/particle/hr-graphite-particle-shadow-1.png", priority = "extra-high", width = 32, height = 32, frame_count = 1, scale = 0.5 - } }, { - filename = "__bzcarbon__/graphics/entity/particle/graphite-particle-shadow-2.png", - priority = "extra-high", - width = 16, - height = 16, - frame_count = 1, - hr_version = - { filename = "__bzcarbon__/graphics/entity/particle/hr-graphite-particle-shadow-2.png", priority = "extra-high", width = 32, height = 32, frame_count = 1, scale = 0.5 - } }, { - filename = "__bzcarbon__/graphics/entity/particle/graphite-particle-shadow-3.png", - priority = "extra-high", - width = 16, - height = 16, - frame_count = 1, - hr_version = - { filename = "__bzcarbon__/graphics/entity/particle/hr-graphite-particle-shadow-3.png", priority = "extra-high", width = 32, height = 32, frame_count = 1, scale = 0.5 - } }, { - filename = "__bzcarbon__/graphics/entity/particle/graphite-particle-shadow-4.png", - priority = "extra-high", - width = 16, - height = 16, - frame_count = 1, - hr_version = - { filename = "__bzcarbon__/graphics/entity/particle/hr-graphite-particle-shadow-4.png", priority = "extra-high", width = 32, height = 32, frame_count = 1, scale = 0.5 - } } } } diff --git a/graphite.lua b/prototypes/graphite.lua similarity index 66% rename from graphite.lua rename to prototypes/graphite.lua index 01e3adb..ee7c5db 100644 --- a/graphite.lua +++ b/prototypes/graphite.lua @@ -1,8 +1,16 @@ local resource_autoplace = require('resource-autoplace'); -local noise = require('noise'); local util = require("data-util"); +resource_autoplace.initialize_patch_set("graphite", true) +data.raw.planet.nauvis.map_gen_settings.autoplace_controls["graphite"] = {} +data.raw.planet.nauvis.map_gen_settings.autoplace_settings.entity.settings["graphite"] = {} +if mods.tenebris then + data.raw.planet.tenebris.map_gen_settings.autoplace_controls["graphite"] = {} + data.raw.planet.tenebris.map_gen_settings.autoplace_settings.entity.settings["graphite"] = {} +end + + if util.me.use_flake_graphite() then data:extend({ { @@ -10,17 +18,17 @@ data:extend({ category = "resource", name = "graphite", richness = true, - order = "b-e" - }, - { - type = "noise-layer", - name = "graphite" + order = "a-g" }, + -- { + -- type = "noise-layer", + -- name = "graphite" + -- }, { type = "resource", - icon_size = 64, icon_mipmaps = 3, name = "graphite", icon = "__bzcarbon__/graphics/icons/flake-graphite.png", + icon_size = 128, flags = {"placeable-neutral"}, order="a-b-a", map_color = {r=0.18, g=0.17, b=0.30}, @@ -38,7 +46,7 @@ data:extend({ autoplace = resource_autoplace.resource_autoplace_settings{ name = "graphite", - order = "b-z", + order = "a-g", base_density = 6, base_spots_per_km2 = 1, has_starting_area_placement = true, @@ -47,37 +55,30 @@ data:extend({ }, stage_counts = {15000, 9500, 5500, 2900, 1300, 400, 150, 80}, - stages = - { - sheet = - { - filename = "__bzcarbon__/graphics/entity/ores/graphite.png", - priority = "extra-high", - size = 64, - frame_count = 8, - variation_count = 8, - hr_version = + stages = + { + sheet = { - filename = "__bzcarbon__/graphics/entity/ores/hr-graphite.png", + filename = "__bzcarbon__/graphics/entity/ores/hr-graphite.png", priority = "extra-high", size = 128, frame_count = 8, variation_count = 8, scale = 0.5 } - } }, }, { type = "item", name = "flake-graphite", - icon_size = 64, icon_mipmaps = 3, + icon_size = 128, icon = "__bzcarbon__/graphics/icons/flake-graphite.png", pictures = { - {filename="__bzcarbon__/graphics/icons/flake-graphite.png", size=64, scale=0.25}, - {filename="__bzcarbon__/graphics/icons/flake-graphite-1.png", size=64, scale=0.25}, - {filename="__bzcarbon__/graphics/icons/flake-graphite-2.png", size=64, scale=0.25}, - {filename="__bzcarbon__/graphics/icons/flake-graphite-3.png", size=64, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/flake-graphite.png", size=128, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/flake-graphite-1.png", size=128, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/flake-graphite-2.png", size=128, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/flake-graphite-3.png", size=128, scale=0.25}, + {filename="__bzcarbon__/graphics/icons/flake-graphite-4.png", size=128, scale=0.25}, }, subgroup = "raw-resource", order = "t-c-a", diff --git a/settings.lua b/settings.lua index 8367c31..996a706 100644 --- a/settings.lua +++ b/settings.lua @@ -23,15 +23,6 @@ data:extend({ allowed_values = {"no", "yes"}, order = "b2", }, - { - type = "string-setting", - name = "bzcarbon-enable-rough-diamond", - setting_type = "startup", - hidden = not not mods["rso-mod"], - default_value = mods["rso-mod"] and "yes" or "no", - allowed_values = {"no", "yes"}, - order = "d1", - }, { type = "string-setting", name = "bzcarbon-enable-flake-graphite", @@ -58,6 +49,19 @@ data:extend({ }, }) +if not mods["space-age"] and not mods["rso-mod"] then + data:extend({ + { + type = "string-setting", + name = "bzcarbon-enable-rough-diamond", + setting_type = "startup", + hidden = not not mods["rso-mod"], + default_value = mods["rso-mod"] and "yes" or "no", + allowed_values = {"no", "yes"}, + order = "d1", + }, + }) +end if mods.bzchlorine then data:extend({ {