up
This commit is contained in:
parent
4d9e1fbec4
commit
da1978423b
1 changed files with 49 additions and 35 deletions
|
|
@ -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
|
||||
|
|
@ -559,7 +564,7 @@ function util.get_ingredient_amount(recipe_name, ingredient_name)
|
|||
if ingredient.name == ingredient_name then return ingredient.amount end
|
||||
end
|
||||
end
|
||||
return 1
|
||||
return 0
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
|
@ -1008,7 +1013,7 @@ end
|
|||
-- Set recipe subgroup
|
||||
function util.set_subgroup(recipe_name, subgroup, options)
|
||||
if not should_force(options) and bypass(recipe_name) then return end
|
||||
if data.raw.recipe[recipe_name] then
|
||||
if data.raw.recipe[recipe_name] and data.raw["item-subgroup"][subgroup] then
|
||||
me.add_modified(recipe_name)
|
||||
data.raw.recipe[recipe_name].subgroup = subgroup
|
||||
end
|
||||
|
|
@ -1027,8 +1032,6 @@ function util.add_icon(recipe_name, icon, options)
|
|||
if data.raw.recipe[recipe_name] then
|
||||
me.add_modified(recipe_name)
|
||||
if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) then
|
||||
log("BZZN")
|
||||
log(serpent.dump(data.raw.recipe[recipe_name]))
|
||||
if data.raw.recipe[recipe_name].icon then
|
||||
data.raw.recipe[recipe_name].icons = {{
|
||||
icon=data.raw.recipe[recipe_name].icon,
|
||||
|
|
@ -1047,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
|
||||
|
|
@ -1257,8 +1267,10 @@ function remove_prior_unlocks(tech, recipe)
|
|||
util.remove_recipe_effect(tech, recipe)
|
||||
if technology.prerequisites then
|
||||
for i, prerequisite in pairs(technology.prerequisites) do
|
||||
log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :|
|
||||
remove_prior_unlocks(prerequisite, recipe)
|
||||
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)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1300,7 +1312,9 @@ function replace_ingredients_prior_to(tech, old, new, multiplier)
|
|||
if technology.prerequisites then
|
||||
for i, prerequisite in pairs(technology.prerequisites) do
|
||||
-- log("BZZZ checking " .. prerequisite) -- Handy Debug :|
|
||||
replace_ingredients_prior_to(prerequisite, old, new, multiplier)
|
||||
if string.sub(prerequisite, 1, 3) ~= 'ei_' then
|
||||
replace_ingredients_prior_to(prerequisite, old, new, multiplier)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue