A_Blast flag that only affects visible actors - Pull request

Sun Jul 18, 2021 1:54 pm

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.

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

Mon Jul 19, 2021 3:46 pm

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.

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

Mon Jul 19, 2021 4:05 pm

The solution to this I believe would be to get into a custom LineTracer class 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.

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

Tue Jul 20, 2021 11:02 pm

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