Hi
There was a very similar topic about this question viewtopic.php?f=25&t=31074&hilit=modules but it didn't help me out that much.
i've made a module which has the "speed" effect i also added "module-category" for it and yeah it appears under the allowed modules for the desired entity,but at the same time it appears under the allowed modules for every entity that supports the "speed" effect and the limitation is for recipe which could be good solution for it,but the problem here it's still an allowed module for other entities.
So the question here how to actually hide/limit the module for the other entities?
Thanks in Advance.
Limit Modded Module to specific entity
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Limit Modded Module to specific entity
You can't. A module will go into any machine that allows the effects assigned to the module in the machine's module_specification. For assembling machines and furnaces you can use limitations and limitations_blacklist but those are based on recipes and so there is no way of preventing a specific module from being used in machines which don't work with recipes, e.g. labs and drills, except for completely banning all the effects that module has from the labs and drills.
Re: Limit Modded Module to specific entity
But you can check the event and extract the module, remove from entity and place on the ground.
Re: Limit Modded Module to specific entity
Yeah banning all effects sound like a bad idea.Deadlock989 wrote: ↑Mon Apr 12, 2021 4:28 pmYou can't. A module will go into any machine that allows the effects assigned to the module in the machine's module_specification. For assembling machines and furnaces you can use limitations and limitations_blacklist but those are based on recipes and so there is no way of preventing a specific module from being used in machines which don't work with recipes, e.g. labs and drills, except for completely banning all the effects that module has from the labs and drills.
Can you explain further? I don't really get what are you trying to illustrate.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Limit Modded Module to specific entity
There is no event for module changes and devs have stated multiple times that they don't intend to change that. You'd have to hack into every possible way a machine/module can be placed and do a bunch of checks and then try to *undo* the placement. That's pretty much the maximum complexity an ugly hack can get, and it'll never be a smooth experience for the user even if you get all the possible bits right.
The closesed you can get to a smooth experience would be to spam invisible beacons with one tile range onto the modded entity and then attach a custom relative gui to the machines gui and handle the module<->gui interactions yourself. And that still messes up the entity tooltip effect count and produces weird blueprints.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Limit Modded Module to specific entity
The first section sounds impossible for me and the second one have potential to mess up player's blueprints;i guess i'll just limit the recipe for the modules theneradicator wrote: ↑Mon Apr 12, 2021 8:02 pmThere is no event for module changes and devs have stated multiple times that they don't intend to change that. You'd have to hack into every possible way a machine/module can be placed and do a bunch of checks and then try to *undo* the placement. That's pretty much the maximum complexity an ugly hack can get, and it'll never be a smooth experience for the user even if you get all the possible bits right.
The closesed you can get to a smooth experience would be to spam invisible beacons with one tile range onto the modded entity and then attach a custom relative gui to the machines gui and handle the module<->gui interactions yourself. And that still messes up the entity tooltip effect count and produces weird blueprints.