Page 1 of 1

17.56 miner entity status inconsistent

Posted: Mon Jul 15, 2019 1:03 am
by Nexela
Checking miner entity status on on_resource_depleted returns low_power

Place 2 resources down next to each other
/c game.player.surface.create_entity{position = game.player.position, name = 'iron-ore', amount =5}
place a chest, and a miner shoving things in it.
When the first resource is depleted low_power is returned, At this point I would still expect 'working'
When the second/last resource is depleted low_power is returned, At this point I would expect 'no_minable_resources'

Re: 17.56 miner entity status inconsistent

Posted: Mon Jul 15, 2019 9:43 am
by Rseding91
Thanks for the re port however I don't consider this worth looking into. Reading the entity status is only useful at the end of the current tick after everything has had a chance to settle. Reading it in the middle of that event means it hasn't finished its update tick and electricity hasn't had a chance to flow into the entity. So, of course the status will be wrong.

The status was designed as a visual-only thing used in the GUI. The fact it's readable through the Lua API was only added because I knew someone would want to do it - even if I knew it wasn't going to be perfect.

So, I can either leave it as is, or remove the Lua API if enough people complain about it.

Re: 17.56 miner entity status inconsistent

Posted: Mon Jul 15, 2019 12:08 pm
by darkfrei
This one? https://lua-api.factorio.com/latest/Lua ... ity.status
Is here the event for it?