[Added] Flag for allowing projectiles to hit their own target

Moderator: GZDoom Developers

Flag for allowing projectiles to hit their own target

Postby Marisa Kirisame » Wed May 23, 2018 5:03 am

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
Marisa Kirisame
ZScript Magician
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa Kirisame#4689
Twitch ID: magusmarisa
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Flag for allowing projectiles to hit their own target

Postby Graf Zahl » Wed May 23, 2018 6:29 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Flag for allowing projectiles to hit their own target

Postby Rachael » Wed May 23, 2018 6:40 am

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
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Flag for allowing projectiles to hit their own target

Postby Marisa Kirisame » Fri Aug 17, 2018 12:07 pm

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
Marisa Kirisame
ZScript Magician
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa Kirisame#4689
Twitch ID: magusmarisa
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Flag for allowing projectiles to hit their own target

Postby kodi » Fri Aug 17, 2018 4:38 pm

Can I suggest "HITSOWNER" instead? "HITOWNER" might seem to imply that whatever the missile hits becomes it's owner as with "HITTRACER".
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: Flag for allowing projectiles to hit their own target

Postby Marisa Kirisame » Fri Aug 17, 2018 6:01 pm

Would "CANHITOWNER" be a better option?
User avatar
Marisa Kirisame
ZScript Magician
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa Kirisame#4689
Twitch ID: magusmarisa
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Flag for allowing projectiles to hit their own target

Postby Rachael » Fri Aug 17, 2018 6:26 pm

"Hits Owner" is more grammatically precise.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: MauiBot and 1 guest