swb_base/structures/ScopeInfo.cs

Data class describing scope visuals and behavior. Stores texture asset paths, sounds, timing, FOV/magnification, sensitivity, sway and spread settings used by weapon scoping.

File Access
namespace SWB.Base;

public class ScopeInfo
{
	/// <summary>2D lens texture</summary>
	[Property, ImageAssetPathAttribute] public string LensTexture { get; set; } = "/materials/swb/scopes/swb_lens_hunter.png";

	/// <summary>2D scope texture</summary>
	[Property, ImageAssetPathAttribute] public string ScopeTexture { get; set; } = "/materials/swb/scopes/swb_scope_hunter.png";

	/// <summary>Delay between ADS and scoping in ms</summary>
	[Property] public float ScopeInDelay { get; set; } = 0.2f;

	/// <summary>Sound that plays when scoping starts</summary>
	[Property] public SoundEvent ScopeInSound { get; set; }

	/// <summary>Sound that plays when scoping ends</summary>
	[Property] public SoundEvent ScopeOutSound { get; set; }

	/// <summary>Player FOV while scoping</summary>
	[Property] public float FOV { get; set; } = 8f;
	/// <summary>
	/// Zoom as a MAGNIFICATION (2.5 = 2.5x). Overrides FOV when above 0.
	///
	/// ⚠️ A fixed FOV is not a fixed zoom: the same 12 degrees is ~7.5x for a player
	/// on 90 FOV and ~6x on 72, so a scope described as "2.5x" would magnify
	/// differently per player. Deriving it from their own FOV keeps the number
	/// meaning what it says.
	/// </summary>
	[Property] public float Magnification { get; set; } = 0f;

	/// <summary>Mouse sensitivity while scoping (lower is slower, 0 to use AimInfo.Sensitivity while scoped)</summary>
	[Property] public float Sensitivity { get; set; } = 0.25f;

	/// <summary>
	/// Let the scope drift with look, movement and idle sway.
	///
	/// ⚠️ Upstream default is ON — the overlay offsets itself from AnalogLook, so
	/// turning slides the sight picture across the screen. That reads as weight on
	/// a simulation-leaning shooter and as a broken overlay everywhere else, since
	/// the crosshair stops matching where the bullet goes.
	/// </summary>
	[Property] public bool Sway { get; set; } = true;
	/// <summary>Spread while scoping (lower is more accurate, 0 = perfect, 1 = normal )</summary>
	[Property] public float Spread { get; set; } = 0f;
}