This commit is contained in:
Brevven 2023-04-10 00:21:58 -07:00
parent f61c5ec5c2
commit 4255e2d9f8
2 changed files with 46 additions and 28 deletions

View file

@ -20,4 +20,10 @@ function util.get_list()
end
end
function util.force_enable_recipe(event, recipe_name)
if game.players[event.player_index].force.recipes[recipe_name] then
game.players[event.player_index].force.recipes[recipe_name].enabled=true
end
end
return util

View file

@ -130,33 +130,35 @@ function util.k2matter(params)
if not params.k2matter.minimum_conversion_quantity then
params.k2matter.minimum_conversion_quantity = 10
end
data:extend(
{
if not data.raw.technology[params.k2matter.unlocked_by_technology] then
data:extend(
{
type = "technology",
name = params.k2matter.unlocked_by_technology,
icons =
{
type = "technology",
name = params.k2matter.unlocked_by_technology,
icons =
{
icon = util.k2assets().."/technologies/matter-"..params.k2baseicon..".png",
icon_size = 256,
{
icon = util.k2assets().."/technologies/matter-"..params.k2baseicon..".png",
icon_size = 256,
},
params.icon,
},
params.icon,
prerequisites = {"kr-matter-processing"},
unit =
{
count = 350,
ingredients =
{
{"production-science-pack", 1},
{"utility-science-pack", 1},
{"matter-tech-card", 1}
},
time = 45,
}
},
prerequisites = {"kr-matter-processing"},
unit =
{
count = 350,
ingredients =
{
{"production-science-pack", 1},
{"utility-science-pack", 1},
{"matter-tech-card", 1}
},
time = 45,
}
},
})
})
end
matter.createMatterRecipe(params.k2matter)
end
@ -533,13 +535,16 @@ end
function add_product(recipe, product)
if recipe ~= nil then
if not recipe.normal then
if recipe.results == nil then
recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}}
if (product[1] and data.raw.item[product[1]]) or
(product.name and data.raw[product.type][product.name]) then
if not recipe.normal then
if recipe.results == nil then
recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}}
end
recipe.result = nil
recipe.result_count = nil
table.insert(recipe.results, product)
end
recipe.result = nil
recipe.result_count = nil
table.insert(recipe.results, product)
end
end
end
@ -1045,6 +1050,13 @@ function util.add_icon(recipe_name, icon, options)
icon_size=data.raw.item[data.raw.recipe[recipe_name].result].icon_size,
icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].result].icon_mipmaps,
}}
elseif data.raw.recipe[recipe_name].normal and
data.raw.item[data.raw.recipe[recipe_name].normal.result] then
data.raw.recipe[recipe_name].icons = {{
icon=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon,
icon_size=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon_size,
icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon_mipmaps,
}}
end
data.raw.recipe[recipe_name].icon = nil
data.raw.recipe[recipe_name].icon_size = nil