Skip to content
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

Merged
merged 10 commits into from
Aug 30, 2018
Merged

Update Fun module #421

merged 10 commits into from
Aug 30, 2018

Conversation

Arkshine
Copy link
Member

@Arkshine Arkshine commented Mar 10, 2017

This is essentially a code clean up following with some welcomed changes:

  • Updated documentation (made by @rsKliPPy)
  • Toggled internal PlayerPreThink (used with get/set_user_footsteps) and TraceLine (used with get/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)
  • Added HITZONE_* constants for get/set_user_hitzones.
  • Made 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. Fakemeta module comes a little later. Change should be safe 1) it's unlikely having both plugins, one using set_user_hitzones and another hooking TraceLine as the latter would not work properly 2) This native is rarely used.

To do:

  • Testing more

auto index = TypeConversion.edict_to_id(pEntity);

if (Players[index].HasSilentFootsteps())
{
pEntity->v.flTimeStepSound = 999;
Copy link
Contributor

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

Copy link
Member Author

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.).

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.
@Arkshine
Copy link
Member Author

Alright, rebase + cleanup + test done.

@Arkshine Arkshine merged commit 1a2dd9e into alliedmodders:master Aug 30, 2018
OciXCrom pushed a commit to OciXCrom/amxmodx that referenced this pull request Sep 10, 2018
* 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
@PartialCloning PartialCloning mentioned this pull request Jan 17, 2019
PartialCloning added a commit to PartialCloning/amxmodx that referenced this pull request Jan 20, 2019
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.
Arkshine pushed a commit that referenced this pull request Jan 24, 2019
#554 (Revert "Fun: Make TraceLine a post forward") did not fully revert back TraceLine. RETURN_META(MRES_HANDLED); was added by #421 (Update Fun module) but still remains there.
Arkshine pushed a commit that referenced this pull request Jan 30, 2019
#554 (Revert "Fun: Make TraceLine a post forward") did not fully revert back TraceLine. RETURN_META(MRES_HANDLED); was added by #421 (Update Fun module) but still remains there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants