From 274de48840df277ae048d59516a21ae03af6d2e4 Mon Sep 17 00:00:00 2001 From: Brevven Date: Thu, 20 Jan 2022 00:44:33 -0800 Subject: [PATCH] setting for flake-graphite --- carbon-recipe-final-rrr.lua | 3 +-- carbon-recipe.lua | 44 +++++++++++++++++++++++++++++++++++++ changelog.txt | 10 +++++++++ graphite.lua | 2 ++ info.json | 1 + locale/en/carbon.cfg | 5 +++++ map-gen-preset-updates.lua | 21 +++++++++++++++--- settings.lua | 9 ++++++++ strange-matter.lua | 3 +-- 9 files changed, 91 insertions(+), 7 deletions(-) diff --git a/carbon-recipe-final-rrr.lua b/carbon-recipe-final-rrr.lua index 401815c..a5c7274 100644 --- a/carbon-recipe-final-rrr.lua +++ b/carbon-recipe-final-rrr.lua @@ -1,6 +1,6 @@ local util = require("__bzcarbon__.data-util"); -if mods["Rich-Rocks-Requiem"] then +if util.me.use_flake_graphite() and mods["Rich-Rocks-Requiem"] then if data.raw.recipe["rrr-stone-processing"] then table.insert(data.raw.recipe["rrr-stone-processing"].results, {name = "flake-graphite", probability = 0.35, amount = 1} @@ -12,5 +12,4 @@ if mods["Rich-Rocks-Requiem"] then {name = "flake-graphite", probability = 0.65, amount = 10} ) end - end diff --git a/carbon-recipe.lua b/carbon-recipe.lua index 0aca73c..f6a06a4 100644 --- a/carbon-recipe.lua +++ b/carbon-recipe.lua @@ -78,6 +78,48 @@ data:extend({ }, }) +-- If no graphite ore, make it from coal or coke +if not util.me.use_flake_graphite() then + if data.raw.item["coke"] then + data:extend({ + { + type = "recipe", + name = "graphite", + icon = "__bzcarbon__/graphics/icons/graphite.png", icon_size=128, + category = mods.bzfoundry and "founding" or "advanced-crafting", + order = "d[graphite]", + enabled = false, + energy_required = 0.5, + ingredients = {{"coke", 1}}, + results = {{"graphite", 2}}, + } + }) + else + data:extend({ + { + type = "recipe", + name = "graphite", + icon = "__bzcarbon__/graphics/icons/graphite.png", icon_size=128, + category = mods.bzfoundry and "founding" or "advanced-crafting", + subgroup = data.raw.item.graphite.subgroup, + order = "d[graphite]", + enabled = false, + energy_required = 0.5, + ingredients = {{"coal", 1}}, + results = {{"graphite", 1}, {type="item", name="stone", amount=1, probability=0.05}}, + } + }) + end + util.add_prerequisite("graphite-processing", "foundry") + + -- Increase richness of coal a bit + local noise = require('noise'); + data.raw.resource["coal"].autoplace.richness_expression = + data.raw.resource["coal"].autoplace.richness_expression * noise.to_noise_expression(1.5) +end + + + if mods.Krastorio2 then util.add_prerequisite("graphite-processing", "kr-crusher") @@ -85,6 +127,8 @@ else util.add_prerequisite("graphite-processing", "automation") end + + if mods["space-exploration"] and not mods.Krastorio2 then data:extend({ { diff --git a/changelog.txt b/changelog.txt index 57f2e80..d8bf9cb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,14 @@ --------------------------------------------------------------------------------------------------- +Version: 0.0.20 +Date: 2022-01-19 + Features: + - New setting to remove flake graphite + Changes: + - Minor tech tree tweaks + - Repair pack recipe tweak + - Minor 5d compatibility improvements + - Minor FE+ compatibility improvements +--------------------------------------------------------------------------------------------------- Version: 0.0.19 Date: 2022-01-18 Fixes: diff --git a/graphite.lua b/graphite.lua index a646683..a101533 100644 --- a/graphite.lua +++ b/graphite.lua @@ -3,6 +3,7 @@ local noise = require('noise'); local util = require("__bzcarbon__.data-util"); +if util.me.use_flake_graphite() then data:extend({ { type = "autoplace-control", @@ -83,3 +84,4 @@ data:extend({ stack_size = util.get_stack_size(50) }, }) +end diff --git a/info.json b/info.json index be0f524..74daf91 100644 --- a/info.json +++ b/info.json @@ -10,6 +10,7 @@ "base >= 1.1.0", "? bztitanium", "? bzzirconium", + "? bzfoundry", "? space-exploration", "? aai-industry", "? Krastorio2", diff --git a/locale/en/carbon.cfg b/locale/en/carbon.cfg index 9f72de3..3d349bd 100644 --- a/locale/en/carbon.cfg +++ b/locale/en/carbon.cfg @@ -69,6 +69,7 @@ bzcarbon-list=Make a list of modified recipes bzcarbon-enable-fullerenes=Enable fullerenes & nanotubes bzcarbon-enable-carbon-black=Enable carbon black bzcarbon-enable-rough-diamond=Enable diamond mining +bzcarbon-enable-flake-graphite=Enable flake graphite bzcarbon-reuse=Reuse grinding grit [mod-setting-description] @@ -77,4 +78,8 @@ bzcarbon-list=If enabled, the text command [color=orange]BZList[/color] will dum bzcarbon-enable-fullerenes=Enable the fullerenes & nanotubes intermediate products.\nFullerenes are used primarily in bio-related things. Nanotubes for structures. bzcarbon-enable-carbon-black=Enable carbon black byproduct. Primarily used to make plastics. bzcarbon-enable-rough-diamond=Enables diamond ore patches for new games. +bzcarbon-enable-flake-graphite=Enables graphite ore patches. Recommended to leave this on. Turning off will remove existing ore patches. bzcarbon-reuse=A chance to reuse diamond grinding grit in recipes like LDS. More complex, but saves resources. + +[string-mod-setting] +bzcarbon-enable-flake-graphite-yes=yes - recommended diff --git a/map-gen-preset-updates.lua b/map-gen-preset-updates.lua index 571a500..424b672 100644 --- a/map-gen-preset-updates.lua +++ b/map-gen-preset-updates.lua @@ -1,10 +1,25 @@ -if data.raw["map-gen-presets"] and data.raw["map-gen-presets"].default then - for name, preset in pairs(data.raw["map-gen-presets"].default) do - if type(preset) == "table" and +local util = require("data-util"); +if util.me.use_flake_graphite() then + if data.raw["map-gen-presets"] and data.raw["map-gen-presets"].default then + for name, preset in pairs(data.raw["map-gen-presets"].default) do + if type(preset) == "table" and preset.basic_settings and preset.basic_settings.autoplace_controls and preset.basic_settings.autoplace_controls["iron-ore"] then preset.basic_settings.autoplace_controls["graphite"] = preset.basic_settings.autoplace_controls["iron-ore"] + end + end + end +end +if util.me.use_rough_diamond() then + if data.raw["map-gen-presets"] and data.raw["map-gen-presets"].default then + for name, preset in pairs(data.raw["map-gen-presets"].default) do + if type(preset) == "table" and + preset.basic_settings and + preset.basic_settings.autoplace_controls and + preset.basic_settings.autoplace_controls["iron-ore"] then + preset.basic_settings.autoplace_controls["diamond"] = preset.basic_settings.autoplace_controls["iron-ore"] + end end end end diff --git a/settings.lua b/settings.lua index ea921e1..7ea9a09 100644 --- a/settings.lua +++ b/settings.lua @@ -24,9 +24,18 @@ 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"}, }, + { + type = "string-setting", + name = "bzcarbon-enable-flake-graphite", + setting_type = "startup", + hidden = not not mods["rso-mod"], + default_value = "yes", + allowed_values = {"no", "yes"}, + }, { type = "bool-setting", name = "bzcarbon-list", diff --git a/strange-matter.lua b/strange-matter.lua index 78a72c2..b2b36a4 100644 --- a/strange-matter.lua +++ b/strange-matter.lua @@ -1,10 +1,9 @@ local util = require("data-util"); - local ore = "flake-graphite" local ore_icon = "__bzcarbon__/graphics/icons/flake-graphite.png" -if mods["StrangeMatter"] then +if util.me.use_flake_graphite() and mods["StrangeMatter"] then data:extend({ { type = "recipe",