se 0.6
This commit is contained in:
parent
cc87165e94
commit
0cd1812fe7
4 changed files with 57 additions and 16 deletions
|
|
@ -1,4 +1,9 @@
|
|||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.11.0
|
||||
Date: 2022-07-01
|
||||
Changes:
|
||||
- Compatible with Space Exploration 0.6
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.10.0
|
||||
Date: 2022-06-26
|
||||
Features:
|
||||
|
|
|
|||
|
|
@ -170,15 +170,16 @@ end
|
|||
-- Add a given quantity of ingredient to a given recipe
|
||||
function util.add_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
|
||||
local is_fluid = not not data.raw.fluid[ingredient]
|
||||
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then
|
||||
me.add_modified(recipe_name)
|
||||
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
||||
add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
|
||||
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
|
||||
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid)
|
||||
add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity, is_fluid)
|
||||
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity, is_fluid)
|
||||
end
|
||||
end
|
||||
|
||||
function add_ingredient(recipe, ingredient, quantity)
|
||||
function add_ingredient(recipe, ingredient, quantity, is_fluid)
|
||||
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
|
||||
|
|
@ -186,8 +187,12 @@ function add_ingredient(recipe, ingredient, quantity)
|
|||
return
|
||||
end
|
||||
end
|
||||
if is_fluid then
|
||||
table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity})
|
||||
else
|
||||
table.insert(recipe.ingredients, {ingredient, quantity})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add a given ingredient prototype to a given recipe
|
||||
|
|
@ -268,7 +273,7 @@ end
|
|||
-- Replace one ingredient with another in a recipe
|
||||
function util.replace_ingredient(recipe_name, old, new)
|
||||
if me.bypass[recipe_name] then return end
|
||||
if data.raw.recipe[recipe_name] and data.raw.item[new] then
|
||||
if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then
|
||||
me.add_modified(recipe_name)
|
||||
replace_ingredient(data.raw.recipe[recipe_name], old, new)
|
||||
replace_ingredient(data.raw.recipe[recipe_name].normal, old, new)
|
||||
|
|
@ -320,15 +325,16 @@ end
|
|||
-- Replace an amount of an ingredient in a recipe. Keep at least 1 of old.
|
||||
function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amount)
|
||||
if me.bypass[recipe_name] then return end
|
||||
if data.raw.recipe[recipe_name] and data.raw.item[new] then
|
||||
local is_fluid = not not data.raw.fluid[new]
|
||||
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
|
||||
me.add_modified(recipe_name)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount, is_fluid)
|
||||
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount, is_fluid)
|
||||
end
|
||||
end
|
||||
|
||||
function replace_some_ingredient(recipe, old, old_amount, new, new_amount)
|
||||
function replace_some_ingredient(recipe, old, old_amount, new, new_amount, is_fluid)
|
||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||
for i, existing in pairs(recipe.ingredients) do
|
||||
if existing[1] == new or existing.name == new then
|
||||
|
|
@ -344,7 +350,7 @@ function replace_some_ingredient(recipe, old, old_amount, new, new_amount)
|
|||
ingredient[2] = math.max(1, ingredient[2] - old_amount)
|
||||
end
|
||||
end
|
||||
add_ingredient(recipe, new, new_amount)
|
||||
add_ingredient(recipe, new, new_amount, is_fluid)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -447,6 +453,20 @@ function remove_product(recipe, old)
|
|||
end
|
||||
end
|
||||
|
||||
function util.set_main_product(recipe_name, product)
|
||||
if data.raw.recipe[recipe_name] then
|
||||
set_main_product(data.raw.recipe[recipe_name], product)
|
||||
set_main_product(data.raw.recipe[recipe_name].normal, product)
|
||||
set_main_product(data.raw.recipe[recipe_name].expensive, product)
|
||||
end
|
||||
end
|
||||
|
||||
function set_main_product(recipe, product)
|
||||
if recipe then
|
||||
recipe.main_product = product
|
||||
end
|
||||
end
|
||||
|
||||
-- Replace one product with another in a recipe
|
||||
function util.replace_product(recipe_name, old, new)
|
||||
if data.raw.recipe[recipe_name] then
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bzsilicon",
|
||||
"version": "0.10.0",
|
||||
"version": "0.11.0",
|
||||
"factorio_version": "1.1",
|
||||
"title": "Silica & Silicon",
|
||||
"author": "Brevven",
|
||||
|
|
|
|||
|
|
@ -4,12 +4,20 @@ if mods["space-exploration"] then
|
|||
recipe = data.raw.recipe["silicon-vulcanite"]
|
||||
recipe.ingredients = {
|
||||
{"silica", 18},
|
||||
{"se-vulcanite-block", 1}
|
||||
string.sub(mods["space-exploration"], 1, 3) == "0.6" and
|
||||
{type="fluid", name="se-pyroflux", amount=10} or {"se-vulcanite-block", 1},
|
||||
}
|
||||
recipe.energy_required=21.6
|
||||
recipe.results = {
|
||||
{name = "silicon", amount = 6},
|
||||
}
|
||||
if string.sub(mods["space-exploration"], 1, 3) == "0.6" then
|
||||
table.insert(recipe.ingredients, {"coke", 1})
|
||||
recipe.icons = {
|
||||
{ icon = "__Krastorio2Assets__/icons/items-with-variations/silicon/silicon.png", icon_size = 64},
|
||||
{ icon = "__space-exploration-graphics__/graphics/icons/fluid/pyroflux.png", icon_size = 64, scale=0.25, shift= {-10, -10}},
|
||||
}
|
||||
end
|
||||
else
|
||||
se_delivery_cannon_recipes["silicon"] = {name= "silicon"}
|
||||
data:extend({
|
||||
|
|
@ -24,18 +32,26 @@ if mods["space-exploration"] then
|
|||
allow_as_intermediate = false,
|
||||
ingredients = {
|
||||
{name = "silica", amount = 20},
|
||||
{name = "se-vulcanite-block", amount = 1},
|
||||
string.sub(mods["space-exploration"], 1, 3) == "0.6" and
|
||||
{type="fluid", name="se-pyroflux", amount=10} or {"se-vulcanite-block", 1},
|
||||
},
|
||||
results = {
|
||||
{name = "silicon", amount = 3},
|
||||
},
|
||||
icons = {
|
||||
{ icon = "__bzsilicon__/graphics/icons/silicon.png", icon_size = 64, icon_mipmaps = 3 },
|
||||
string.sub(mods["space-exploration"], 1, 3) == "0.6" and
|
||||
{ icon = "__space-exploration-graphics__/graphics/icons/fluid/pyroflux.png", icon_size = 64, scale=0.25, shift= {-10, -10}} or
|
||||
{ icon = "__space-exploration-graphics__/graphics/icons/vulcanite-block.png", icon_size = 64, scale=0.25, shift= {-10, -10}},
|
||||
},
|
||||
},
|
||||
})
|
||||
if string.sub(mods["space-exploration"], 1, 3) == "0.6" then
|
||||
table.insert(data.raw.technology["se-vulcanite-smelting"].effects,
|
||||
{type = "unlock-recipe", recipe= "silicon-smelting-vulcanite"})
|
||||
else
|
||||
table.insert(data.raw.technology["se-processing-vulcanite"].effects,
|
||||
{type = "unlock-recipe", recipe= "silicon-smelting-vulcanite"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue