Page 1 of 1

on_corpse_spawned

Posted: Thu Mar 21, 2019 2:29 pm
by EnigmaticAussie
Currently we have access to on_entity_died, but cannot access the corpse of the entity until after that function completes.

It would be ideal to be able to access on_corpse_spawned to be able to interact directly with the corpse entity/event itself.

Re: on_corpse_spawned

Posted: Thu Mar 21, 2019 6:22 pm
by Boodals
What do you want to do with the corpse?

Re: on_corpse_spawned

Posted: Fri Mar 22, 2019 1:01 am
by EnigmaticAussie
I've written a corpse removal script for Redmew, some of their maps have an insane amount of biters, all of which end up with a corpse when they die.

I was hoping to interact with the corpse spawning, rather than on_entity_died.

Re: on_corpse_spawned

Posted: Fri Mar 22, 2019 2:41 am
by Boodals
Just change the time to live or whatever its called on the corpse prototype.
Except its redmew so i'm guessing their self-imposed unnecessary rules prevent them from doing that.

Regardless, this event would double the number of events on death, for very few (if any) use cases. It wouldn't be the most intense thing overall, but it seems unlikely.

Re: on_corpse_spawned

Posted: Sat Mar 23, 2019 5:53 am
by EnigmaticAussie
Yes, unfortunately there is the softmod limitation in the implementation side of this current script.

All good, my current script works, I was simply hoping to streamline it a little.

Re: on_corpse_spawned

Posted: Sat Mar 23, 2019 10:19 am
by Klonan
It would make more sense to me to just include the corpse in `on_post_entity_died`:
https://lua-api.factorio.com/latest/eve ... ntity_died

Re: on_corpse_spawned

Posted: Tue Mar 26, 2019 12:48 am
by EnigmaticAussie
That would be cleverer.

Thanks.

Re: on_corpse_spawned

Posted: Tue Apr 02, 2019 12:57 am
by Boodals
I added an array of the corpses in on_post_entity_died as Klonan suggested (I have source access). It will be in the next version of 0.17.