
if( SERVER ) then

	AddCSLuaFile( "shared.lua" );
	
	SWEP.HoldType = "ar2";

end

SWEP.PrintName = "Morita Mk II + Scope";
SWEP.Author				= "Disseminate"

if( CLIENT ) then

	
	SWEP.Slot = 2;
	SWEP.SlotPos = 2;
	SWEP.CSMuzzleFlashes	= true
	SWEP.ViewModelFOV		= 83;	
	
	SWEP.DrawCrosshair = false;
	
end

SWEP.Base = "weapon_ts_base";
SWEP.Category = "Starship Troopers";

SWEP.ViewModel			= "models/weapons/v_morita.mdl"
SWEP.WorldModel			= "models/weapons/w_morita.mdl"
SWEP.Primary.Sound			= Sound( "Weapon_MP5Navy.Single" )

SWEP.ViewModelFOV		= 40;

SWEP.InvSize = 2;
SWEP.InvWeight = 1;

SWEP.Primary.ClipSize = 10;
SWEP.Primary.DefaultClip = 100;
SWEP.Primary.Ammo = "smg1";
SWEP.Primary.Delay = 0.5;
SWEP.Primary.Damage = 50;
SWEP.Primary.Force = 1;
SWEP.Primary.RunCone = Vector( .1, .1, .1 );
SWEP.Primary.SpreadCone = Vector( .1, .1, .1 );
SWEP.Primary.CrouchSpreadCone = Vector( .001, .001, .001 );
SWEP.Primary.ViewPunch = Angle( -0.5, 0.0, 0 );
SWEP.Primary.Automatic = false;

SWEP.NoDrawOnIronSights = true;
SWEP.FOVAmt = 50;

SWEP.IronSightPos = Vector( -4.8739, 4.4074, -21.6003 );
SWEP.IronSightAng = Vector( 0, 0, 0 );

function SWEP:Reload() -- for delay

		if( self.IsSilenced ) then
				self.Weapon:DefaultReload( ACT_VM_RELOAD_SILENCED );
		else
				self.Weapon:DefaultReload( ACT_VM_RELOAD ); // View model animation
		end
	self.Weapon:SetNWBool( "ironsights", false );
	
	if( self.NoDrawOnIronSights ) then
	
		if( SERVER ) then
			self.Owner:DrawViewModel( true );
		end
	
	end
	
	self.ViewPunchOffset = Vector( 0, 0, 0 );
	
	if( SERVER ) then
		self.Owner:SetFOV( self.FOV, .6 );
	end
	
	self.Weapon:SetNextSecondaryFire( CurTime() + 1.53 );
	self.Weapon:SetNextPrimaryFire( CurTime() + 1.53 );

end

function SWEP:DrawHUD()

	if( self.Owner:GetNWInt( "holstered" ) == 0 and self.Weapon:GetNWBool( "ironsights" ) ) then
	
		surface.SetDrawColor( 0, 0, 0, 255 );
		surface.DrawLine( 0, ScrH() / 2, ScrW(), ScrH() / 2 );
		surface.DrawLine( ScrW() / 2, 0, ScrW() / 2, ScrH() );
		
		surface.SetDrawColor( 0, 0, 0, 255 );
		surface.SetTexture( surface.GetTextureID( "scope/scope_normal" ) );
		
		local w = ScrH();
		local h = ScrH();
		local x = ScrW() / 2 - w / 2;
		local y = ScrH() / 2 - h / 2;
		surface.DrawTexturedRect( x, y, w, h );
		
		surface.SetDrawColor( 0, 0, 0, 255 );
		surface.DrawRect( 0, 0, x, ScrH() );
		surface.DrawRect( x + w, 0, x, ScrH() );
	
	end

end
