minimal mode setting

This commit is contained in:
Brevven 2022-02-12 00:04:18 -08:00
parent 45486340c3
commit abc26a8eba
8 changed files with 63 additions and 22 deletions

View file

@ -1,6 +1,12 @@
---------------------------------------------------------------------------------------------------
Version: 0.0.12
Date: 2022-02-12
Features:
- Minimal mode setting. Only visible and used for certain mods (like Aluminum).
Intended as a workaround due to the way required dependencies work in Factorio.
Disables foundry buildings and many recipe changes. Intended to allow people to opt out of
using Foundry buildings while still letting Foundry be a required dependency for certain
other mods (like Aluminum). Founding will happen in assemblers.
Fixes:
- Processed fuel works in foundries with K2 + AAI Industry both enabled, once again.
- Refractory recipes: Productivity no longer applies to refractories

View file

@ -1,4 +1,10 @@
require("prototypes/coke")
require("prototypes/foundry")
require("prototypes/entity/foundry")
require("prototypes/entity/electric-foundry")
local util = require("data-util")
require("prototypes/categories")
if util.me.enable() then
require("prototypes/coke")
require("prototypes/foundry")
require("prototypes/entity/foundry")
require("prototypes/entity/electric-foundry")
end

View file

@ -1,21 +1,38 @@
local util = require("data-util")
util.set_to_founding("steel-plate")
util.replace_some_ingredient("steel-plate", "iron-plate", 1, util.me.carbon(), 1)
util.multiply_time("steel-plate", 4/5)
util.add_prerequisite("steel-processing", "foundry")
if util.me.enable() then
util.set_to_founding("steel-plate")
util.replace_some_ingredient("steel-plate", "iron-plate", 1, util.me.carbon(), 1)
util.multiply_time("steel-plate", 4/5)
util.add_prerequisite("steel-processing", "foundry")
util.set_to_founding("tungsten-carbide")
util.add_ingredient("tungsten-carbide", util.me.carbon(), 1)
util.set_to_founding("tungsten-carbide")
util.add_ingredient("tungsten-carbide", util.me.carbon(), 1)
util.set_to_founding("silicon")
util.add_ingredient("silicon", util.me.carbon(), 1)
util.set_to_founding("silicon")
util.add_ingredient("silicon", util.me.carbon(), 1)
util.set_to_founding("cermet") -- from zirconium
util.set_to_founding("crucible") -- from graphite
util.set_to_founding("cermet") -- from zirconium
util.set_to_founding("crucible") -- from graphite
else
-- If we're not using Foundry buildings, add founding recipes to assemblers in vanilla, or furnaces in K2
local sought = mods.Krastorio2 and "smelting" or "crafting"
log ("looking for "..sought)
for i, machine in pairs(data.raw["assembling-machine"]) do
log(serpent.dump(machine))
for j, category in pairs(machine.crafting_categories) do
if category == sought then
log ("found "..category)
util.add_crafting_category("assembling-machine", machine.name, "founding")
break
end
end
end
util.add_crafting_category("assembling-machine", "inustrial-furnace", "founding")
util.add_crafting_category("assembling-machine", "kr-advanced-furnace", "founding")
end
-- K2
for i, machine in pairs(util.me.get_other_machines()) do
log("Allowing "..machine.." to handle founding")
util.add_crafting_category("assembling-machine", machine, "founding")

View file

@ -39,10 +39,12 @@ bzfoundry-smelt=Foundry can smelt
bzfoundry-plates=Add refractory recipes (experimental)
bzfoundry-hydrocarbon=Hydrocarbon for founding
bzfoundry-other-machines=Other machines that can do founding
bzfoundry-minimal=Minimal mode (remove buildings)
[mod-setting-description]
bzfoundry-recipe-bypass=Skip modifying these recipes (comma-separated list).
bzfoundry-smelt=If true, the foundry building can also handle raw ore smelting.
bzfoundry-hydrocarbon=Which hydrocarbon to use for founding. The foundry building is also used for coking.\nIf [color=cyan]coke[/color], a coke item and recipe is added, if needed.\nIf [color=cyan]solid fuel[/color], an early but inefficient recipe is added.\nIf [color=cyan]coal[/color], that is used.\nIf [color=cyan]none[/color], no hydrocarbon is used in founding (not recommended).
bzfoundry-other-machines=List of other "assembling-machine" entities that can do "founding" recipes. Eg. Krastorio2's "kr-advanced-furnace", or AAII's "industrial-furnace" (comma-separated list).
bzfoundry-plates=[color=orange]EXPERIMENTAL[/color] Ingredients, products, or anything might change.\nRequires "Silica & Silicon", "Zirconium", or "Graphite & Diamonds" mod.\nUsing one or more refractories, Foundries can increase output of plates.\nBe warned, these are complex recipes.
bzfoundry-plates=[color=orange]EXPERIMENTAL[/color] Ingredients, products, or anything might change.\nUsing one or more refractories, foundries can increase output of plates.\nBe warned, these are complex recipes.
bzfoundry-minimal=[color=yellow]Use with caution![/color]\nIntended as a workaround for Factorio's required mod dependency system. Disables foundry buildings and recipe changes that rely on them. Allows you to play without Foundry with Aluminum, while still letting Foundry be a required dependency with default mod settings.

4
me.lua
View file

@ -10,6 +10,10 @@ function me.smelt()
return me.get_setting("bzfoundry-smelt")
end
function me.enable()
return not me.get_setting("bzfoundry-minimal")
end
function me.carbon()
return me.get_setting("bzfoundry-hydrocarbon")
end

View file

@ -0,0 +1,5 @@
data:extend({
{ type = "recipe-category", name = "founding"},
{ type = "item-subgroup", name = "founding-machines", group = "production"},
{ type = "item-subgroup", name = "foundry-intermediate", group = "intermediate-products"},
})

View file

@ -1,11 +1,5 @@
local util = require("data-util")
data:extend({
{ type = "recipe-category", name = "founding"},
{ type = "item-subgroup", name = "founding-machines", group = "production"},
{ type = "item-subgroup", name = "foundry-intermediate", group = "intermediate-products"},
})
local foundry_ingredients = {{"stone-brick", 20}, {"iron-plate", 10}, {"copper-plate", 5}}
if mods.bzlead then table.insert(foundry_ingredients, {"lead-plate", 8}) end
if mods.Krastorio2 or mods["aai-industry"] then

View file

@ -32,4 +32,11 @@ data:extend({
default_value = "no",
allowed_values = {"yes", "no"},
},
{
type = "bool-setting",
name = "bzfoundry-minimal",
setting_type = "startup",
default_value = false,
hidden = not mods.bzaluminum
},
})