Page 1 of 1

on_entity_died author ?

Posted: Wed May 25, 2016 2:14 pm
by binbinhfr
Hi,

I red this post "on_entity_damaged event"
viewtopic.php?f=28&t=25542
and I understand it's too cpu demanding.

But, in the same order of idea, but easier, it would be nice in the on_entity_died event to have the identity of the entity who killed the other (infact gave the last fatal wound) : an "event.author" field would be nice (could be a player, an alien, a turret or a robot) : it would be great for PvP mods, in order to detect which force destroys which building (to win the game) or which player killed who (to make reports about killings), or count aliens death per forces, etc... It would be less cpu demanding because only trigger on death. You have to find who is belonging the ammo which killed the entity.

Re: on_entity_died author ?

Posted: Fri May 27, 2016 3:15 pm
by binbinhfr
I just noticeed that there is a kill_counts on LuaForce, so I guess that factorio is already tracking this kind of event. So it wouldn't be hard to add a "author" or "killer" entity field to the on_entity_died event... Please, it would help me so much in my PvP mod :)

Re: on_entity_died author ?

Posted: Fri May 27, 2016 4:40 pm
by Rseding91
The force that did the killing is known, the "what" that actually killed it not known since it can be anything or nothing.

Re: on_entity_died author ?

Posted: Fri May 27, 2016 6:37 pm
by binbinhfr
Rseding91 wrote:The force that did the killing is known, the "what" that actually killed it not known since it can be anything or nothing.
is it known from the event of the on_entity_died ? because it is not explicit in the doc :
https://wiki.factorio.com/index.php?tit ... ntity_died

And even if I parse regularly the kill_counts from all forces, and try to compute differences, it will be a big work to find out which force kill a specific entity (let say a specific building for example).