AddCSLuaFile()

if CLIENT then
   SWEP.PrintName = "Big Ben"
   SWEP.Slot = 2
   SWEP.Icon = "vgui/ttt/icon_deagle"
   SWEP.IconLetter = "b"
end

SWEP.Base = "weapon_tttbase"
SWEP.HoldType = "revolver"

SWEP.Primary.Ammo = "357"
SWEP.Primary.Delay = 0.8
SWEP.Primary.Recoil = 25
SWEP.Primary.Cone = 0.01
SWEP.Primary.Damage = 48
SWEP.Primary.Automatic = false
SWEP.Primary.ClipSize = 5
SWEP.Primary.ClipMax = 12
SWEP.Primary.DefaultClip = 5
SWEP.Primary.Sound = Sound( "Lonely.BigBen_Fire" )

SWEP.HeadshotMultiplier    = 10

SWEP.UseHands = true
SWEP.ViewModelFlip = false
SWEP.ViewModelFOV = 50
SWEP.ViewModel = Model( "models/weapons/cstrike/c_pist_bigben.mdl" )
SWEP.WorldModel = Model( "models/weapons/w_pist_bigben.mdl" )

SWEP.Kind = WEAPON_PISTOL
SWEP.AutoSpawnable = false
SWEP.AmmoEnt = "item_ammo_357_ttt"
SWEP.AllowDrop = true
SWEP.IsSilent = false
SWEP.NoSights = false

SWEP.IronSightsPos         = Vector(-6.361, -3.701, 2.15)
SWEP.IronSightsAng         = Vector(0, 0, 0)

function SWEP:SetZoom(state)
   if not (IsValid(self:GetOwner()) and self:GetOwner():IsPlayer()) then return end
   if state then
      self:GetOwner():SetFOV(55, 0.2)
   else
      self:GetOwner():SetFOV(0, 0.2)
   end
end

-- Add some zoom to ironsights for this gun
function SWEP:SecondaryAttack()
   if not self.IronSightsPos then return end
   if self:GetNextSecondaryFire() > CurTime() then return end

   local bIronsights = not self:GetIronsights()

   self:SetIronsights( bIronsights )

   self:SetZoom( bIronsights )

   self:SetNextSecondaryFire( CurTime() + 0.3 )
end

function SWEP:PreDrop()
   self:SetZoom(false)
   self:SetIronsights(false)
   return self.BaseClass.PreDrop(self)
end

function SWEP:Reload()
    if (self:Clip1() == self.Primary.ClipSize or
        self:GetOwner():GetAmmoCount(self.Primary.Ammo) <= 0) then
       return
    end
    self:DefaultReload(ACT_VM_RELOAD)
    self:SetIronsights(false)
    self:SetZoom(false)
end

function SWEP:Holster()
   self:SetIronsights(false)
   self:SetZoom(false)
   return true
end