Skip to content

Commit

Permalink
Add function for excluding prod modules #139
Browse files Browse the repository at this point in the history
  • Loading branch information
KiwiHawk committed Sep 24, 2023
1 parent e8025a1 commit 0cbec15
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions boblibrary/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion boblibrary/module-functions.lua
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0cbec15

Please sign in to comment.