Yeah, I also think that's why it uses that event, you're right. But as mentioned, it doesn't capture everything, so to make the mod robust on_equipment_inserted
has to be used.
There are ways to make it work, and here is two:
- The only difference between the two functions is with the current one you have player
, which is used to determine on which surface
the event happened, and then search that surface for spiders that this event might belong to. Because player
will not be know in the other event the mod could simply scan all surfaces, but this will be slightly slower.
- A much better way (and I think the best way) is cache all existing spider grids with grid.unique_id
as key ([grid.unique_id] = spider
. That way, when using the all-encapusling event it's a simple table-lookup to determine which spider it belongs to (e.g. spider = cache[event.grid.unique_id
). Super fast and robust. The unique IDs for grids may not have been available when this mod was created (which would make this method impossible), so maybe that's why it wasn't used in the first place.
So it's definitely possible :)