Page 1 of 1

Detecting when ore on a tile is mined out

Posted: Sun Apr 26, 2020 6:52 pm
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.

Re: Detecting when ore on a tile is mined out

Posted: Sun Apr 26, 2020 7:39 pm
by Klonan
There is this event when a resource entity is depleted: https://lua-api.factorio.com/latest/eve ... e_depleted

Re: Detecting when ore on a tile is mined out

Posted: Mon Apr 27, 2020 1:37 am
by swni
Great, thank you! I missed it when I was examining the list of events.