Page 1 of 1

on_player_mined_entity ignores turret ammo

Posted: Fri Sep 14, 2018 1:29 pm
by CaveGrinder
Hi,

while modding i found something which looks more like a bug to me. The description of on_player_mined_entity states:
"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. "
Based on this when i mine a turret with ammo inside, i expected to get two buffer entries; one entry for the turret and one for the ammo.
yet the buffer only contains one entry for the turret.
this is weird since at the same time the ammo inventory of the turret is already reported as empty.

Re: on_player_mined_entity ignores turret ammo

Posted: Fri Sep 14, 2018 3:32 pm
by darkfrei

Re: on_player_mined_entity ignores turret ammo

Posted: Fri Sep 14, 2018 8:00 pm
by Rseding91
darkfrei wrote:
Fri Sep 14, 2018 3:32 pm
https://lua-api.factorio.com/latest/eve ... mined_item
Just check this entity before.
This is the correct answer. on_player_mined_item will be called with the items that where in the entity. on_player_mined_entity only contains the direct result of mining the entity (the laser turret itself when mining a laser turret).

Re: on_player_mined_entity ignores turret ammo

Posted: Sat Sep 15, 2018 4:16 am
by CaveGrinder
thanks for clarifying this, i didn't expect that the events are separate for entity and content :)