From 7f61825b87ad5d409d1ec4a7a652f46290041787 Mon Sep 17 00:00:00 2001 From: Brevven Date: Mon, 16 Jan 2023 19:05:09 -0800 Subject: [PATCH] up --- data-util.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/data-util.lua b/data-util.lua index 00af70d..4c4cd1e 100644 --- a/data-util.lua +++ b/data-util.lua @@ -546,6 +546,21 @@ function util.get_amount(recipe_name, product) return 0 end +-- Get the count of results +function util.get_result_count(recipe_name, product) + if not product then product = recipe_name end + local recipe = data.raw.recipe[recipe_name] + if recipe then + if recipe.normal and recipe.normal.results then + return #(recipe.normal.results) + elseif recipe.results then + return #(recipe.results) + end + return 1 + end + return 0 +end + -- Replace one ingredient with another in a recipe -- Use amount to set an amount. If that amount is a multiplier instead of an exact amount, set multiply true. function util.replace_ingredient(recipe_name, old, new, amount, multiply, options)