Added VoiceHook functions#1247
Added VoiceHook functions#1247KyleSanderson merged 15 commits intoalliedmodders:masterfrom accelerator74:voicehook
Conversation
When a player leaves during a voteban, he will be banned anyway. Also added a cvar with a ban time setting.
|
Adding comment here since other was deleted. Is there any other info that can be passed to this forward making it more useful besides just client? |
No, but there are plugins that use these hooks. |
|
Why support only CS:GO? I think, this PR should not be merged before you don't add support to another possible games. |
|
It's supported for all games. For csgo uses ClientVoice hook, for others - ProccesVoiceData. |
|
This is a feature I would fully take advantage off if implemented |
Headline
left a comment
There was a problem hiding this comment.
Code-wise this looks okay to me
KyleSanderson
left a comment
There was a problem hiding this comment.
So close - just need to invalidate timers on disconnection / level change. Where'd you get 0.3f from? I remember a peer saying this on direct frames said this wasn't enough so I'd like to understand where the metric came from.
0.3 was taken so as not to create constantly new timers when called and the OnClientSpeakingEnd hook is called correctly. This delay is also used in franc1sco's VoiceAnnounceEX plugin. |
Yeah - this one in particular was really buggy with a clean imp... if there's issues we need to remember that this value is too low. |
KyleSanderson
left a comment
There was a problem hiding this comment.
I apologize - totally not trying to bikeshed you here. I think we're super close (if there's other nits or stuff like that I'll own them after this).
Can you use CVTableHook here and compare vtables each time? That way if a client slips by this we don't miss them forever as we own the function ptr. With the flooding and other stuff going on in TF this may be used in a security fashion.
Can do something like:
https://github.com/alliedmodders/sourcemod/blob/master/extensions/sdkhooks/extension.cpp#L585
https://github.com/alliedmodders/sourcemod/blob/master/extensions/sdktools/hooks.cpp#L307
KyleSanderson
left a comment
There was a problem hiding this comment.
There's a merge conflict and load/unload issues in here.
I don’t understand what’s wrong?) |
|
#1283 changed these hook lists from |
asherkin
left a comment
There was a problem hiding this comment.
Couple of minor comments, but this looks pretty good.
I'm a little concerned about the timer logic but it looks like it should work without letting anything slip through the cracks (once the handle clearing bug mentioned is fixed / clarified). However, alternative implementations I would find less surprising would be:
- Cancel any existing and schedule a new timer each voice frame, so if the timer ever triggers it is because the voice frames have stopped coming it - this'd remove the need to do the manual timing checks.
- Instead of using timers just use a frame hook that checks time / frame count globally.
KyleSanderson
left a comment
There was a problem hiding this comment.
@asherkin I think this is solid enough (after the final bug) to get into the tree. If there's quirks or other stuff they shouldn't be catastrophic.
|
@asherkin what's the skinny on this one? |
|
Sorry for the delay cycling back to this, things have been super crazy with moving. This is all looking good to me other than one issue, which is that the native is a no-op if there are no active consumers of the hook. I think we should just pull this in without the native to get the hook in-tree, as plugins can easily re-build the native behaviour using the hook and it can always be discussed separately if super common. Was going to make that change myself before pulling it (and get someone else to do a final review), but it has been too long already so leaving this comment with the reasoning if you or KyleS want to make that change before I get a chance (but I'll make sure to review and pull if that happens.) |
Added hooks when a player uses a microphone:
And native function:
Sorry for double request. My fails :(