And since it is in the same piece of code, any chance to change this line (currently 176)
script.raise_event(on_module_inserted, {modules = {[module] = 1}, player = player, entity = entity})
to
script.raise_event(on_module_inserted, {modules = requests, player = player, entity = entity})
That, or also create a on_module_removed
event (might make more sense).
Right now I can check in the on_module_inserted
event the current requests in the entity, and the new requests in the event (since it is effectively a on_pre_module_inserted
with the requests being set after the event is raised).
However this fails when using right clicks to only change one module, as only the new module is passed through. I'd have to reverse engineer the logic to see which one was removed.
Huge appreciation for the great code and raising the on_module_inserted event and raise build/destroy with the item request proxies!
I'm improving the Ghost Scanner mod to use events instead of scanning the surfaces at certain intervals, and MIS is essential when it comes to modules with the events it is throwing.