Page 1 of 1

Module events on add/remove.

Posted: Sat Sep 08, 2018 12:44 pm
by Staplergun
Fire events on module addition and module removal.
Returns entity added to/removed from, module, and player.

Use case: Allows for interfacing with modules to create custom effects when adding or removing modules. My particular idea is allowing addition of "features" of modularity to buildings that can accept modules. Things like, a module that adds a power pole to an assembler, or a logistics box to it or something. Could be used with anything that can accept a module. The concept is very similar to an equipment grid, but more specialized since module slots are limited, and this can be used on a slightly different variety of entities.

Re: Module events on add/remove.

Posted: Sat Sep 08, 2018 12:51 pm
by Bilka
Duplicate with 56963 which is a "won't implement" for the reasons stated in the thread.

Re: Module events on add/remove.

Posted: Sat Sep 08, 2018 1:17 pm
by eradicator
Being the author of the original request...

A possible method i can see to implement this is to intecept all module in/output actions by using a custom gui for the entity in question. It's a lot of coding work though, and if you need modules to be placeable by bots for blueprinting it's even more coding work :/.

Re: Module events on add/remove.

Posted: Sat Sep 08, 2018 5:47 pm
by Staplergun
Could just stick an event call in the code to fire when the module enters the inventory of the structure. I mean I read it but the counterargument to the request could be used for a large number of other events that do similar stuff. More specifically the event fired for equipment grids.


Or, just don't return the player as part of the event call?

Re: Module events on add/remove.

Posted: Sat Sep 08, 2018 6:45 pm
by Rseding91
Items in inventories can change by loads of different thing compared to the super simpler equipment which is only ever changed by the player doing it.

Re: Module events on add/remove.

Posted: Sat Sep 08, 2018 7:01 pm
by Staplergun
Bots and players right?

Re: Module events on add/remove.

Posted: Sat Sep 08, 2018 10:57 pm
by Rseding91
Staplergun wrote:Bots and players right?
robots, players, inserters, loaders, mining drills, assembling machines, boilers, turrets. Anything with ah inventory that isn't a container has different automated methods of "item removed/added".

Re: Module events on add/remove.

Posted: Sun Sep 09, 2018 4:40 am
by Staplergun
Cheese and rice. Fair enough.

Is module slots a type of "inventory" that other things like a mining drill can even interact with though?