This commit is contained in:
Brevven 2025-03-21 21:16:22 -07:00
parent 21a0f05f7b
commit 4b48e81aab
4 changed files with 44 additions and 24 deletions

View file

@ -1,4 +1,14 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 2.0.11
Date: 2025-03-04
Changes:
- Align various electronic circuit recipes to all use graphite
---------------------------------------------------------------------------------------------------
Version: 2.0.10
Date: 2025-03-03
Fixes:
- Better avoidance of possible infinite loop across mods.
---------------------------------------------------------------------------------------------------
Version: 2.0.9 Version: 2.0.9
Date: 2025-03-03 Date: 2025-03-03
Fixes: Fixes:

View file

@ -36,19 +36,22 @@ if mods.MDbobelectronics or mods.bobelectronics then
util.replace_ingredient("basic-electronic-components", "coal", "graphite") util.replace_ingredient("basic-electronic-components", "coal", "graphite")
util.replace_ingredient("basic-electronic-components", "coke", "graphite") util.replace_ingredient("basic-electronic-components", "coke", "graphite")
else else
amt_ec = util.get_amount("electronic-circuit") -- Electronic circuits need final fixes
if amt_ec == 1 then function modify_ec(recipe_name, to_replace)
util.multiply_recipe("electronic-circuit", 2) if not to_replace then
util.set_recipe_time("electronic-circuit-stone", 0.5) -- faster but more complex to_replace = "copper-cable"
end
local amt_ec = util.get_amount(recipe_name, "electronic-circuit")
if amt_ec == 1 then
util.multiply_recipe(recipe_name, 2)
util.set_recipe_time(recipe_name, 0.5) -- faster but more complex
end
util.replace_some_ingredient(recipe_name, to_replace, 2, "graphite", 1)
end end
util.replace_some_ingredient("electronic-circuit", "copper-cable", 2, "graphite", 1) modify_ec("electronic-circuit")
-- AAI alternate green circuit modify_ec("electronic-circuit-stone")
local amt_ec = util.get_amount("electronic-circuit-stone", "electronic-circuit") modify_ec("electronic-circuit-wood")
if amt_ec == 1 then modify_ec("electronic-circuit-aluminum", "aluminum-cable")
util.multiply_recipe("electronic-circuit-stone", 2)
util.set_recipe_time("electronic-circuit-stone", 0.5) -- faster but more complex
end
util.replace_some_ingredient("electronic-circuit-stone", "copper-cable", 2, "graphite", 1)
end end
if data.raw.recipe["low-density-structure"] and if data.raw.recipe["low-density-structure"] and

View file

@ -1672,16 +1672,22 @@ end
function util.remove_prior_unlocks(tech, recipe) function util.remove_prior_unlocks(tech, recipe)
if data.raw.technology[tech].prerequisites then if data.raw.technology[tech].prerequisites then
for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do
remove_prior_unlocks(prerequisite, recipe, 0) remove_prior_unlocks(prerequisite, recipe, {})
end end
end end
end end
function remove_prior_unlocks(tech, recipe, depth) function remove_prior_unlocks(tech, recipe, processed)
if depth > 10000 then -- log("depth "..depth)
log("Infinite recursion detected, backing out.") -- if depth > 10000 then
-- log("Infinite recursion detected, backing out.")
-- return
-- end
if processed[tech] then
print("Already processed ".. tech .. " returning")
return return
end end
processed[tech] = true
local technology = data.raw.technology[tech] local technology = data.raw.technology[tech]
if technology then if technology then
log("Removing prior unlocks for ".. tech) log("Removing prior unlocks for ".. tech)
@ -1689,8 +1695,8 @@ function remove_prior_unlocks(tech, recipe, depth)
if technology.prerequisites then if technology.prerequisites then
for i, prerequisite in pairs(technology.prerequisites) do for i, prerequisite in pairs(technology.prerequisites) do
if string.sub(prerequisite, 1, 3) ~= 'ei_' then if string.sub(prerequisite, 1, 3) ~= 'ei_' then
-- log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :| log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :|
remove_prior_unlocks(prerequisite, recipe, depth+1) remove_prior_unlocks(prerequisite, recipe, processed)
end end
end end
end end
@ -1714,16 +1720,17 @@ function util.replace_ingredients_prior_to(tech, old, new, multiplier)
end end
if data.raw.technology[tech].prerequisites then if data.raw.technology[tech].prerequisites then
for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do
replace_ingredients_prior_to(prerequisite, old, new, multiplier, 0) replace_ingredients_prior_to(prerequisite, old, new, multiplier, {})
end end
end end
end end
function replace_ingredients_prior_to(tech, old, new, multiplier, depth) function replace_ingredients_prior_to(tech, old, new, multiplier, processed)
if depth > 10000 then if processed[tech] then
log("Infinite recursion detected, backing out.") print("Already processed ".. tech .. " returning")
return return
end end
processed[tech] = true
log("Replacing for tech "..tech) log("Replacing for tech "..tech)
local technology = data.raw.technology[tech] local technology = data.raw.technology[tech]
if technology then if technology then
@ -1739,7 +1746,7 @@ function replace_ingredients_prior_to(tech, old, new, multiplier, depth)
for i, prerequisite in pairs(technology.prerequisites) do for i, prerequisite in pairs(technology.prerequisites) do
-- log("BZZZ checking " .. prerequisite) -- Handy Debug :| -- log("BZZZ checking " .. prerequisite) -- Handy Debug :|
if string.sub(prerequisite, 1, 3) ~= 'ei_' then if string.sub(prerequisite, 1, 3) ~= 'ei_' then
replace_ingredients_prior_to(prerequisite, old, new, multiplier, depth + 1) replace_ingredients_prior_to(prerequisite, old, new, multiplier, processed)
end end
end end
end end

View file

@ -1,6 +1,6 @@
{ {
"name": "bzcarbon", "name": "bzcarbon",
"version": "2.0.9", "version": "2.0.11",
"factorio_version": "2.0", "factorio_version": "2.0",
"title": "Graphite & Diamonds", "title": "Graphite & Diamonds",
"author": "Brevven", "author": "Brevven",