It would be very great if we had a 6th parameter in the HandleDamage event that would indicate if the damage was inflicted from a direct hit by a physical object. A boolean would suffice. Falling damage should ideally return false.
- Legacy ID
- Operating System
- Windows 7
- Feature Request
It would still be really useful to have this, as well as adding the other interesting params from the HitPart EH to HandleDamage. It would make damage adjustments and special interactions a lot easier.
We talked about this in Discord and I'm just summarising it here for posterity.
The important part of the isDirect flag from the hitPart EH is detecting explosive splash damage. Apparently, the way this is done is hard-coded in a way that's specific to hitPart, and the engine isDirect check that Dedmen would prefer to use here can only distinguish fall damage. Explosive splash damage is registered as a direct hit. That's the version that was sent to dev branch at the time of this comment.
Since fall damage is already detectable by checking if the projectile type is "", and this wouldn't actually add a way to detect splash damage, the solution as implemented doesn't fulfil the core purpose and is mostly useless. Dedmen said he would prefer to revert the change rather than leave a mostly useless flag in the EH. [Note: I am recording that he said that, not whether it was removed.]
I still hope for a flag that correctly reports indirect damage in the future, but it seems like that's a much more complex task and may not be practical.
There is another useful use case for an isDirect flag.
Or perhaps renaming it to "isResidual" or something like that.
You see, when a projectile hits a body part depending on the body part the damage could be "duplicated" as "residual" damage to another body part.
An example could be that you get shot in the leg but also causes some damage to the torso.
In my particular use case sometimes torso hits would also register as head damage (or was it the other way around?)
Anyway, if one wanted to eliminate residual damage such as that, the only way to do it would be via a flag such as the one I am suggesting.
Residual damage seems to be in place to ensure that no lethal body parts can also cause death due to their residual damage to adjacent lethal body parts.
But such mechanic could be easily scripted anyway and forcing that mechanic limits what we can do via scripting with the HandleDamage EH.