using Sandbox.Citizen;
namespace SWB.Base;
public partial class Weapon
{
/// Thirdperson Model
[Property, Group( "Models" )] public Model WorldModel { get; set; }
/// Unique name that identifies the weapon
[Property, Group( "General" )] public string ClassName { get; set; }
[Property, Group( "General" )] public string DisplayName { get; set; }
[Property, Group( "General" ), ImageAssetPath] public string Icon { get; set; }
/// How the player holds the weapon in thirdperson
[Property, Group( "General" )] public AnimationHelper.HoldTypes HoldType { get; set; } = AnimationHelper.HoldTypes.Pistol;
/// Mouse sensitivity while aiming (lower is slower, 0 to disable)
[Property, Group( "General" )] public float AimSensitivity { get; set; } = 0.85f;
/// Can bullets be cocked in the barrel? (clip ammo + 1)
[Property, Group( "General" )] public bool BulletCocking { get; set; } = true;
/// Range that tucking should be enabled (-1 to disable tucking)
[Property, Group( "General" )] public float TuckRange { get; set; } = 30f;
[Property, Group( "General" )] public int Slot { get; set; } = 0;
/// Firing sound when clip is empty
[Property, Group( "Sounds" )] public SoundEvent DeploySound { get; set; }
/// Default weapon field of view
[Property, Group( "FOV" )] public float FOV { get; set; } = 70f;
/// Weapon FOV while aiming (-1 to use default weapon fov)
[Property, Group( "FOV" )] public float AimFOV { get; set; } = -1f;
/// Player FOV while aiming (-1 to use default player fov)
[Property, Group( "FOV" )] public float AimPlayerFOV { get; set; } = -1f;
/// FOV aim in speed
[Property, Group( "FOV" ), Title( "Aim in FOV speed" )] public float AimInFOVSpeed { get; set; } = 1f;
/// FOV aim out speed
[Property, Group( "FOV" ), Title( "Aim out FOV speed" )] public float AimOutFOVSpeed { get; set; } = 1f;
/// Procedural animation speed (lower is slower)
[Property, Group( "Animations" )] public float AnimSpeed { get; set; } = 1;
/// Offset used for setting the weapon to its aim position
[Property, Group( "Animations" ), Title( "Aim Offset (swb_editor_offsets)" )] public AngPos AimAnimData { get; set; }
/// Offset used for setting the weapon to its run position
[Property, Group( "Animations" ), Title( "Run Offset (swb_editor_offsets)" )] public AngPos RunAnimData { get; set; }
/// Offset used for setting the weapon to its run position
[Property, Group( "Animations" ), Title( "Customizing Offset (swb_editor_offsets)" )] public AngPos CustomizeAnimData { get; set; }
/// Duration of the reload animation
[Property, Group( "Animations" )] public float ReloadTime { get; set; } = 1f;
/// Reloading animation
[Property, Group( "Animations" )] public string ReloadAnim { get; set; } = "reload";
/// Duration of the empty reload animation (-1 to disable)
[Property, Group( "Animations" )] public float ReloadEmptyTime { get; set; } = -1f;
/// Reloading animation when clip is empty
[Property, Group( "Animations" )] public string ReloadEmptyAnim { get; set; } = "reload_empty";
/// Duration of the draw animation
[Property, Group( "Animations" )] public float DrawTime { get; set; } = 0.5f;
/// Draw animation
[Property, Group( "Animations" )] public string DrawAnim { get; set; } = "deploy";
/// Duration of the empty draw animation (-1 to disable)
[Property, Group( "Animations" )] public float DrawEmptyTime { get; set; } = -1f;
/// Draw animation when there is no ammo
[Property, Group( "Animations" )] public string DrawEmptyAnim { get; set; } = "";
/// Is the weapon reloading shells instead of a magazine?
[Property, Group( "Shell Reloading" )] public bool ShellReloading { get; set; } = false;
/// Can the weapon shoot while reloading to cancel the reload?
[Property, Group( "Shell Reloading" )] public bool ShellReloadingShootCancel { get; set; } = true;
/// Delay in fire animation to eject the shell
[Property, Group( "Shell Reloading" )] public float ShellEjectDelay { get; set; } = 0;
/// Duration of the shell reload start animation (animation is set with ReloadAnim)
[Property, Group( "Shell Reloading" )] public float ShellReloadStartTime { get; set; } = 0;
/// Duration of the shell reload insert animation (animation is set in animgraph)
[Property, Group( "Shell Reloading" )] public float ShellReloadInsertTime { get; set; } = 0;
/// Is this a bolt action weapon?
[Property, Group( "Bolt Action Reloading" ), Title( "Bolt Action" )] public bool BoltBack { get; set; } = false;
/// Duration of the boltback animation
[Property, Group( "Bolt Action Reloading" )] public float BoltBackTime { get; set; } = 0f;
/// Boltback animation
[Property, Group( "Bolt Action Reloading" )] public string BoltBackAnim { get; set; } = "boltback";
/// Bullet eject delay during the boltback animation (-1 to disable)
[Property, Group( "Bolt Action Reloading" )] public float BoltBackEjectDelay { get; set; } = 0f;
/// Enable scoping, renders a 2D scope on ADS
[Property, Group( "Scoping" )] public bool Scoping { get; set; } = false;
/// Scope Information
[Property, Group( "Scoping" )] public ScopeInfo ScopeInfo { get; set; } = new();
/// Primary attack data
[Property, Group( "Firing" ), Title( "Primary ShootInfo (component)" )] public ShootInfo Primary { get; set; } = new();
/// Secondary attack data (setting this will disable weapon aiming)
[Property, Group( "Firing" ), Title( "Secondary ShootInfo (component)" )] public ShootInfo Secondary { get; set; }
/// Time since the last primary attack
public TimeSince TimeSincePrimaryShoot { get; set; }
/// Time since the last secondary attack
public TimeSince TimeSinceSecondaryShoot { get; set; }
/// Time since deployment
public TimeSince TimeSinceDeployed { get; set; }
/// Time since the last reload
public TimeSince TimeSinceReload { get; set; }
public bool IsCustomizing { get; set; }
/// If the weapon is being reloaded
[Sync] public bool IsReloading { get; set; }
/// If the weapon is being aimed
[Sync] public bool IsAiming { get; set; }
/// If the weapon is being scoped
[Sync] public bool IsScoping { get; set; }
/// If the weapon is being bolt back reloaded
[Sync] public bool InBoltBack { get; set; }
public StatsModifier InitialPrimaryStats { get; private set; }
public StatsModifier InitialSecondaryStats { get; private set; }
public bool IsDeploying => TimeSinceDeployed < 0;
// Private
int burstCount = 0;
int barrelHeat = 0;
}