on_player_mined_entity ignores turret ammo

Bugs that are actually features.
Post Reply
CaveGrinder
Inserter
Inserter
Posts: 35
Joined: Fri Aug 24, 2018 7:42 pm
Contact:

on_player_mined_entity ignores turret ammo

Post 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.


Rseding91
Factorio Staff
Factorio Staff
Posts: 13175
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: on_player_mined_entity ignores turret ammo

Post 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).
If you want to get ahold of me I'm almost always on Discord.

CaveGrinder
Inserter
Inserter
Posts: 35
Joined: Fri Aug 24, 2018 7:42 pm
Contact:

Re: on_player_mined_entity ignores turret ammo

Post by CaveGrinder »

thanks for clarifying this, i didn't expect that the events are separate for entity and content :)

Post Reply

Return to “Not a bug”