WorldThingDamaged(WorldEvent e) : add NewDamage

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: WorldThingDamaged(WorldEvent e) : add NewDamage

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

by Major Cooke » Fri Feb 04, 2022 3:26 pm

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.

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

by Jekyll Grim Payne » Fri Feb 04, 2022 9:23 am

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.

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

by Major Cooke » Thu Feb 03, 2022 6:30 pm

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.

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

by Jekyll Grim Payne » Fri Jan 21, 2022 4:24 am

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.

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

by Major Cooke » Thu Apr 30, 2020 1:06 pm

Yeah. I agree, it would be nifty but this may take some time.

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

by merlin86 » Thu Apr 30, 2020 11:57 am

Would be super nice having this function, it could help doing some mods.
Thanks :)

Re: WorldThingDamaged(WorldEvent e) : add NewDamage

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(WorldEvent e) : add NewDamage

by merlin86 » Thu Apr 30, 2020 2:22 am

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.

Top