function SWEP:IsEquipment()

return WEPS.IsEquipment(self)

end

function SWEP:OnDrop()

	self:Remove()

end

SWEP.Base = "weapon_tttbase"

SWEP.ViewModelFOV	= 60

SWEP.ViewModelFlip	= false

SWEP.Spawnable			= false

SWEP.AdminSpawnable		= true

SWEP.Weight			= 5

SWEP.Kind = WEAPON_MELEE

SWEP.WeaponID = AMMO_CROWBAR

SWEP.AllowDrop = false

SWEP.AllowDelete = true

AddCSLuaFile( "shared.lua" )

SWEP.UseHands = true

SWEP.Contact 		= ""

SWEP.Author			= ""

SWEP.Instructions	= "Left Click to attack"

SWEP.ViewModel			= "models/weapons/v_frostmourne.mdl"

SWEP.WorldModel			= "models/weapons/w_frostmourne.mdl"

SWEP.HoldType = "crowbar"

SWEP.FiresUnderwater = true

SWEP.Primary.Damage         = 40

SWEP.Primary.ClipSize		= -1

SWEP.Primary.DefaultClip	= -1

SWEP.Primary.Automatic		= false

SWEP.Primary.Ammo			= "none"

SWEP.Primary.Delay = 1

SWEP.AutoSwitchTo		= false

SWEP.AutoSwitchFrom		= false

SWEP.Category			= "Other"

SWEP.PrintName			= "Frostmourne"

SWEP.Slot				= 0

SWEP.SlotPos			= 0

SWEP.DrawAmmo			= false

SWEP.DrawCrosshair		= true







function SWEP:SecondaryAttack()

	

end



function SWEP:ShouldDropOnDie()

	return false

end

-- function SWEP:Reload() --To do when reloading

-- end 

 

function SWEP:Think() -- Called every frame

end



function SWEP:Initialize()

self:SetWeaponHoldType( "melee" )

end



function SWEP:PrimaryAttack()

   self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )



   if not IsValid(self.Owner) then return end



   if self.Owner.LagCompensation then -- for some reason not always true

      self.Owner:LagCompensation(true)

   end



   local spos = self.Owner:GetShootPos()

   local sdest = spos + (self.Owner:GetAimVector() * 70)



   local tr_main = util.TraceLine({start=spos, endpos=sdest, filter=self.Owner, mask=MASK_SHOT_HULL})

   local hitEnt = tr_main.Entity



//   self.Weapon:EmitSound(sound_single)



   if IsValid(hitEnt) or tr_main.HitWorld then

      self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )



      if not (CLIENT and (not IsFirstTimePredicted())) then

         local edata = EffectData()

         edata:SetStart(spos)

         edata:SetOrigin(tr_main.HitPos)

         edata:SetNormal(tr_main.Normal)



         --edata:SetSurfaceProp(tr_main.MatType)

         --edata:SetDamageType(DMG_CLUB)

         edata:SetEntity(hitEnt)



         if hitEnt:IsPlayer() or hitEnt:GetClass() == "prop_ragdoll" then

            util.Effect("BloodImpact", edata)



            -- does not work on players rah

            --util.Decal("Blood", tr_main.HitPos + tr_main.HitNormal, tr_main.HitPos - tr_main.HitNormal)



            -- do a bullet just to make blood decals work sanely

            -- need to disable lagcomp because firebullets does its own

            self.Owner:LagCompensation(false)

            self.Owner:FireBullets({Num=1, Src=spos, Dir=self.Owner:GetAimVector(), Spread=Vector(0,0,0), Tracer=0, Force=25, Damage=40})

         else

            util.Effect("Impact", edata)

         end

      end

   else

      self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER )

   end





   if CLIENT then

      -- used to be some shit here

   else -- SERVER



      -- Do another trace that sees nodraw stuff like func_button

      local tr_all = nil

      tr_all = util.TraceLine({start=spos, endpos=sdest, filter=self.Owner})

      

      self.Owner:SetAnimation( PLAYER_ATTACK1 )



      if hitEnt and hitEnt:IsValid() then

         if self:OpenEnt(hitEnt) == OPEN_NO and tr_all.Entity and tr_all.Entity:IsValid() then

            -- See if there's a nodraw thing we should open

            self:OpenEnt(tr_all.Entity)

         end



         local dmg = DamageInfo()

         dmg:SetDamage(self.Primary.Damage)

         dmg:SetAttacker(self.Owner)

         dmg:SetInflictor(self.Weapon)

         dmg:SetDamageForce(self.Owner:GetAimVector() * 1500)

         dmg:SetDamagePosition(self.Owner:GetPos())

         dmg:SetDamageType(DMG_CLUB)



         hitEnt:DispatchTraceAttack(dmg, spos + (self.Owner:GetAimVector() * 3), sdest)



--         self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )         



--         self.Owner:TraceHullAttack(spos, sdest, Vector(-16,-16,-16), Vector(16,16,16), 30, DMG_CLUB, 11, true)

--         self.Owner:FireBullets({Num=1, Src=spos, Dir=self.Owner:GetAimVector(), Spread=Vector(0,0,0), Tracer=0, Force=1, Damage=20})

      

      else

--         if tr_main.HitWorld then

--            self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )

--         else

--            self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER )

--         end



         -- See if our nodraw trace got the goods

         if tr_all.Entity and tr_all.Entity:IsValid() then

            self:OpenEnt(tr_all.Entity)

         end

      end

   end



   if self.Owner.LagCompensation then

      self.Owner:LagCompensation(false)

   end

end

 

function SWEP:Deploy()

return true;

end



function SWEP:Holster()

return true;

end