on_player_mined_entity ignores turret ammo

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

on_player_mined_entity ignores turret ammo

Post by CaveGrinder » Fri Sep 14, 2018 1:29 pm

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.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 1331
Joined: Thu Nov 20, 2014 11:11 pm

Re: on_player_mined_entity ignores turret ammo

Post by darkfrei » Fri Sep 14, 2018 3:32 pm


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

Re: on_player_mined_entity ignores turret ammo

Post by Rseding91 » Fri Sep 14, 2018 8:00 pm

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 IRC and Discord.

CaveGrinder
Burner Inserter
Burner Inserter
Posts: 8
Joined: Fri Aug 24, 2018 7:42 pm

Re: on_player_mined_entity ignores turret ammo

Post by CaveGrinder » Sat Sep 15, 2018 4:16 am

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

Post Reply

Return to “Not a bug”