Flag for allowing projectiles to hit their own target

Moderator: GZDoom Developers

Post Reply
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
Contact:

Flag for allowing projectiles to hit their own target

Post by Marisa the Magician »

I've noticed that there's no way to make projectiles be able to hit and deal damage to whoever fired them.
True, it is possible to use SpecialMissileHit to make them stop when hitting, but this completely skips everything that a projectile would do on hit, such as dealing direct damage.

An example use case for this would be bouncing projectiles that can hurt the shooter if they bounce back at them.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Flag for allowing projectiles to hit their own target

Post by Graf Zahl »

The reason for this is that normally projectiles get spawned within the shooter, so if this was disabled they'd explode right away because they could not move.
User avatar
Rachael
Posts: 13542
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Flag for allowing projectiles to hit their own target

Post by Rachael »

That can be fixed by having two flags - initially have the standard behavior even with the definition flag, but as soon as the projectile detects that it has left the shooter's boundaries, it can flag itself internally (with a flag not accessible in the definition code) as colliding with its shooter.
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
Contact:

Re: Flag for allowing projectiles to hit their own target

Post by Marisa the Magician »

I've decided to revive this, with one PR.

This adds a user-settable flag called HITOWNER. The point of it would be to let modders flip it on in a bounce state, for example. Obviously setting it in the default block would allow projectiles to hit the player instantly.

Also the behavior Rachael describes could just be implemented on the ZScript side with this.
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: Flag for allowing projectiles to hit their own target

Post by kodi »

Can I suggest "HITSOWNER" instead? "HITOWNER" might seem to imply that whatever the missile hits becomes it's owner as with "HITTRACER".
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
Contact:

Re: Flag for allowing projectiles to hit their own target

Post by Marisa the Magician »

Would "CANHITOWNER" be a better option?
User avatar
Rachael
Posts: 13542
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Flag for allowing projectiles to hit their own target

Post by Rachael »

"Hits Owner" is more grammatically precise.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”