early salt

This commit is contained in:
Brevven 2022-12-24 01:10:39 -08:00
parent 4cd19cbf64
commit f75300f659
22 changed files with 107 additions and 22 deletions

View file

@ -6,6 +6,9 @@ Date: 2022-12-24
- Without "more intermediates", PCB can be made in normal chem plant
Changes:
- Thumbnail tweak
- Early game salt: New setting to choose one or both of
From water in fluid-enabled tier 1 assemblers (or tier 0 with AAI Industry) (default)
A starting area salt patch, and more salt near starting area
- SE: Less salt in core mining
- SE: thermofluid basic recipe requires salt
Features:

View file

@ -6,7 +6,41 @@ require("map-gen-preset-updates")
-- require("compatibility/248k")
require("compatibility/bob")
local util = require("data-util");
local futil = require("util")
local util = require("data-util")
if util.me.early_assemblers() then
util.add_crafting_category("assembling-machine", "assembling-machine-1", "crafting-with-fluid")
data.raw["assembling-machine"]["assembling-machine-1"].fluid_boxes = futil.table.deepcopy(data.raw["assembling-machine"]["assembling-machine-2"].fluid_boxes)
for i, fb in pairs(data.raw["assembling-machine"]["assembling-machine-1"].fluid_boxes) do
if i ~= "off_when_no_fluid_recipe" and fb.pipe_picture then
fb.pipe_picture.north.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-N.png"
fb.pipe_picture.north.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png"
fb.pipe_picture.south.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-S.png"
fb.pipe_picture.south.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png"
fb.pipe_picture.east.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-E.png"
fb.pipe_picture.east.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png"
fb.pipe_picture.west.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-W.png"
fb.pipe_picture.west.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png"
end
end
if data.raw["assembling-machine"]["burner-assembling-machine"] then
util.add_crafting_category("assembling-machine", "burner-assembling-machine", "crafting-with-fluid")
data.raw["assembling-machine"]["burner-assembling-machine"].fluid_boxes = futil.table.deepcopy(data.raw["assembling-machine"]["assembling-machine-2"].fluid_boxes)
for i, fb in pairs(data.raw["assembling-machine"]["burner-assembling-machine"].fluid_boxes) do
if i ~= "off_when_no_fluid_recipe" and fb.pipe_picture then
fb.pipe_picture.north.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-N.png"
fb.pipe_picture.north.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png"
fb.pipe_picture.south.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-S.png"
fb.pipe_picture.south.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png"
fb.pipe_picture.east.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-E.png"
fb.pipe_picture.east.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png"
fb.pipe_picture.west.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-W.png"
fb.pipe_picture.west.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png"
end
end
end
end
require("modules")

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

@ -36,6 +36,7 @@ bzchlorine-recipe-bypass=Bypass recipes
bzchlorine-list=Make a list of modified recipes
bzchlorine-salt=Generate mineable salt patches
bzchlorine-more-intermediates=Enable more chloride intermediates
bzchlorine-early-salt=How to get salt early game
[mod-setting-description]
bzchlorine-recipe-bypass=Skip modifying these recipes (comma-separated list).
@ -44,3 +45,6 @@ bzchlorine-list=If enabled, the text command [color=orange]BZList[/color] will d
[string-mod-setting]
bzchlorine-more-intermediates-no=No
bzchlorine-more-intermediates-yes=Yes: Ferric chloride & vinyl chloride
bzchlorine-early-salt-assembler=In early assemblers (enable fluid inputs)
bzchlorine-early-salt-mining=A starting area patch to mine (requires minable salt patches)
bzchlorine-early-salt-both=Both of the above

15
me.lua
View file

@ -3,6 +3,21 @@ local me = {}
me.name = "bzchlorine"
me.list = {}
function me.starting_patch()
return (
me.get_setting("bzchlorine-early-salt") == "mining" or
me.get_setting("bzchlorine-early-salt") == "both"
)
end
function me.early_assemblers()
return (
me.get_setting("bzchlorine-early-salt") == "assembler" or
me.get_setting("bzchlorine-early-salt") == "both" or
(not me.salt())
)
end
function me.more()
if me.get_setting("bz-all-intermediates") then return true end
return me.get_setting("bzchlorine-more-intermediates") == "yes"

View file

@ -42,6 +42,7 @@ data:extend({
base_density = 3,
base_spots_per_km2 = 2,
regular_rq_factor_multiplier = 2.0,
has_starting_area_placement = util.me.starting_patch(),
},
stage_counts = {15000, 9500, 5500, 2900, 1300, 400, 150, 80},
@ -71,22 +72,24 @@ data:extend({
local richness = data.raw.resource["salt"].autoplace.richness_expression
local probability = data.raw.resource["salt"].autoplace.probability_expression
-- Modify salt autoplace richness:
-- After 500 tiles it's standard
-- After 300 tiles it scales up
data.raw.resource["salt"].autoplace.richness_expression =
richness * noise.if_else_chain(
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(500)),
(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")) - 275)/475,
1)
if not util.me.starting_patch() then
-- Modify salt autoplace richness:
-- After 500 tiles it's standard
-- After 250 tiles it scales up
data.raw.resource["salt"].autoplace.richness_expression =
richness * noise.if_else_chain(
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(500)),
(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")) - 275)/475,
1)
data.raw.resource["salt"].autoplace.probability_expression =
probability * noise.if_else_chain(
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(299)),
0,
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(300)),
0.3,
1)
data.raw.resource["salt"].autoplace.probability_expression =
probability * noise.if_else_chain(
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(249)),
0,
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(250)),
0.3,
1)
end
end
data:extend({
@ -111,13 +114,27 @@ data:extend({
name = "salt",
result = "salt",
ingredients = {{type="fluid", name="water", amount=100}},
enabled = false,
category = mods.Krastorio2 and "fluid-filtration" or "crafting-with-fluid",
energy_required = mods.Krastorio2 and 1 or 2,
enabled = not not mods["aai-industry"],
category = "crafting-with-fluid",
energy_required = 2,
},
})
if mods.Krastorio2 then
util.add_unlock("kr-fluids-chemistry", "salt")
else
util.add_unlock("fluid-handling", "salt")
data:extend({
{
type = "recipe",
name = "salt-filtration",
result = "salt",
ingredients = {{type="fluid", name="water", amount=100}},
enabled = false,
category = mods.Krastorio2 and "fluid-filtration",
energy_required = 0.4,
},
})
end
if mods.Krastorio2 then
util.add_unlock("kr-fluids-chemistry", "salt-filtration")
end
if not mods["aai-industry"] then
util.add_unlock("automation", "salt")
end

View file

@ -5,24 +5,36 @@ data:extend({
setting_type = "startup",
default_value = "",
allow_blank = true,
order = "a",
},
{
type = "bool-setting",
name = "bzchlorine-list",
setting_type = "startup",
default_value = false,
order = "b",
},
{
type = "bool-setting",
name = "bzchlorine-salt",
setting_type = "startup",
default_value = true,
order = "c1",
},
{
type = "string-setting",
name = "bzchlorine-early-salt",
setting_type = "startup",
default_value = "assembler",
allowed_values = {"assembler", "mining", "both"},
order = "c2",
},
{
type = "string-setting",
name = "bzchlorine-more-intermediates",
setting_type = "startup",
default_value = "yes",
allowed_values = {"yes", "no"},
order = "d",
},
})