Skip to content

[TF2] Implement ConVars for player Sniper lasers and improve Sniper laser rendering - #2014

Open
dilbertron2 wants to merge 1 commit into
ValveSoftware:masterfrom
dilbertron2:sniper-laser-cvars2
Open

[TF2] Implement ConVars for player Sniper lasers and improve Sniper laser rendering#2014
dilbertron2 wants to merge 1 commit into
ValveSoftware:masterfrom
dilbertron2:sniper-laser-cvars2

Conversation

@dilbertron2

Copy link
Copy Markdown

Description

This PR gives servers the ability to give all sniper rifles laser sights that indicate where the Sniper is aiming, the lasers also indicate how charged the shot is. While working on this I ended up rewriting the Sniper laser rendering code, which is used for the robot Snipers in MvM. The lasers in both instances appear much more smoothly because of this.

ConVars:
tf_sniper_rifle_laser If set, all sniper rifles will have a laser sight, similar to Snipers in Mann Vs Machine.
tf_sniper_rifle_laser_min_opacity The minimum opacity of sniper rifle laser sights.
tf_sniper_rifle_laser_max_opacity The maximum opacity of sniper rifle laser sights.

You cannot see your own laser when scoped in, or spectating someone who is scoped in. Care has been taken to make sure that robot Sniper lasers in MvM look visually identical to live TF2.

Videos

Player Sniper laser showcase

sniper.laser.PR.1.mp4

Laser smoothness comparison

sniper.laser.PR.2.mp4

INSTRUCTIONS FOR USING

These changes make use of new particles I created (sniper_laser_sight_beam_muzzle & sniper_laser_sight_beam_dot_muzzle) in order to allow for the laser to have its opacity changed and to fit better on the muzzles of the sniper rifles.

This required me to create a new class_fx.pcf file! This file MUST be placed in the particles folder! The PR will not work without it!
class_fx.zip

3 ConVars (tf_sniper_rifle_laser, tf_sniper_rifle_laser_min_opacity, tf_sniper_rifle_laser_max_opacity)
rewrite sniper laser rendering to prioritise smoothness and accuracy
increase opacity of laser particle as charge percentage increases
add dummy function to tf_weapon_laser_pointer.h to stop CSniperDot::ClientThink from running whenever wrangler is active
@dilbertron2 dilbertron2 changed the title [TF2] Implement ConVar controls for player Sniper lasers and improve Sniper laser rendering [TF2] Implement ConVars for player Sniper lasers and improve Sniper laser rendering Aug 23, 2026
@pizzaperp95

Copy link
Copy Markdown

r/tf2's favorite PR

@Pygargue00fr

Copy link
Copy Markdown

Honestly I would like to see this in game, even if not on official servers.

Then again, they could set it on in Casual mode for a while and see how people react to it.

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.

3 participants