Allowed Modules


Adds tooltips listing when a recipe's allowed modules differ from the default.

Utilities
a day ago
2.0
132

b Maraxis Compatibility

2 days ago

Got this bug when trying to load this mod with Maraxis on:

Failed to load mods: allowed-modules/data-final-fixes.lua:80: This mod does not support the allowed_module_categories field (used by recipe maraxsis-fluid-void-water)
stack traceback:
[C]: in function 'error'
allowed-modules/data-final-fixes.lua:80: in main chunk

Mods to be disabled:
• allowed-modules (0.0.4)

a day ago

Until IsaacOscar updates the mod...

Remove line 79 and 80 from the data-final-fixes.lua


79 if recipe.allowed_module_categories then
80 error("This mod does not support the allowed_module_categories field (used by recipe " .. name .. ")") end


And you should be good to go for now...

a day ago

Sorry about that, I was being lazy and didn't vother supporting allowed_module_categories as the base game wasn't using it, and I didn't know of any specific mods that did.
I'll add support for it soon.

In the meantime you can do what briel1235 suggested, however the tooltips won't be correct! (if you change error to log, and then your log file will let you know all the recipes whose tooltips can't be trusted).

a day ago

Interresting that only modders use "allowed_module_categories" entry, ive searched in the base, core, and space age files and theres no usage of it, i dont even know how it "works"

a day ago
(updated a day ago)

Interresting that only modders use "allowed_module_categories" entry, ive searched in the base, core, and space age files and theres no usage of it, i dont even know how it "works"

I had to work it out by testing,
I think it goes like this:

  • If a recipe has an allowed_module_categories, and the value of the module prototype's category field is not in allowed_module_categories, then the module is not allowed
  • If a recipe does not have an allowed_module_categories, but it has an allow_<effect> field set to false (where effect is speed, pollution, consumption, productivity, or quality) and the module has a positive (or negative in the case of consumption and pollution) value for that effect , the module is not allowed.
  • Same as above, but if effect == productivity, and there is no allow_productivity field it is the same as if allow_productivity was set to false
  • If the machine you are trying to craft the recipe in has no module slots, then no modules are allowed

  • If one of the positive effevts of the modules is not listed in the machine prototype's allowed_effects field, the module is not allowed

  • If the machine prototype has a allowed_module_categories field, and the modules category is not listed in it, then the module is not allowed.

  • Otherwise, the module is allowed.

a day ago

What's interesting, is that if allowed_module_categories is set on a recipe, then the various allow_<effect> fields are ignored.

But if it is set on a crafting machine, the allowed_effects field of the machine is still relevant.

a day ago

Ok I've fixed it now! It was not easy, but I've tested it with the two recipes on Maraxis that use allowed_module_categories.

21 hours ago

Thank you!

New response