by Major Cooke » Thu Apr 30, 2020 8:04 am
WorldThingDamaged can't be changed like this since it was made strictly for postmortem, but I have an idea.
Perhaps having a WorldThingPreDamage virtual, a new function to perform what is desired in, could suffice. This would be called before DamageMobj so it's not intrusive on the code, and contains an IsFinal boolean to stop further event handlers from running it if needed.
Modders can use this to effectively intercept damage variables before they're actually processed. However it's still subject to DamageMobj itself and any overrides the original player had. I'm also contemplating sending along the original parameters in a struct so anyone overriding DamageMobj can compare, since actors overriding them are meant to have the final say.
I'll be giving this a try since this will be beneficial to a project I'm working on too.
WorldThingDamaged can't be changed like this since it was made strictly for postmortem, but I have an idea.
Perhaps having a [b]WorldThingPreDamage[/b] virtual, a new function to perform what is desired in, could suffice. This would be called before DamageMobj so it's not intrusive on the code, and contains an IsFinal boolean to stop further event handlers from running it if needed.
Modders can use this to effectively intercept damage variables before they're actually processed. However it's still subject to DamageMobj itself and any overrides the original player had. I'm also contemplating sending along the original parameters in a struct so anyone overriding DamageMobj can compare, since actors overriding them are meant to have the final say.
I'll be giving this a try since this will be beneficial to a project I'm working on too.