Pull Request
P_RadiusAttack, along with blasted touchy actors, will now be given a flag passed to the DamageMobj function: DMG_EXPLOSION.
This is useful for mod compatibility and effects. Currently there is no way to check if damage is resulting from an explosion or not without using damage types. But this introduces incompatibilities with other mods that are supposed to be allowed running with the project.
Projectile damage is one thing, but explosions are another. I'm trying to make a 'concussion' upgrade that allows any explosion to the monster(s) to possibly be stunned. However this can be played with vanilla, and if another mod replaces Rocket, then it would be down to the developer of that mod to ensure their mods fall in compliance instead. This feature eliminates that need and ensures compatibility.
Furthermore, the use of damagetypes would necessitate more damagetype checking. This is a cumbersome aspect I wish to abolish.
Spoiler: Old Post
I think an explosion boolean or DMG_EXPLOSION flag can be assigned to radius damaging attacks in particular so we can have a bit more flexibility in regards to damage checking.
Why? I'd like to be able to check the damage of a projectile to see if it deals contact damage or not. Currently there is no way to do this yet without having to reassign the projectiles damage types just before the explosion occurs.
Seems to me a flag would be easiest; that way, should it ever be needed to fix something in the main P_DamageMobj function itself, it will already be set.
Re: Explosion boolean/flag for DamageMobj virtual
Posted: Wed Sep 12, 2018 9:34 am
by Matt
I've always just applied damage to the actor that's directly hit by the projectile first. What does this do that e.g. +hittracer (or A_Explode using its damagetype parameter) can't do more simply?
Re: Explosion boolean/flag for DamageMobj virtual
Posted: Wed Sep 12, 2018 11:04 am
by Major Cooke
It's for the actor receiving damage, not the one that hits it.
Remember, monsters can cause explosion damage too.
If I have to include damage types just for explosions, that means potentially more maintenance all around, and the mod suffers potential incompatibility with other mods which might not assign damage types like this.
Re: Explosion boolean/flag for DamageMobj virtual
Posted: Wed Sep 12, 2018 4:04 pm
by Matt
In that case it seems like it could be done with a check to see if they're touching the inflictor (CanCollideWith or distance check).
This just seems to me like a very specific ad-hoc check that might be better done through existing scripts... surely one is not running enough explosions constantly for there to be a meaningful advantage in making this native code...
Re: Explosion boolean/flag for DamageMobj virtual
Posted: Thu Sep 13, 2018 7:38 am
by Major Cooke
CanCollideWith only works on solid objects and projectiles never use that function.
And yes. I do use it a lot with my project. It suffers incompatibilities due to what I'm trying to achieve - a growing resistance to explosion damage by any mod, and any explosion in particular. RadiusDamageFactor will not work in this case because there's still no way to detect if it's an explosion. One thing I want some explosions to do, and NOT by projectile impact, is potentially inflict a stun effect - but only by certain explosions, and only upon them taking damage.
If someone wants to play vanilla with the set of monsters I'm making, I would expect the upgrade they can earn to affect the vanilla rocket launcher WITHOUT modifying it. I do not want to resort to using replacements because that too will break if someone tries to replace the base rocket with any mod.
Re: Explosion boolean/flag for DamageMobj virtual
Posted: Thu Sep 13, 2018 7:55 am
by Marisa the Magician
In the case of missiles you'd use SpecialMissileHit instead of CanCollideWith.
Re: DMG_EXPLOSION Flag Assignment for Explosions
Posted: Thu Sep 13, 2018 8:51 am
by Major Cooke
Indeed, but that still isn't enough.
Updated first post with submission.
Can a mod move this to the Coded Submissions please? Thanks Marisa!