Please give actors a default Death state

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Please give actors a default Death state

Post by Marisa the Magician »

In custom ZScript code, it's practically become a regular thing that every single call to DamageMobj needs a null check afterwards because some actors will simply stop existing and become null immediately as they have no Death state defined. Some people don't know this, and it ends up causing VM aborts, and it has to be patched up. Besides, something like this makes it difficult to perform other operations afterwards, such as spawning/tracing blood from the actor after it takes damage.

I don't understand why the base Actor class can't just have a simple Death state that's a single TNT1 A 1. Would that cause some sort of problem?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49092
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Please give actors a default Death state

Post by Graf Zahl »

A default death state cannot be added because some features check the presence of the state. What could be done is to switch to a dummy state if a null state would be set otherwise.
ZzZombo
Posts: 315
Joined: Mon Jul 16, 2012 2:02 am

Re: Please give actors a default Death state

Post by ZzZombo »

Would going in the other direction, namely making actors non-destroyable by regular damage by default not achieve the actually desired result, actors not being removed unless they are supposed to be killed?
User avatar
phantombeta
Posts: 2093
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Please give actors a default Death state

Post by phantombeta »

ZzZombo wrote: Fri Feb 10, 2023 8:41 am Would going in the other direction, namely making actors non-destroyable by regular damage by default not achieve the actually desired result, actors not being removed unless they are supposed to be killed?
That's not what the issue is here. The issue is actors that are supposed to be destroyable, like monsters. It's not uncommon for monster mods with "fancier" effects to spawn something like an explosion effect for monsters like lost souls and instantly remove the monster actor, and that'll trigger this issue.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: Please give actors a default Death state

Post by Marisa the Magician »

Honestly, the real issue is that any pointers to a shootable actor like this get instantly NULL'd within the call to DamageMobj so it's practically impossible to do anything with them after the fact.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49092
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Please give actors a default Death state

Post by Graf Zahl »

In that case make it a habit to inherit from a custom actor that defines a death state.
We cannot change the original for backwards compatibility reasons.

Return to “Feature Suggestions [GZDoom]”