-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Fun module #421
Update Fun module #421
Conversation
modules/fun/fun.cpp
Outdated
auto index = TypeConversion.edict_to_id(pEntity); | ||
|
||
if (Players[index].HasSilentFootsteps()) | ||
{ | ||
pEntity->v.flTimeStepSound = 999; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's more correct to hook PM_PlayStepSound
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I could be wrong, but so far I remember, the best method to silent totally a player's footsteps is to stop PM_PlayStepSound
execution (a good method which doesn't require gamedata is to hook PM_Move
and set runfuncs
to 0, I believe), then to stop the sound on your client, you need to send an updated SVC_NEWMOVEVARS
message (this requires to hook SV_WriteMovevarsToClient
as well).
Is it worth? I'm not sure. It could be if we had a native which can exploit this method to set options that we can't usually have per player (airaccelerate, edgefriction, roll, sky?, etc.).
844a56e
to
5e1b0e0
Compare
Reason: as it is it breaks plugins hooking TraceLine because of the original game call is being superceded and other modules can't catch it. It looks like it's this way from the very start fun module has been introduced 13 years ago before. Fakemeta module comes a little later.
5e1b0e0
to
f429be6
Compare
Alright, rebase + cleanup + test done. |
* Fun: Replace ENTINDEX with TypeConversion for consistency * Fun: Add a class wrapping player's data * Fun: Make TraceLine a post forward Reason: as it is it breaks plugins hooking TraceLine because of the original game call is being superceded and other modules can't catch it. It looks like it's this way from the very start fun module has been introduced 13 years ago before. Fakemeta module comes a little later. * Fun: Clean up code * Fun: Toggle PlayerPreThink forward on demand * Fun: Toggle TraceLine forward on demand * Fun: Add HITZONE* constants for use with set/get_user_hitzone() * Fun: Refactor a litte the player class * Fun: Clean up a little more * Fun: Fix typo in set_user_hitzones from previous commit
alliedmodders#554 (Revert "Fun: Make TraceLine a post forward") did not fully revert back TraceLine. RETURN_META(MRES_HANDLED); was added by alliedmodders#421 (Update Fun module) but still remains there.
This is essentially a code clean up following with some welcomed changes:
PlayerPreThink
(used withget/set_user_footsteps
) andTraceLine
(used withget/set_user_hitzones)
forwards on-demand (in others words, those forwards won't be hooked if no plugins are using such natives or if no players are actually set by them)HITZONE_*
constants forget/set_user_hitzones
.TraceLine
a post forward. Reason: as it is it breaks plugins hookingTraceLine
because of the original game call is being superceded and other modules can't catch it. It looks like it's this way from the very start fun module has been introduced 13 years ago. Fakemeta module comes a little later. Change should be safe 1) it's unlikely having both plugins, one usingset_user_hitzones
and another hookingTraceLine
as the latter would not work properly 2) This native is rarely used.To do: