A_Blast flag that only affects visible actors - Pull request

Moderator: GZDoom Developers

Post Reply
User avatar
kevansevans
Spotlight Team
Posts: 420
Joined: Tue Oct 05, 2010 12:04 am
Graphics Processor: nVidia with Vulkan support
Contact:

A_Blast flag that only affects visible actors - Pull request

Post by kevansevans »

I just gave up on implementing this myself in ZScript, the largest issue here is what has to be replaced in here: https://github.com/coelckers/gzdoom/blo ... tradius.zs

Maybe I'm not that adept at ZScript, but I did give this an earnest shot and could not pull it off. The current behavior with A_Blast is that it will affect enemies that are behind walls, and this is behavior I do not want. This causes enemies to start in-fighting with each other when they're knocked into each other, and setting the flag BF_NOIMPACTDAMAGE just makes it so they don't take damage, the actor still gets pushed and awakened. BlastActor is a private function, so I can't override this behavior or isolate it by making a Thinker to check if the actor is in view and calling it, I'd have to copy the whole function over into my code in order to get what i want. Which I did at first originally and failed for the last hour or so. So I'm wondering if anyone who knows these better could add this flag to A_Blast.

If this is easier as a DIY I understand, I'll take a few more cracks at it, but I think a flag would be far more helpful for everyone in the long run.
Last edited by kevansevans on Tue Jul 20, 2021 11:05 pm, edited 1 time in total.
User avatar
kevansevans
Spotlight Team
Posts: 420
Joined: Tue Oct 05, 2010 12:04 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: A_Blast flag that only applies to actors not behind a wa

Post by kevansevans »

Bumping this thread as a follow up to what I’ve managed to learn and help elaborate why I need this, as since I made this post, a few alternative suggestions have come my way.

I was first shown A_RadiusThrust, which has similar behavior to A_Explode and A_Blast, however I can not pass a puff actor through this function, where I’m currently in need of a handful of puff actors to display effects and apply them.

A_Blast almost became the solution, but it doesn’t work for me on two reasons. First being that while I can define the damage type of the explosion, it doesn’t do this through a puff actor, which I need it to be. Second being, the puff actor it does ask for is a nail bomb attack, which has infinite range as fas as I could tell (I don’t want that), and there’s no “Don’t puff on walls” flag that I could set, resulting in this effect: https://imgur.com/a/A0JvY8o

Hopefully that better helps illustrate why a flag to exclude obstructed actors is necessary.
User avatar
Zhs2
Posts: 1269
Joined: Fri Nov 07, 2008 3:29 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Maryland, USA, but probably also in someone's mod somewhere
Contact:

Re: A_Blast flag that only applies to actors not behind a wa

Post by Zhs2 »

The solution to this I believe would be to get into a custom [wiki=Classes:LineTracer]LineTracer class[/wiki] that works with your custom A_Blast. This would be more ideal for your use case over the LineTrace function because you'd need the ability to continue a trace if it hits an actor you are not comparing for but before a wall is hit. Once you are able to confirm the actor in question can be traced to from the origin (HitActor matches the actor you have currently iterated to in your custom A_Blast function) without hitting a wall first then it is currently reachable from your position.

Also I believe trace direction is a unit vector, you can get that from (GoalActorPos - StartActorPos) / DistanceFromStartActorToGoalActor.
User avatar
kevansevans
Spotlight Team
Posts: 420
Joined: Tue Oct 05, 2010 12:04 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: A_Blast flag that only applies to actors not behind a wa

Post by kevansevans »

Adding in a simple isVisible to the function worked. I'm not happy about having to implement this myself due to it requiring me to copy over a private function, so I went ahead and made a pull request for this, because IMO it's ridiculously ugly otherwise: https://github.com/coelckers/gzdoom/pull/1438
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”