From 8ea483b31ce9cac421cec3c2d55df162350cbbee Mon Sep 17 00:00:00 2001 From: Brevven Date: Sat, 14 Jan 2023 22:01: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 3373bb2..00af70d 100644 --- a/data-util.lua +++ b/data-util.lua @@ -312,6 +312,21 @@ function util.add_unlock(technology_name, recipe) util.add_effect(technology_name, {type="unlock-recipe", recipe=recipe}) end +-- Check if a tech unlocks a recipe +function util.check_unlock(technology_name, recipe) + local technology = data.raw.technology[technology_name] + if technology and technology.effects then + for i, effect in pairs(technology.effects) do + if effect.type == "unlock-recipe" and effect.recipe == recipe_name then + return true + end + end + end + return false +end + + + -- remove recipe unlock effect from a given technology, multiple times if necessary function util.remove_recipe_effect(technology_name, recipe_name) local technology = data.raw.technology[technology_name]