Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- AddCSLuaFile( "shared.lua" )
- resource.AddFile( "materials/vgui/ttt/m60-icon.vmt" )
- end
- if CLIENT then
- SWEP.PrintName = "M60"
- SWEP.Slot = 2
- SWEP.Icon = "vgui/ttt/m60-icon"
- end
- --Sound file mapping
- if true then
- sound.Add({
- name = "Weapon_M60.Single",
- channel = CHAN_USER_BASE+10,
- volume = 1.0,
- sound = "weapons/m60/m60_fire.wav"
- })
- end
- -- Always derive from weapon_tttbase
- SWEP.Base = "weapon_tttbase"
- -- Standard GMod values
- SWEP.Spawnable = true
- SWEP.Kind = WEAPON_HEAVY
- SWEP.WeaponID = AMMO_M60
- SWEP.Primary.Delay = 0.1275
- SWEP.Primary.Recoil = 1.25
- SWEP.Primary.Automatic = true
- SWEP.Primary.Ammo = "AirboatGun"
- SWEP.Primary.Damage = 17
- SWEP.Primary.Cone = 0.04
- SWEP.Primary.ClipSize = 100
- SWEP.Primary.ClipMax = 100
- SWEP.Primary.DefaultClip = 100
- SWEP.AutoSpawnable = true
- SWEP.HoldType = "ar2"
- SWEP.UseHands = true
- SWEP.ViewModelFlip = false
- SWEP.ViewModelFOV = 64
- SWEP.ViewModel = "models/weapons/v_mach_m60.mdl" -- View Model of your SWEP
- SWEP.WorldModel = "models/weapons/w_mach_m60.mdl" -- World Model
- SWEP.HeadshotMultiplier = 2.0
- SWEP.Primary.Sound = Sound( "Weapon_M60.Single" )
- SWEP.IronSightsPos = Vector(-2.881, -3.593, 0.647)
- SWEP.IronSightsAng = Vector(0, 0.014, -0.176)
- SWEP.Pos = nil
- SWEP.Ang = nil
- function SWEP:CalcAbsolutePosition(pos, ang)
- self.Pos = pos
- self.Ang = ang
- return
- end
- function SWEP:SetZoom(state)
- if CLIENT then return end
- if not (IsValid(self.Owner) and self.Owner:IsPlayer()) then return end
- if state then
- self.Owner:SetFOV(75, 0.5)
- else
- self.Owner: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
- bIronsights = not self:GetIronsights()
- self:SetIronsights( bIronsights )
- if SERVER then
- self:SetZoom( bIronsights )
- end
- self:SetNextSecondaryFire( CurTime() + 0.3 )
- end
- function SWEP:PreDrop()
- self:SetZoom(false)
- self:SetIronsights(false)
- return self.BaseClass.PreDrop(self)
- end
- function SWEP:Holster()
- self:SetIronsights(false)
- self:SetZoom(false)
- return true
- end
- SWEP.Offset = {
- Pos = {
- Up = 0,
- Right = 1,
- Forward = -3,
- },
- Ang = {
- Up = 0,
- Right = 0,
- Forward = 0,
- }
- }
- function SWEP:Think()
- self:DrawWorldModel( )
- end
- function SWEP:RenderOverride()
- self:DrawWorldModel()
- end
- function SWEP:OnDrop()
- self.Owner = nil
- end
- function SWEP:DrawWorldModel( )
- local hand, offset, rotate
- if not IsValid( self.Owner ) then
- self:SetRenderOrigin(self.Pos)
- self:SetRenderAngles(self.Ang)
- self:DrawModel( )
- return
- end
- if not self.Hand then
- self.Hand = self.Owner:LookupAttachment( "anim_attachment_rh" )
- end
- hand = self.Owner:GetAttachment( self.Hand )
- if not hand then
- --self:SetRenderOrigin(self:GetNetworkOrigin())
- --self:SetRenderAngles(self:GetNetworkAngles())
- self:SetRenderOrigin(self.Pos)
- self:SetRenderAngles(self.Ang)
- self:DrawModel( )
- return
- end
- offset = hand.Ang:Right( ) * self.Offset.Pos.Right + hand.Ang:Forward( ) * self.Offset.Pos.Forward + hand.Ang:Up( ) * self.Offset.Pos.Up
- hand.Ang:RotateAroundAxis( hand.Ang:Right( ), self.Offset.Ang.Right )
- hand.Ang:RotateAroundAxis( hand.Ang:Forward( ), self.Offset.Ang.Forward )
- hand.Ang:RotateAroundAxis( hand.Ang:Up( ), self.Offset.Ang.Up )
- if self.SetRenderOrigin == nil or self.SetRenderAngles == nil then return end
- self:SetRenderOrigin( hand.Pos + offset )
- self:SetRenderAngles( hand.Ang )
- self:DrawModel( )
- end
Advertisement
Add Comment
Please, Sign In to add comment