redsunservers / VSH-Rewrite

Popular Versus Saxton Hale gamemode remade from scratch
GNU General Public License v3.0
34 stars 25 forks source link

Add CTakeDamageInfo struct for damage hooks #390

Closed Jugheadbomb closed 1 year ago

Jugheadbomb commented 1 year ago

This PR is used to replace SDKHook_OnTakeDamageAlive with detour CTFPlayer::OnTakeDamage_Alive for accessing CTakeDamageInfo object, which is used to structure damage hooks code a bit, and also to access m_eCritType, for example. P.S.: PR also adds crittype filter and param for (attack/take)damage tags

Previously, I made these changes for my own fork of vsh - all worked fine. Can't say guaranteed that this PR will make it work fine, need more tests.

This PR also updates dhooks code to use methodmaps.

FortyTwoFortyTwo commented 1 year ago

While I appreciate the effort into it, I'm not sure if it's even worth to have offsets and gamedatas just for some extra variables that may or may not be useful, as this also needs updating on any sub-plugins that added its own boss. Do you have examples on how this could be useful for?

Jugheadbomb commented 1 year ago

Seems you are right, especially on part about requiring updating all sub-plugins. I don't have any useful examples on this, so you can close PR if you don't consider it necessary. Just thought it would do some more convenient code using struct to maintain this code with. Thanks for feedback.

Kenzzer commented 1 year ago

Should this PR somehow go through. I'd merely suggest to pick SourceTools since well it has CTakeDamageInfo mm, so the gamedata maintenance wouldn't fall on you guys. Redsun already has it in its dependencies, and most community servers do as well

But its quite the chunky dependency to pull in, however if VSH-Rewrite keep piling new features request this could be something worth considering.

FortyTwoFortyTwo commented 1 year ago

It can certainly be used in the future if there were to be more reason to use it, just that right now there isn't really a need to do it. If this were to ever come, I'd also like to see methodmap get used instead of enum struct, as struct between plugins can break whenever there an update to it.