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
Date: 2025-03-03
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", "coke", "graphite")
else
amt_ec = util.get_amount("electronic-circuit")
if amt_ec == 1 then
util.multiply_recipe("electronic-circuit", 2)
util.set_recipe_time("electronic-circuit-stone", 0.5) -- faster but more complex
-- Electronic circuits need final fixes
function modify_ec(recipe_name, to_replace)
if not to_replace then
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
util.replace_some_ingredient("electronic-circuit", "copper-cable", 2, "graphite", 1)
-- AAI alternate green circuit
local amt_ec = util.get_amount("electronic-circuit-stone", "electronic-circuit")
if amt_ec == 1 then
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)
modify_ec("electronic-circuit")
modify_ec("electronic-circuit-stone")
modify_ec("electronic-circuit-wood")
modify_ec("electronic-circuit-aluminum", "aluminum-cable")
end
if data.raw.recipe["low-density-structure"] and

View file

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

View file

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