[Rseding] [0.17.74] missing corpse from on_post_entity_died

Bugs that are actually features.
Post Reply
JuicyJuuce
Inserter
Inserter
Posts: 23
Joined: Wed Mar 16, 2016 11:33 pm
Contact:

[Rseding] [0.17.74] missing corpse from on_post_entity_died

Post by JuicyJuuce »

So I'm editing the pvp.lua scenario and responding to an on_post_entity_died event. Specifically I'm trying to use it to look at the corpse of a player after they have died. However, event.corpses is empty (i.e. `{}`) even when a corpse has clearly been created. Here is my testing code inside on_post_entity_died:

Code: Select all

  if not (event.prototype.type == "character") then return end
  if event.corpses == nil then game.print("corpses nil") end
  game.print(serpent.block(event))
Result:Image
3Ra Gaming Moderator
come play the PvP scenario with us and join our discord at www.3ragaming.com/discord

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

Re: [Rseding] [0.17.74] missing corpse from on_post_entity_died

Post by Rseding91 »

Thanks for the report. That's working correctly: the character corpse is not a "corpse" type entity. It's a "character-corpse" type entity and so is done as a completely different system to standard corpses.

The generic event system for an entity dying doesn't know about this separate system that character entities use on death and so it's not in the event. You can however just entity-search for the character-corpse to find it.

If you only care about players dying then you can use https://lua-api.factorio.com/latest/eve ... layer_died
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Not a bug”