diff --git a/boblibrary/changelog.txt b/boblibrary/changelog.txt index 585fadb1f..19887383e 100644 --- a/boblibrary/changelog.txt +++ b/boblibrary/changelog.txt @@ -4,6 +4,8 @@ Date: ??. ??. ???? Changes: - Added function bobmods.migration.ensure_unlocked(tech_name, recipe_name) #120 - Added function bobmods.lib.recipe.set_category(recipe_name, category) + - Added function bobmods.lib.module.exclude_productivity_module(module_name) + - Modules supplied to this function will not be altered by function add_productivity_limitation #139 --------------------------------------------------------------------------------------------------- Version: 1.1.6 Date: 01. 01. 2023 diff --git a/boblibrary/module-functions.lua b/boblibrary/module-functions.lua index 8f87d097c..24fbfa9f6 100644 --- a/boblibrary/module-functions.lua +++ b/boblibrary/module-functions.lua @@ -1,11 +1,20 @@ if not bobmods.lib.module then bobmods.lib.module = {} + bobmods.lib.module.excluded_prod_modules = {} +end + +function bobmods.lib.module.exclude_productivity_module(module_name) + if type(module_name) == "string" and data.raw.module[module_name] then + bobmods.lib.module.excluded_prod_modules[module_name] = true + else + log(debug.traceback()) + end end function bobmods.lib.module.add_productivity_limitation(recipe) if type(recipe) == "string" and data.raw.recipe[recipe] then for i, module in pairs(data.raw.module) do - if module.limitation and module.effect.productivity then + if not bobmods.lib.module.excluded_prod_modules[module.name] and module.limitation and module.effect.productivity then table.insert(module.limitation, recipe) end end