Page 1 of 1

luaEntity.get_mining_results()

Posted: Wed Apr 26, 2017 6:55 am
by Nexela
luaEntity.get_mining_results()

Returns a temporary buffer of items that would be received if the entity was mined similar to on_player_mined_entity.

This would save a lot of hassle from trying to get all the products and contents and doing stuff with them.

Re: luaEntity.get_mining_results()

Posted: Wed Apr 26, 2017 7:36 pm
by Rseding91
What's the use case?

There's already an "entity_mined" event that contains all of the items (and the entity) in an inventory you can manipulate.

Re: luaEntity.get_mining_results()

Posted: Wed Apr 26, 2017 10:58 pm
by Nexela
Getting results from a script that destroys() the item.

Right now I run through a function to loop through prototype products and build simple item stacks. Then I add all of the items from all the inventorys, inserter_hand etc of the entity

With the buffer I would be able to check that everything fits and increment/decrement the entity stacks/player stacks before destroying() the entity.