Mikusch / MannVsMann

A plugin for Team Fortress 2 that brings Mann vs. Machine upgrades and mechanics to other gamemodes
https://forums.alliedmods.net/showthread.php?p=2773717
GNU General Public License v3.0
36 stars 7 forks source link

Question regarding the explosive headshot #5

Closed higps closed 3 years ago

higps commented 3 years ago

I'm making a gamemode with giant robots, and we are going to make it compatible with this mode.

One question though, how do you get the explosive headshots to work? In regular TF2 adding the attribute does nothing.

I've looked over the code, but I can't find anything that specifically ties it to that attribute.

Does it have something to do with setting the mode to be mvm?

Mikusch commented 3 years ago

There is a check for CTFGameRules::GameModeUsesUpgrades in CTFPlayer::OnTakeDamage_Alive which determines whether the explosive headshot attribute works. There is a detour in this plugin that makes this function it return true, thus enabling the upgrade.

https://github.com/Mikusch/MannVsMann/blob/ee1d1aa8343d7f922c2686b64d5e8ed25e66807e/addons/sourcemod/scripting/mannvsmann/dhooks.sp#L172-L177