FortyTwoFortyTwo / Randomizer

TF2 plugin that randomizes player loadout in any imaginable combinations
GNU General Public License v3.0
35 stars 15 forks source link

Fix Eureka Effect teleport (#48) #49

Closed doomy64 closed 4 years ago

doomy64 commented 4 years ago

Fixes #48 Add a listener for the player command "eureka_teleport". Have IsPlayerClass always return true when using this command. There isn't another event that fires every time this command is called, which is why we don't use g_iAllowClientClass and why we reset the new variable the frame after running.

FortyTwoFortyTwo commented 4 years ago

Egh. While this should work, there edge cases that two eureka teleports can happen at same time, and potentially another IsPlayerClass called in the same frame. I would've better off make new virtual client hook CBasePlayer::ClientCommand, disallow IsPlayerClass at post hook while keeping AddCommandListener as pre hook.

doomy64 commented 4 years ago

Updated to disallow IsPlayerClass in a CTFPlayer::ClientCommand post hook, rather than next frame. As far as I can tell this works. If I knew more about dhooks I probably would've checked to if the command was eureka_teleport in the post hook, that way I could use g_iAllowClientClass instead of creating a new variable.