improved recipe logic

This commit is contained in:
mamoniot
2023-03-27 12:23:48 -04:00
parent 0a08fdb0b6
commit 2df2f70b25
4 changed files with 33 additions and 10 deletions

1
TODO
View File

@@ -33,3 +33,4 @@ compat:
cargo ships
editor extensions (test surface separation)
train fuel types for refuelers
automatic recipe creation

View File

@@ -3,6 +3,8 @@ Version: 1.2.14
Date: 2023-3-14
Features:
- Added opt-in WIP trains, inventory, and station manager gui (highly experimental, use at your own risk)
Changes:
- Improved the recipe derivation logic for the cybernetic combinator, in all modpacks it should now consistently be about as difficult to craft as an arthmetic combinator. Vanilla recipe is unchanged, but several overhaul mods will receive new recipes.
Bugfixes:
- Provider override thresholds now correctly override the required train capacity as well; fix contributed by shopt
- Fixed a rare crash relating to an uninitialized network mask on a new station

View File

@@ -1,10 +1,29 @@
flib = require("__flib__.table")
require('scripts.constants')
--Credit to modo-lv for submitting the following code
if mods["nullius"] then
-- Place combinator in the same subgroup as the regular train stop
data.raw["recipe"][COMBINATOR_NAME].subgroup = data.raw["train-stop"]["train-stop"].subgroup
data.raw["item"][COMBINATOR_NAME].subgroup = data.raw["item"]["train-stop"].subgroup
-- Nullius makes modded technologies part of its research tree
-- Place combinator in the same place on the research tree as LTN
table.insert(data.raw.technology["nullius-broadcasting-1"].prerequisites, "cybersyn-train-network")
-- Place combinator in the same subgroup as the regular train stop
data.raw["recipe"][COMBINATOR_NAME].subgroup = data.raw["train-stop"]["train-stop"].subgroup
data.raw["item"][COMBINATOR_NAME].subgroup = data.raw["item"]["train-stop"].subgroup
-- Nullius makes modded technologies part of its research tree
-- Place combinator in the same place on the research tree as LTN
table.insert(data.raw.technology["nullius-broadcasting-1"].prerequisites, "cybersyn-train-network")
end
-- Reset the combinator recipe back to arithmetic combinator recipe in case a mod has changed it
local recipe = flib.deep_copy(data.raw["recipe"]["arithmetic-combinator"].ingredients)
for k, _ in pairs(recipe) do
local mult = 2
for i, _ in pairs(recipe) do
if recipe[k][i] == "copper-cable" then
mult = 4
end
end
for i, _ in pairs(recipe) do
if type(recipe[k][i]) == "number" then
recipe[k][i] = mult*recipe[k][i]
end
end
end
data.raw["recipe"][COMBINATOR_NAME].ingredients = recipe

View File

@@ -1,9 +1,10 @@
--By Mami
combinator_recipe = flib.copy_prototype(data.raw["recipe"]["arithmetic-combinator"], COMBINATOR_NAME)
combinator_recipe.ingredients = {
{"copper-cable", 20},
{"electronic-circuit", 10},
}
--- Recipe is set in data-fixes-final, but in vanilla it should match below
--combinator_recipe.ingredients = {
-- {"copper-cable", 20},
-- {"electronic-circuit", 10},aww
--}
combinator_recipe.enabled = false
combinator_recipe.subgroup = data.raw["recipe"]["train-stop"].subgroup