This commit is contained in:
Brevven 2023-03-27 19:57:52 -07:00
parent 4d9e1fbec4
commit da1978423b

View file

@ -130,6 +130,7 @@ function util.k2matter(params)
if not params.k2matter.minimum_conversion_quantity then
params.k2matter.minimum_conversion_quantity = 10
end
if not data.raw.technology[params.k2matter.unlocked_by_technology] then
data:extend(
{
{
@ -157,6 +158,7 @@ function util.k2matter(params)
}
},
})
end
matter.createMatterRecipe(params.k2matter)
end
@ -533,6 +535,8 @@ end
function add_product(recipe, product)
if recipe ~= nil then
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}}
@ -543,6 +547,7 @@ function add_product(recipe, product)
end
end
end
end
-- Get the amount of the ingredient, will check base/normal not expensive
function util.get_ingredient_amount(recipe_name, ingredient_name)
@ -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,12 +1267,14 @@ 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 :|
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
end
function util.replace_ingredients_prior_to(tech, old, new, multiplier)
if not data.raw.technology[tech] then
@ -1300,11 +1312,13 @@ 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 :|
if string.sub(prerequisite, 1, 3) ~= 'ei_' then
replace_ingredients_prior_to(prerequisite, old, new, multiplier)
end
end
end
end
end
function util.remove_all_recipe_effects(recipe_name)
for name, _ in pairs(data.raw.technology) do