From 2ffa368ea4ae67482346d276865dc839f2ce1a58 Mon Sep 17 00:00:00 2001 From: Brevven Date: Sun, 29 May 2022 23:07:10 -0700 Subject: [PATCH] up --- data-util.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/data-util.lua b/data-util.lua index d700645..6ce0745 100644 --- a/data-util.lua +++ b/data-util.lua @@ -54,6 +54,19 @@ function util.contains(table, sought) return false end +-- Set/override a technology's prerequisites +function util.set_prerequisite(technology_name, prerequisites) + local technology = data.raw.technology[technology_name] + if technology then + technology.prerequisites = {} + for i, prerequisite in pairs(prerequisites) do + if data.raw.technology[prerequisite] then + table.insert(technology.prerequisites, prerequisite) + end + end + end +end + -- Add a prerequisite to a given technology function util.add_prerequisite(technology_name, prerequisite) local technology = data.raw.technology[technology_name]