codeAPI Reference

BulletConfiguration record struct

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

BulletConfiguration Record Struct

Configuration for s&box bullet weapon behavior including damage, spread, and recoil.

Properties

  • Damage (float) - Base damage per bullet
  • BulletRadius (float) - Radius of the bullet trace
  • Range (float) - Maximum range of the bullet
  • AimConeBase (Vector2) - Base aim cone (pitch, yaw) when fully recovered
  • AimConeSpread (Vector2) - Additional aim cone spread based on time since last shot
  • AimConeRecovery (float) - Time in seconds for aim cone to fully recover
  • RecoilPitch (Vector2) - Random pitch recoil range (min, max)
  • RecoilYaw (Vector2) - Random yaw recoil range (min, max)
  • CameraRecoilStrength (float) - Strength of camera recoil effect
  • CameraRecoilFrequency (float) - Frequency of camera recoil effect

Usage

Used in BaseBulletWeapon to configure bullet behavior:

CSHARP
[Property, Group( "Bullet" )]
public BulletConfiguration Bullet { get; set; } = new()
{
    Damage = 12f,
    BulletRadius = 1f,
    Range = 4096f,
    AimConeBase = new Vector2( 0.5f, 0.25f ),
    AimConeSpread = new Vector2( 3f, 3f ),
    AimConeRecovery = 0.2f,
    RecoilPitch = new Vector2( -0.3f, -0.1f ),
    RecoilYaw = new Vector2( -0.1f, 0.1f ),
    CameraRecoilStrength = 1f,
    CameraRecoilFrequency = 1f,
};

The aim cone amount is calculated based on time since last shot using TimeSince.Relative.Remap():

CSHARP
var aimConeAmount = GetAimConeAmount( config.AimConeRecovery );
var forward = AimRay.Forward
    .WithAimCone(
        config.AimConeBase.x + aimConeAmount * config.AimConeSpread.x,
        config.AimConeBase.y + aimConeAmount * config.AimConeSpread.y
    );

Location

File: d:\GitHubStuff\sandbox\code\Game\Weapon\BaseBulletWeapon\BaseBulletWeapon.cs

Was this helpful?