WorldThingDamaged(WorldEvent e) : add NewDamage

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
merlin86
Posts: 124
Joined: Tue Jan 29, 2008 4:02 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10 Pro
Graphics Processor: nVidia with Vulkan support

WorldThingDamaged(WorldEvent e) : add NewDamage

Post by merlin86 »

Hello,
it would be usfeful to add a NewDamage property to the event WorldThingDamaged, like WorldLineDamaged and WorldSectorDamaged do, because Damage is a read-only property.

I'm asking this because I'm trying to apply different damages to the player without subclassing the player class, otherwise it works only for the new class and not for every player class avaialable during the game.
User avatar
Major Cooke
Posts: 8109
Joined: Sun Jan 28, 2007 3:55 pm

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

Post by Major Cooke »

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.
User avatar
merlin86
Posts: 124
Joined: Tue Jan 29, 2008 4:02 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10 Pro
Graphics Processor: nVidia with Vulkan support

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

Post by merlin86 »

Would be super nice having this function, it could help doing some mods.
Thanks :)
User avatar
Major Cooke
Posts: 8109
Joined: Sun Jan 28, 2007 3:55 pm

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

Post by Major Cooke »

Yeah. I agree, it would be nifty but this may take some time.
User avatar
Jekyll Grim Payne
 
 
Posts: 949
Joined: Mon Jul 21, 2008 4:08 am
Graphics Processor: nVidia (Modern GZDoom)

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

Post by Jekyll Grim Payne »

I was going to suggest this but then I found this post. Has this gotten any attention? Because it's really inconvenient that the only function to override damage is ModifyDamage on an item.
User avatar
Major Cooke
Posts: 8109
Joined: Sun Jan 28, 2007 3:55 pm

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

Post by Major Cooke »

Can you tell me what you would use this for, Jekyll? Gonna be blunt, after thinking of this some more, it's going to devolve into a game of hijacking and the damage system is already a clusterfuck as is.
User avatar
Jekyll Grim Payne
 
 
Posts: 949
Joined: Mon Jul 21, 2008 4:08 am
Graphics Processor: nVidia (Modern GZDoom)

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

Post by Jekyll Grim Payne »

Major Cooke wrote:Can you tell me what you would use this for, Jekyll? Gonna be blunt, after thinking of this some more, it's going to devolve into a game of hijacking and the damage system is already a clusterfuck as is.
Plenty of cases where you'd want to modify the receiving of damage globally. One of the simplest examples would be a universal headshot system, where the damage is increased if the puff/projectile hits the top 20% of the monster's height:

Code: Select all

if (inflictor.pos.z >= height * 0.8)[/b]
Right now doing something like this requires overriding DamageMobj (requires actor replacement) or ModifyDamage (requires giving all actors a control item). Doable but not ideal.
User avatar
Major Cooke
Posts: 8109
Joined: Sun Jan 28, 2007 3:55 pm

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

Post by Major Cooke »

Sorry, but thinking more on it, I'm gonna back out of this. I want original damage values passed to my actors so people can't try and hijack things. As a rule of thumb, DamageMobj should be the de facto start and end of it. I absolutely do not want it to be modified outside, because then I don't know if that was the actual true amount of damage originally passed in. This is especially for inter-mod compatibility.

Please use ModifyDamage instead.

Return to “Feature Suggestions [GZDoom]”