[0.17.69] on_entity_died for entities with animation needs 'cause' parameter to be available.

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
TheKid0z
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Jul 22, 2019 1:46 am
Contact:

[0.17.69] on_entity_died for entities with animation needs 'cause' parameter to be available.

Post by TheKid0z »

Code: Select all

/c game.player.surface.create_entity{name="small-worm-turret", position={50,0}}
/c script.on_event(defines.events.on_entity_died, function(event) game.print(event.cause) end)
Right now when a player kills any of the turrets (worms/gun/laser), the optional 'cause' parameter is returned as nil.

More info discussed here - viewtopic.php?f=23&t=48353&p=419260&hil ... se#p419260

I feel like this is a basic functionality that needs to be in the game and a lot of custom scenarios can be built on this if the cause parameter is made available to entities with die animation that gets destroyed. According to the post above it used to work as of [0.17.17].

Currently, the on_entity_damaged event does provide the cause for all entities including the turrets. But it is a huge performance hog with the events being raised every time something gets damaged. I want it only once that is when a turret dies.

For my use case, I need to know who killed the turret so some action can be taken.

Post Reply

Return to “Modding interface requests”