Weapons/GlockWeapon.cs

A Glock weapon class deriving from IronSightsWeapon. It defines a primary fire rate property, handles primary attack input, fires a bullet on PrimaryAttack, and draws a simple circular crosshair indicating shootability.

Networking
using Sandbox.Rendering;

public class GlockWeapon : IronSightsWeapon
{
	[Property] public float PrimaryFireRate { get; set; } = 0.15f;

	protected override float GetPrimaryFireRate() => PrimaryFireRate;

	protected override bool WantsPrimaryAttack()
	{
		return Input.Pressed( "attack1" );
	}

	public override void PrimaryAttack()
	{
		ShootBullet( PrimaryFireRate, GetBullet() );
	}

	public override void DrawCrosshair( HudPainter hud, Vector2 center )
	{
		var color = !HasAmmo() || IsReloading() || TimeUntilNextShotAllowed > 0 ? CrosshairNoShoot : CrosshairCanShoot;

		hud.SetBlendMode( BlendMode.Normal );
		hud.DrawCircle( center, 5, Color.Black );
		hud.DrawCircle( center, 3, color );
	}
}