Skip to content

Add mp_knife_wall_sparks cvar: spark effect when a knife hits a wall#1163

Open
belomaxorka wants to merge 1 commit into
rehlds:masterfrom
belomaxorka:feat/knife-wall-sparks
Open

Add mp_knife_wall_sparks cvar: spark effect when a knife hits a wall#1163
belomaxorka wants to merge 1 commit into
rehlds:masterfrom
belomaxorka:feat/knife-wall-sparks

Conversation

@belomaxorka

Copy link
Copy Markdown

What

New cvar mp_knife_wall_sparks (default 0 — original behavior). When enabled, a spark effect (TE_SPARKS) is shown at the point of impact whenever a knife hits a wall — both for the slash (CKnife::Swing) and the stab (CKnife::Stab) attack, in the exact code branches where weapons/knife_hitwall1.wav is played.

Why

This is a popular cosmetic tweak that servers currently implement with AMXX plugins that hook every EmitSound call and reconstruct the impact point indirectly (via get_user_aiming and distance heuristics), which is both inaccurate and wasteful. Native support is a one-liner per attack path using the existing UTIL_Sparks() utility:

  • the exact impact point is taken from the attack TraceResult;
  • the effect is sent as MSG_PVS (only to nearby players), not MSG_ALL;
  • zero overhead when the cvar is disabled.

Implementation notes

  • Gated by #ifdef REGAMEDLL_ADD, vanilla builds are unaffected.
  • Default 0 keeps the original behavior bit-for-bit.
  • Documented in README.md and dist/game.cfg.

Tested

Verified on a live ReHLDS server (Windows, CS 1.6): with mp_knife_wall_sparks 1 sparks appear at the exact impact point for both attack buttons; with 0 behavior is identical to the original (sound only). The cvar can be toggled at runtime.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@belomaxorka belomaxorka changed the title Add mp_knife_wall_sparks cvar: spark effect when a knife hits a wall Add mp_knife_wall_sparks cvar: spark effect when a knife hits a wall Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant