Page 1 of 1

Cancel mining attempt per script

Posted: Tue May 19, 2020 10:08 am
by Pi-C
I want to use event scripts to prevent that certain entities can be mined, given certain conditions. (Yes, I know that "entity.minable = false" can be used -- but it's universal, not dependent on any conditions.)

We have
  • on_pre_player_mined_item (Called when the player finishes mining an entity, before the entity is removed from map.)
  • on_player_mined_entity (Called after the results of an entity being mined are collected just before the entity is destroyed. After this event any items in the buffer will be transferred into the player as if they came from mining the entity.)
and their equivalents for bots. But if these events are triggered, it is too late: the entity will be mined. I think it would be useful if the mining could be canceled in on_pre_X_mined_item, so subsequent events wouldn't be triggererd. Is there any way to accomplish that?

Re: Cancel mining attempt per script

Posted: Tue May 19, 2020 10:55 am
by Rseding91
Currently Factorio does not support even cancellation and I don't see that being supported any time in the future.

Re: Cancel mining attempt per script

Posted: Tue May 19, 2020 11:02 am
by Pi-C
Thanks for the answer! So I can stop wasting my time with trying to get it work. :-)