-- This script is isolated from all other scripts
-- If you need to include other scripts you should do it manually below


_OpenScript( "functions_vector.lua" );

-- These variables are passed by the engine

MyIndex			=	0; -- Weapon's entity index.
Owner			= 	0; -- The player that owns this weapon
CurrentTime		=	0; -- The current game time

-- Called when the weapon is created.
	
	function onInit( )
		
		_SWEPSetSound( MyIndex, "single_shot", "Weapon_Garand.Shoot" );
		
	end

-- Called every frame

	function onThink( )
			
	end
	
	
-- 

	function onPrimaryAttack( )
						
			
	end
	
	
	function onSecondaryAttack( )		
		
		return false;     -- No sec attack
					
	end
	
        function onReload( )
			
		return true;
			
	end


-- Weapon settings.
-- These are only accessed once when setting the weapon up
	
	function getWeaponSwapHands()  --If true, switch hands.
		return false;	
	end
	
	function getWeaponFOV()  --Field of view when using this weapon. If ya wanna be ghetto, set to 10 for a sniper rifle
		return 80;	
	end
	
	function getWeaponSlot() --This is the "slot" on the inventory where your weapon will be. (Crowbar is 1, pistol is 2, smg is 3)
		return 3;	
	end
	
	function getWeaponSlotPos() --This is the position in the slot. (Crowbar is 1, stunstick is 2, smg is 1, rpg is 2.)
		return 4;	
	end
	
	function getFiresUnderwater() --Can you shoot in atlantis?
		return false;     --sure, y nawt?! lawl!
	end
	
	function getReloadsSingly()  --You gonna reload like a shotgun?
		return false;
	end
	
	function getDamage()  --How much do you hurt people?
		return 50;
	end
	
	function getPrimaryShotDelay() --Rate of fire (unknown units)
		return 0.4;
	end
	
	function getSecondaryShotDelay() --Rate of Secondary Fire
		return 0.01;
	end
	
	function getPrimaryIsAutomatic() --Can you just hold the mouse button?
		return false;
	end
	
	function getSecondaryIsAutomatic() --Same, for secondary
		return true;
	end
	


        function getBulletSpread() --OK, here is where we are going to use those vector functions that we opened up in the first line of code. This is how much the bullets spread. I am assuming it is XYZ.
		return vector3( 0.0, 0.0, 0.0 );
	end
	
	function getViewKick() --Where and how much to kick your view.
		return vector3( -5.0, 0.0, 0.0);
	end
	
	function getViewKickRandom() --Random View kick values
		return vector3( 0.0, 0.0, 0.0 );
	end

	function getViewModel( ) --Weapon model. In this case, it is the 357.
		return "models/weapons/v_garand.mdl";
	end
	
	function getWorldModel( ) --The weapon model as it appears to everyone else. NOTE, It is not the same! There is a v_ and a w_
		return "models/weapons/w_garand.mdl";
	end
	
	function getClassName() --Name it after this script. Don't duplicate classnames. Make them all unique.
		return "weapon_garand";
	end

	function getPrimaryAmmoType() --Sadly... I don't know what this does? I guess it is how the bullet interacts with the world?
		return "ar2";
	end
		
	function getSecondaryAmmoType()
		return "ar2";
	end



        -- return -1 if it doesn't use clips
	function getMaxClipPrimary() --How many primary fire bullets you can hold.
		return 8;
	end
	
	function getMaxClipSecondary()
		return -1;
	end
	
	-- ammo in gun by default
	function getDefClipPrimary() --Default Ammo
		return 90;
	end
	
	function getDefClipSecondary()
		return 0;
	end

	-- pistol, smg, ar2, shotgun, rpg, phys, crossbow, melee, slam, grenade
	function getAnimPrefix() --How to animate
		return "pistol";
	end

	function getPrintName() --Name in inventory
		return "M1 Garand";
	end
	
	
	-- 0 = Don't override, shoot bullets, make sound and flash
	-- 1 = Don't shoot bullets but do make flash/sounds
	-- 2 = Only play animations
	-- 3 = Don't do anything
	
	function getPrimaryScriptOverride()
		return 0;
	end

	function getSecondaryScriptOverride() --all explained
		return 3;
	end