Detecting when ore on a tile is mined out

Place to get help with not working mods / modding interface.
Post Reply
swni
Long Handed Inserter
Long Handed Inserter
Posts: 91
Joined: Sat Mar 05, 2016 1:54 am
Contact:

Detecting when ore on a tile is mined out

Post by swni »

I would like to detect when the last of the ore on a tile is mined out, ideally on the same tick, and for all tiles that have been explored. Unfortunately I couldn't find anything in the API that would help with this.

Approximate solutions would be okay, including looking at groups of tiles instead of individual tiles. I examined YARM, which works by regularly scanning resource entities (and only scans those that the user has explicitly registered an interest in). I'm not sure if there's any other method that would be viable. (I guess tiles with more ore on them could be checked less often?) Thanks for any suggestions.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Detecting when ore on a tile is mined out

Post by Klonan »

There is this event when a resource entity is depleted: https://lua-api.factorio.com/latest/eve ... e_depleted

swni
Long Handed Inserter
Long Handed Inserter
Posts: 91
Joined: Sat Mar 05, 2016 1:54 am
Contact:

Re: Detecting when ore on a tile is mined out

Post by swni »

Great, thank you! I missed it when I was examining the list of events.

Post Reply

Return to “Modding help”