new burner phase

This commit is contained in:
Brevven 2022-01-11 21:07:52 -08:00
parent 9039bd2d84
commit 5c2e5e78cc
6 changed files with 83 additions and 5 deletions

View file

@ -11,8 +11,8 @@ util.add_prerequisite("laser-turret", "diamond-processing")
util.add_prerequisite("power-armor-mk2", "graphene") util.add_prerequisite("power-armor-mk2", "graphene")
util.add_prerequisite("rocket-control-unit", "graphene") util.add_prerequisite("rocket-control-unit", "graphene")
if mods.Krastorio2 then
util.add_prerequisite("electronics", "graphite-processing") util.add_prerequisite("electronics", "graphite-processing")
if mods.Krastorio2 then
util.add_prerequisite("graphite-processing", "kr-crusher") util.add_prerequisite("graphite-processing", "kr-crusher")
end end

View file

@ -76,7 +76,6 @@ data:extend({
prerequisites = {"automation"}, prerequisites = {"automation"},
order = "b-b" order = "b-b"
}, },
}) })
if mods["space-exploration"] and not mods.Krastorio2 then if mods["space-exploration"] and not mods.Krastorio2 then

View file

@ -1,4 +1,14 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 0.0.13
Date: 2022-01-12
Changes:
- Move electric drill back before electronics to avoid deadlock.
---------------------------------------------------------------------------------------------------
Version: 0.0.12
Date: 2022-01-08
Changes:
- Change burner phase vanilla recipes a bit to avoid possible deadlocks
---------------------------------------------------------------------------------------------------
Version: 0.0.11 Version: 0.0.11
Date: 2022-01-06 Date: 2022-01-06
Changes: Changes:

View file

@ -41,6 +41,22 @@ for i, furnace in pairs(util.me.furnaces) do
end end
end end
if not mods.Krastorio2 and not mods["aai-industry"] then
util.replace_ingredient("offshore-pump", "electronic-circuit", "copper-cable")
util.replace_ingredient("lab", "electronic-circuit", "copper-cable")
util.replace_ingredient("electric-mining-drill", "electronic-circuit", "copper-cable")
util.replace_ingredient("assembling-machine-1", "electronic-circuit", "copper-plate")
util.replace_ingredient("radar", "electronic-circuit", "copper-plate")
util.add_effect("electronics", { type = "unlock-recipe", recipe = "electronic-circuit" })
util.add_effect("electronics", { type = "unlock-recipe", recipe = "inserter" })
util.add_effect("electronics", { type = "unlock-recipe", recipe = "long-handed-inserter" })
util.remove_recipe_effect("automation", "long-handed-inserter")
util.set_enabled("electronic-circuit", false)
util.set_enabled("inserter", false)
end
util.set_enabled("electric-mining-drill", true)
-- Must be last -- Must be last
util.create_list() util.create_list()

View file

@ -77,14 +77,33 @@ function util.remove_prerequisite(technology_name, prerequisite)
end end
end end
-- Add an effect to a given technology -- Add an effect to a given technology
function util.add_effect(technology_name, effect) function util.add_effect(technology_name, effect)
local technology = data.raw.technology[technology_name] local technology = data.raw.technology[technology_name]
if technology then if technology then
if not technology.effects then technology.effects = {} end
table.insert(technology.effects, effect) table.insert(technology.effects, effect)
end end
end end
-- remove recipe unlock effect from a given technology
function util.remove_recipe_effect(technology_name, recipe_name)
local technology = data.raw.technology[technology_name]
local index = -1
if technology then
for i, effect in pairs(technology.effects) do
if effect.type == "unlock-recipe" and effect.recipe == recipe_name then
index = i
break
end
end
if index > -1 then
table.remove(technology.effects, index)
end
end
end
-- Set technology ingredients -- Set technology ingredients
function util.set_tech_recipe(technology_name, ingredients) function util.set_tech_recipe(technology_name, ingredients)
local technology = data.raw.technology[technology_name] local technology = data.raw.technology[technology_name]
@ -93,6 +112,37 @@ function util.set_tech_recipe(technology_name, ingredients)
end end
end end
function util.set_enabled(recipe_name, enabled)
if data.raw.recipe[recipe_name] then
if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.enabled = enabled end
if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.enabled = enabled end
if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].enabled = enabled end
end
end
-- Add a given quantity of ingredient to a given recipe
function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
me.add_modified(recipe_name)
add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
add_or_add_to_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
add_or_add_to_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
end
end
function add_or_add_to_ingredient(recipe, ingredient, quantity)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == ingredient or existing.name == ingredient then
add_to_ingredient(recipe, ingredient, quantity)
return
end
end
table.insert(recipe.ingredients, {ingredient, quantity})
end
end
-- Add a given quantity of ingredient to a given recipe -- Add a given quantity of ingredient to a given recipe
function util.add_ingredient(recipe_name, ingredient, quantity) function util.add_ingredient(recipe_name, ingredient, quantity)
if me.bypass[recipe_name] then return end if me.bypass[recipe_name] then return end
@ -115,7 +165,6 @@ function add_ingredient(recipe, ingredient, quantity)
table.insert(recipe.ingredients, {ingredient, quantity}) table.insert(recipe.ingredients, {ingredient, quantity})
end end
end end
-- Add a given quantity of product to a given recipe. -- Add a given quantity of product to a given recipe.
-- Only works for recipes with multiple products -- Only works for recipes with multiple products
function util.add_product(recipe_name, product) function util.add_product(recipe_name, product)
@ -338,6 +387,10 @@ end
-- Remove an element of type t and name from data.raw -- Remove an element of type t and name from data.raw
function util.remove_raw(t, name) function util.remove_raw(t, name)
if not data.raw[t] then
log(t.." not found in data.raw")
return
end
if data.raw[t][name] then if data.raw[t][name] then
for i, elem in pairs(data.raw[t]) do for i, elem in pairs(data.raw[t]) do
if elem.name == name then if elem.name == name then
@ -438,7 +491,7 @@ function add_to_ingredient(recipe, it, amount)
return return
end end
if ingredient[1] == it then if ingredient[1] == it then
ingredient[2] = ingredients[2] + amount ingredient[2] = ingredient[2] + amount
return return
end end
end end

View file

@ -1,6 +1,6 @@
{ {
"name": "bzcarbon", "name": "bzcarbon",
"version": "0.0.11", "version": "0.0.13",
"factorio_version": "1.1", "factorio_version": "1.1",
"title": "Graphite & Diamonds", "title": "Graphite & Diamonds",
"author": "Brevven", "author": "Brevven",