Module category defaults


Makes vanilla module categories as the default for allowed_module_categories.

2 days ago
2.0 - 2.1
9.41K
Owner:
cackling.fiend
Source:
https://git.cacklingfiend.info/cackli...
Homepage:
https://discord.gg/ufvFUJtVwk
License:
MIT
Created:
3 months ago
Latest Version:
2.0.0 (2 days ago)
Factorio version:
2.0 - 2.1
Downloaded by:
9.41K users


Module category defaults

This library mod sets the vanilla modules categories as allowed_module_categories on all entities that have that value empty.
This allows to blacklist special modules from mods that should only be allowed in special buildings from that mod.
It basically removes the engine behaviour to allow all module categories if none are specified.

Mod support

In the data stage, the global table ModuleCategoryDefaults is made available.
It contains a table default_categories that will be used to apply the defaults.
Add or remove values to change the outcome of this mod.

You probably want to add your custom category that you want to be available to all regular machines.

Example: My mod adds a module category for all buildings to be used

  1. Add module-category-defaults as a dependency to your mod.
  2. Add your module category to the defaults table: table.insert(ModuleCategoryDefaults.default_categories, 'my-module-category').

Done. The module will be available the same as without this mod.

Example: My mod adds a special module for a special building

  1. Add module-category-defaults as a dependency to your mod.
  2. Define all allowed_module_categories on your special module and the special building as you would normally do.

Done. No other buildings will be able to use the module.