diff options
Diffstat (limited to 'entities/weapons/rad_sg552/shared.lua')
| -rw-r--r-- | entities/weapons/rad_sg552/shared.lua | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/entities/weapons/rad_sg552/shared.lua b/entities/weapons/rad_sg552/shared.lua index 9d22ef2..393ab68 100644 --- a/entities/weapons/rad_sg552/shared.lua +++ b/entities/weapons/rad_sg552/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "SG 552" SWEP.IconLetter = "A" SWEP.Slot = 4 SWEP.Slotpos = 2 - + end SWEP.HoldType = "ar2" @@ -45,13 +45,13 @@ SWEP.Primary.Automatic = true function SWEP:SetZoomMode( num ) if num > 2 then - + num = 1 self.Weapon:UnZoom() - + end - + self.Weapon:SetNWInt( "Mode", num ) self.Owner:SetFOV( self.ZoomModes[num], self.ZoomSpeeds[num] ) @@ -59,39 +59,39 @@ end function SWEP:PrimaryAttack() - if not self.Weapon:CanPrimaryAttack() then - + if not self.Weapon:CanPrimaryAttack() then + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) - - return - + + return + end self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) self.Weapon:SetClip1( self.Weapon:Clip1() - 1 ) self.Weapon:ShootEffects() - + if self.IsSniper and self.Weapon:GetZoomMode() == 1 then - + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 ) - + else - + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) - + end - + --[[if self.Weapon:GetZoomMode() > 1 then - + self.Weapon:UnZoom() - + end]] - + if SERVER then - + self.Owner:AddAmmo( self.AmmoType, -1 ) - + end end @@ -99,49 +99,49 @@ end function SWEP:DrawHUD() if self.Weapon:ShouldNotDraw() then return end - + local mode = self.Weapon:GetZoomMode() local cone = self.Primary.Cone local scale = cone - + if mode == 1 then - + cone = self.Primary.SniperCone scale = cone - + end local x = ScrW() * 0.5 local y = ScrH() * 0.5 local scalebywidth = ( ScrW() / 1024 ) * 10 - + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then - + scale = cone * 1.75 - + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then - + scale = math.Clamp( cone / 1.75, 0, 10 ) - + end - + scale = scale * scalebywidth - + local dist = math.abs( self.CrosshairScale - scale ) self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) - + local gap = 40 * self.CrosshairScale local length = gap + self.CrossLength:GetInt() //20 * self.CrosshairScale - + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) - + if mode != 1 then - + local w = ScrW() local h = ScrH() local wr = ( h / 3 ) * 4 @@ -149,11 +149,11 @@ function SWEP:DrawHUD() surface.SetTexture( surface.GetTextureID( "gmod/scope" ) ) surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawTexturedRect( ( w / 2 ) - wr / 2, 0, wr, h ) - + surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawRect( 0, 0, ( w / 2 ) - wr / 2, h ) surface.DrawRect( ( w / 2 ) + wr / 2, 0, w - ( ( w / 2 ) + wr / 2 ), h ) - + end - -end
\ No newline at end of file + +end |
