From 22c5f9ddc7f053f054171131d8ec979613c53188 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Thu, 13 Feb 2025 21:40:17 +0100 Subject: [PATCH] Add Technology:addEffect --- cf-lib/changelog.txt | 23 ++++++++++++++--------- cf-lib/data/Technology.lua | 6 ++++++ cf-lib/info.json | 22 +++++++++++----------- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/cf-lib/changelog.txt b/cf-lib/changelog.txt index 808c2cf..c6224f2 100644 --- a/cf-lib/changelog.txt +++ b/cf-lib/changelog.txt @@ -1,10 +1,15 @@ ---------------------------------------------------------------------------------------------------- -Version: 0.0.3 -Date: 02.02.2025 - Changes: - - Prevent duplicate entries when adding a recipe to a technology ---------------------------------------------------------------------------------------------------- -Version: 0.0.2 -Date: 07.01.2025 - Changes: +--------------------------------------------------------------------------------------------------- +Version: 0.0.4 +Date: 13.02.2025 + Changes: + - Add Technology:addEffect +--------------------------------------------------------------------------------------------------- +Version: 0.0.3 +Date: 02.02.2025 + Changes: + - Prevent duplicate entries when adding a recipe to a technology +--------------------------------------------------------------------------------------------------- +Version: 0.0.2 +Date: 07.01.2025 + Changes: - Add Technology class \ No newline at end of file diff --git a/cf-lib/data/Technology.lua b/cf-lib/data/Technology.lua index d6d82f1..88b947f 100644 --- a/cf-lib/data/Technology.lua +++ b/cf-lib/data/Technology.lua @@ -140,6 +140,12 @@ function Technology:addRecipe(recipeName) table.insert(self.prototype.effects, { type = "unlock-recipe", recipe = recipeName }) end +--- Adds an effect to the technology +--- @param effect table The effect to add +function Technology:addEffect(effect) + table.insert(self.prototype.effects, effect) +end + --- Removes a recipe unlock from the technology --- @param recipeName string The name of the recipe to remove function Technology:removeRecipe(recipeName) diff --git a/cf-lib/info.json b/cf-lib/info.json index fce8837..088a838 100644 --- a/cf-lib/info.json +++ b/cf-lib/info.json @@ -1,12 +1,12 @@ -{ - "name": "cf-lib", - "version": "0.0.3", - "title": "cackling fiends library", - "description": "Because I'd like to have my own library :-)", - "author": "cackling fiend", - "homepage": "", - "factorio_version": "2.0", - "dependencies": [ - "base" - ] +{ + "name": "cf-lib", + "version": "0.0.4", + "title": "cackling fiends library", + "description": "Because I'd like to have my own library :-)", + "author": "cackling fiend", + "homepage": "", + "factorio_version": "2.0", + "dependencies": [ + "base" + ] } \ No newline at end of file