


------
-- NPC Animations
-- March 24, 2007
-- Rick Darkaliono
------



--Weapons that are always aimed
AlwaysAimed = 
{

	"weapon_physgun",
	"weapon_physcannon",
	"weapon_frag",
	"weapon_slam",
	"weapon_rpg",
	"weapon_ts_psy",
	"gmod_tool",
	"weapon_ts_flashnade"
	

}

--Weapons that are never aimed
NeverAimed =
{

	"ts_keys",
	"weapon_ts_zipties",
	"ts_medic",
	"weapon_ts_godhand",
	"weapon_ts_godfist",
	"ts_healthvial",
	"ts_armor"
	

}

--Weapons that can still be usable while not aimed
UsableHolstered =
{

	"ts_keys",
	"weapon_ts_zipties",
	"ts_medic",
	"ts_hands",
	"weapon_ts_godhand",
	"weapon_ts_godfist",
	"ts_healthvial",
	"ts_armor"
}

Models = {
	          "models/Humans/Group01/Male_01.mdl",
              "models/Humans/Group01/male_02.mdl",
              "models/Humans/Group01/male_03.mdl",
              "models/Humans/Group01/Male_04.mdl",
              "models/Humans/Group01/Male_05.mdl",
              "models/Humans/Group01/male_06.mdl",
              "models/Humans/Group01/male_07.mdl",
              "models/Humans/Group01/male_08.mdl",
              "models/Humans/Group01/male_09.mdl",
              "models/Humans/Group02/Male_01.mdl",
              "models/Humans/Group02/male_02.mdl",
              "models/Humans/Group02/male_03.mdl",
              "models/Humans/Group02/Male_04.mdl",
              "models/Humans/Group02/Male_05.mdl",
              "models/Humans/Group02/male_06.mdl",
              "models/Humans/Group02/male_07.mdl",
              "models/Humans/Group02/male_08.mdl",
              "models/Humans/Group02/male_09.mdl",

              "models/Humans/Group01/Female_01.mdl",
              "models/Humans/Group01/Female_02.mdl",
              "models/Humans/Group01/Female_03.mdl",
              "models/Humans/Group01/Female_04.mdl",
              "models/Humans/Group01/Female_06.mdl",
              "models/Humans/Group01/Female_07.mdl",
              "models/Humans/Group02/Female_01.mdl",
              "models/Humans/Group02/Female_02.mdl",
              "models/Humans/Group02/Female_03.mdl",
              "models/Humans/Group02/Female_04.mdl",
              "models/Humans/Group02/Female_06.mdl",
              "models/Humans/Group02/Female_07.mdl",

}

function ccModelList( ply, cmd, args )

	ply:PrintMessage( 2, "USE rp_setmodel TO CHANGE MODEL. HERE ARE THE MODELS AVAILABLE: " );
	
	for k, v in pairs( Models ) do
	
		ply:PrintMessage( 2, v );
	
	end

end
--concommand.Add( "rp_modellist", ccModelList );

--[[
function ccSetModel( ply, cmd, args )

	for k, v in pairs( Models ) do
	
		if( v == args[1] ) then
			ply:GetTable().NextModel = args[1];
			ply:PrintMessage( 2, "Model will be changed on next spawn" );
			return;
		end
	
	end
	
	ply:PrintMessage( 2, "No such model: " .. args[1] );

end
--concommand.Add( "rp_setmodel", ccSetModel );
]]--

function HolsterToggle( ply )

	if( not NPC_ANIMS_ENABLED ) then return; end

	if( not ply:GetActiveWeapon():IsValid() ) then
		return;
	end

	if( ply:GetNWInt( "tiedup" ) == 1 ) then 
		return; 
	end
	
	local weap = ply:GetActiveWeapon();


	if( ply:GetNWInt( "holstered" ) == 1 ) then
		
		for j, l in pairs( NeverAimed ) do
			
			if( l == weap:GetClass() ) then
				return;
			end
			
		end
	
		MakeAim( ply );
	else
		
		for j, l in pairs( AlwaysAimed ) do
			
			if( l == weap:GetClass() ) then
				return;
			end
			
		end
		
		MakeUnAim( ply );
	end

end
concommand.Add( "rp_toggleholster", HolsterToggle );


function MakeAim( ply )

	if( not ply:GetActiveWeapon():IsValid() ) then return; end

	if( not ply:GetActiveWeapon():GetTable().Invisible ) then
		ply:DrawViewModel( true );
		ply:DrawWorldModel( true );
	else
		ply:DrawViewModel( false );
		ply:DrawWorldModel( false );
	end
	
	ply:GetActiveWeapon():SetNWBool( "NPCAimed", true );
	ply:GetActiveWeapon():SetNextPrimaryFire( CurTime() );
	
	ply:SetNWInt( "holstered", 0 );
	
	if( ply:GetActiveWeapon().ToggleWeaponHolster ) then
		ply:GetActiveWeapon():ToggleWeaponHolster( true );
	end

	ply:SetField( "WeapAnim", GetWeaponAct( ply, ply:Weapon_TranslateActivity( ACT_HL2MP_IDLE ) or -1 ) );
	

end

function MakeUnAim( ply )

	if( not ply:GetActiveWeapon():IsValid() ) then return; end

	ply:DrawViewModel( false );
	
	if( ply:GetActiveWeapon():IsValid() ) then
		ply:GetActiveWeapon():SetNWBool( "NPCAimed", false );
		
		local delay = true;
		
		for k, v in pairs( UsableHolstered ) do
			if( v == ply:GetActiveWeapon():GetClass() ) then
				delay = false;
			end
		end
		
		if( delay ) then
			ply:GetActiveWeapon():SetNextPrimaryFire( CurTime() + 999999 );
		end
		
		if( ply:GetActiveWeapon():GetNWBool( "ironsights" ) ) then
			ply:GetActiveWeapon():ToggleIronsight();
		end
	end
	
	ply:SetNWInt( "holstered", 1 );
	
	if( ply:GetActiveWeapon().ToggleWeaponHolster ) then
		ply:GetActiveWeapon():ToggleWeaponHolster( false );
	end
	
	ply:SetField( "WeapAnim", GetWeaponAct( ply, ply:Weapon_TranslateActivity( ACT_HL2MP_IDLE ) or -1 ) );
	

end


function NPCPlayerSpawn( ply )


	if( not NPC_ANIMS_ENABLED ) then return; end

	GAMEMODE:PlayerSpawn( ply );

	if( ply:GetTable().NextModel ) then
		ply:SetModel( ply:GetTable().NextModel );
	end

	
	return true;

end
--hook.Add( "PlayerSpawn", "NPCPlayerSpawn", NPCPlayerSpawn );


NPCAnim = { }

NPCAnim.CitizenMaleAnim = { }
NPCAnim.CitizenMaleModels = 
{

              "models/Humans/Group01/Male_01.mdl",
              "models/Humans/Group01/male_02.mdl",
              "models/Humans/Group01/male_03.mdl",
              "models/Humans/Group01/Male_04.mdl",
              "models/Humans/Group01/Male_05.mdl",
              "models/Humans/Group01/male_06.mdl",
              "models/Humans/Group01/male_07.mdl",
              "models/Humans/Group01/male_08.mdl",
              "models/Humans/Group01/male_09.mdl",
              "models/Humans/Group02/Male_01.mdl",
              "models/Humans/Group02/male_02.mdl",
              "models/Humans/Group02/male_03.mdl",
              "models/Humans/Group02/Male_04.mdl",
              "models/Humans/Group02/Male_05.mdl",
              "models/Humans/Group02/male_06.mdl",
              "models/Humans/Group02/male_07.mdl",
              "models/Humans/Group02/male_08.mdl",
              "models/Humans/Group02/male_09.mdl",
              "models/Humans/Group03/Male_01.mdl",
              "models/Humans/Group03/male_02.mdl",
              "models/Humans/Group03/male_03.mdl",
              "models/Humans/Group03/Male_04.mdl",
              "models/Humans/Group03/Male_05.mdl",
              "models/Humans/Group03/male_06.mdl",
              "models/Humans/Group03/male_07.mdl",
              "models/Humans/Group03/male_08.mdl",
              "models/Humans/Group03/male_09.mdl",
              "models/Humans/Group03m/Male_01.mdl",
              "models/Humans/Group03m/male_02.mdl",
              "models/Humans/Group03m/male_03.mdl",
              "models/Humans/Group03m/Male_04.mdl",
              "models/Humans/Group03m/Male_05.mdl",
              "models/Humans/Group03m/male_06.mdl",
              "models/Humans/Group03m/male_07.mdl",
              "models/Humans/Group03m/male_08.mdl",
              "models/Humans/Group03m/male_09.mdl",
              "models/Barnes/Citizen/male_01.mdl",
              "models/Barnes/Citizen/male_02.mdl",
              "models/Barnes/Citizen/male_03.mdl",
              "models/Barnes/Citizen/male_04.mdl",
              "models/Barnes/Citizen/male_05.mdl",
              "models/Barnes/Citizen/male_06.mdl",
              "models/Barnes/Citizen/male_07.mdl",
              "models/Barnes/Citizen/male_08.mdl",
              "models/Barnes/Citizen/male_09.mdl",
              "models/Barnes/Refugee/male_01.mdl",
              "models/Barnes/Refugee/male_02.mdl",
              "models/Barnes/Refugee/male_03.mdl",
              "models/Barnes/Refugee/male_04.mdl",
              "models/Barnes/Refugee/male_05.mdl",
              "models/Barnes/Refugee/male_06.mdl",
              "models/Barnes/Refugee/male_07.mdl",
              "models/Barnes/Refugee/male_08.mdl",
              "models/Barnes/Refugee/male_09.mdl",
              "models/Tactical_Rebel.mdl",
              "models/gallaha.mdl",
			  "models/humans/aceskin/AceSkin.mdl",
			  "models/mobileinfantry/mi_01.mdl",
			  "models/mobileinfantry/mi_02.mdl",
			  "models/mobileinfantry/mi_03.mdl",
			  "models/mobileinfantry/mi_04.mdl",
			  "models/mobileinfantry/mi_05.mdl",
			  "models/mobileinfantry/mi_06.mdl",
			  "models/mobileinfantry/mi_07.mdl",
			  "models/mobileinfantry/mi_08.mdl",
			  "models/mobileinfantry/mi_09.mdl",
			  "models/mobileinfantry/mi_m_01.mdl",
			  "models/mobileinfantry/mi_m_02.mdl",
			  "models/mobileinfantry/mi_m_03.mdl",
			  "models/mobileinfantry/mi_m_04.mdl",
			  "models/mobileinfantry/mi_m_05.mdl",
			  "models/mobileinfantry/mi_m_06.mdl",
			  -- "models/mobinfi_super_soldier.mdl",
			  "models/federation_atc.mdl",
			  "models/mobileinfantry/mi_m_07.mdl",
			  "models/mobileinfantry/mi_m_08.mdl",
			  "models/mobileinfantry/mi_m_09.mdl",
			  "models/shacadeemus/mobileinfantry/marauder.mdl"

}



for k, v in pairs( NPCAnim.CitizenMaleModels ) do

	NPCAnim.CitizenMaleModels[k] = string.lower( v );

end

NPCAnim.CitizenMaleAnim["idle"] = 1
NPCAnim.CitizenMaleAnim["walk"] = 6
NPCAnim.CitizenMaleAnim["run"] = 10
NPCAnim.CitizenMaleAnim["glide"] = 27
NPCAnim.CitizenMaleAnim["sit"] = 5
NPCAnim.CitizenMaleAnim["crouch"] = 5
NPCAnim.CitizenMaleAnim["crouchwalk"] = 8

NPCAnim.CitizenMaleAnim["pistolidle"] = 1
NPCAnim.CitizenMaleAnim["pistolwalk"] = 6
NPCAnim.CitizenMaleAnim["pistolrun"] = 10
NPCAnim.CitizenMaleAnim["pistolcrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["pistolcrouch"] = 5
NPCAnim.CitizenMaleAnim["pistolaimidle"] = 270
NPCAnim.CitizenMaleAnim["pistolaimwalk"] = 340
NPCAnim.CitizenMaleAnim["pistolaimrun"] = 319
NPCAnim.CitizenMaleAnim["pistolaimcrouch"] = 271
NPCAnim.CitizenMaleAnim["pistolaimcrouchwalk"] = 342
NPCAnim.CitizenMaleAnim["pistolreload"] = 359
NPCAnim.CitizenMaleAnim["pistolfire"] = 285

NPCAnim.CitizenMaleAnim["smgidle"] = 311
NPCAnim.CitizenMaleAnim["smgrun"] = 338
NPCAnim.CitizenMaleAnim["smgwalk"] = 337
NPCAnim.CitizenMaleAnim["smgaimidle"] = 317
NPCAnim.CitizenMaleAnim["smgaimwalk"] = 340
NPCAnim.CitizenMaleAnim["smgcrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["smgcrouch"] = 5
NPCAnim.CitizenMaleAnim["smgaimcrouch"] = 5
NPCAnim.CitizenMaleAnim["smgaimcrouchwalk"] = 342
NPCAnim.CitizenMaleAnim["smgaimrun"] = 319
NPCAnim.CitizenMaleAnim["smgreload"] = 359
NPCAnim.CitizenMaleAnim["smgfire"] = 289
 
NPCAnim.CitizenMaleAnim["ar2idle"] = 322
NPCAnim.CitizenMaleAnim["ar2walk"] = 339
NPCAnim.CitizenMaleAnim["ar2run"] = 319
NPCAnim.CitizenMaleAnim["ar2aimidle"] = 268
NPCAnim.CitizenMaleAnim["ar2aimwalk"] = 340
NPCAnim.CitizenMaleAnim["ar2aimrun"] = 3
NPCAnim.CitizenMaleAnim["ar2crouchwalk"] = 8
NPCAnim.CitizenMaleAnim["ar2crouch"] = 332
NPCAnim.CitizenMaleAnim["ar2aimcrouch"] = 5
NPCAnim.CitizenMaleAnim["ar2aimcrouchwalk"] = 342

NPCAnim.CitizenMaleAnim["ar2reload"] = 359
NPCAnim.CitizenMaleAnim["ar2fire"] = 281
 
NPCAnim.CitizenMaleAnim["shotgunidle"] = 32
NPCAnim.CitizenMaleAnim["shotgunwalk"] = 337
NPCAnim.CitizenMaleAnim["shotgunrun"] = 319
NPCAnim.CitizenMaleAnim["shotgunaimidle"] = 260
NPCAnim.CitizenMaleAnim["shotgunaimwalk"] = 340
NPCAnim.CitizenMaleAnim["shotgunaimrun"] = 343
NPCAnim.CitizenMaleAnim["shotguncrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["shotguncrouch"] = 5
NPCAnim.CitizenMaleAnim["shotgunaimcrouch"] = 5
NPCAnim.CitizenMaleAnim["shotgunaimcrouchwalk"] = 342
NPCAnim.CitizenMaleAnim["shotgunreload"] = 361
NPCAnim.CitizenMaleAnim["shotgunfire"] = 288
 
NPCAnim.CitizenMaleAnim["crossbowidle"] = 311
NPCAnim.CitizenMaleAnim["crossbowwalk"] = 337
NPCAnim.CitizenMaleAnim["crossbowrun"] = 338
NPCAnim.CitizenMaleAnim["crossbowaimidle"] = 317
NPCAnim.CitizenMaleAnim["crossbowaimwalk"] = 340
NPCAnim.CitizenMaleAnim["crossbowaimrun"] = 319
NPCAnim.CitizenMaleAnim["crossbowcrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["crossbowcrouch"] = 5
NPCAnim.CitizenMaleAnim["crossbowaimcrouch"] = 328
NPCAnim.CitizenMaleAnim["crossbowaimcrouchwalk"] = 342
NPCAnim.CitizenMaleAnim["crossbowreload"] = 359
NPCAnim.CitizenMaleAnim["crossbowfire"] = 288
 
NPCAnim.CitizenMaleAnim["meleeidle"] = 1
NPCAnim.CitizenMaleAnim["meleewalk"] = 6
NPCAnim.CitizenMaleAnim["meleerun"] = 10
NPCAnim.CitizenMaleAnim["meleeaimidle"] = 328
NPCAnim.CitizenMaleAnim["meleeaimcrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["meleeaimcrouch"] = 5
NPCAnim.CitizenMaleAnim["meleecrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["meleecrouch"] = 5
NPCAnim.CitizenMaleAnim["meleeaimwalk"] = 6
NPCAnim.CitizenMaleAnim["meleeaimrun"] = 10
NPCAnim.CitizenMaleAnim["meleefire"] = 277
 
NPCAnim.CitizenMaleAnim["rpgidle"] = 311
NPCAnim.CitizenMaleAnim["rpgwalk"] = 337
NPCAnim.CitizenMaleAnim["rpgrun"] = 338
NPCAnim.CitizenMaleAnim["rpgaimidle"] = 317
NPCAnim.CitizenMaleAnim["rpgaimwalk"] = 340
NPCAnim.CitizenMaleAnim["rpgaimrun"] = 319
NPCAnim.CitizenMaleAnim["rpgcrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["rpgcrouch"] = 5
NPCAnim.CitizenMaleAnim["rpgaimcrouch"] = 328
NPCAnim.CitizenMaleAnim["rpgaimcrouchwalk"] = 342
NPCAnim.CitizenMaleAnim["rpgfire"] = 272
 
NPCAnim.CitizenMaleAnim["grenadeidle"] = 1
NPCAnim.CitizenMaleAnim["grenadewalk"] = 6
NPCAnim.CitizenMaleAnim["grenaderun"] = 10
NPCAnim.CitizenMaleAnim["grenadeaimidle"] = 1
NPCAnim.CitizenMaleAnim["grenadeaimcrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["grenadeaimcrouch"] = 5
NPCAnim.CitizenMaleAnim["grenadecrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["grenadecrouch"] = 5
NPCAnim.CitizenMaleAnim["grenadeaimwalk"] = 6
NPCAnim.CitizenMaleAnim["grenadeaimrun"] = 10
NPCAnim.CitizenMaleAnim["grenadefire"] = 273
 
NPCAnim.CitizenMaleAnim["slamidle"] = 1
NPCAnim.CitizenMaleAnim["slamwalk"] = 6
NPCAnim.CitizenMaleAnim["slamrun"] = 10
NPCAnim.CitizenMaleAnim["slamaimidle"] = 1
NPCAnim.CitizenMaleAnim["slamaimcrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["slamaimcrouch"] = 5
NPCAnim.CitizenMaleAnim["slamcrouchwalk"] = 8
NPCAnim.CitizenMaleAnim["slamcrouch"] = 5
NPCAnim.CitizenMaleAnim["slamaimwalk"] = 6
NPCAnim.CitizenMaleAnim["slamaimrun"] = 10
NPCAnim.CitizenMaleAnim["slamfire"] = 273
 
NPCAnim.CitizenMaleAnim["physgunidle"] = 311
NPCAnim.CitizenMaleAnim["physgunwalk"] = 337
NPCAnim.CitizenMaleAnim["physgunrun"] = 338
NPCAnim.CitizenMaleAnim["physgunaimidle"] = 317
NPCAnim.CitizenMaleAnim["physgunaimwalk"] = 340
NPCAnim.CitizenMaleAnim["physgunaimrun"] = 340
NPCAnim.CitizenMaleAnim["physgunaimcrouchwalk"] = 5
NPCAnim.CitizenMaleAnim["physgunaimcrouch"] = 328

NPCAnim.CitizenFemaleAnim = { }
NPCAnim.CitizenFemaleModels = 
{
	
              "models/Humans/Group01/Female_01.mdl",
              "models/Humans/Group01/Female_02.mdl",
              "models/Humans/Group01/Female_03.mdl",
              "models/Humans/Group01/Female_04.mdl",
              "models/Humans/Group01/Female_06.mdl",
              "models/Humans/Group01/Female_07.mdl",
              "models/Humans/Group02/Female_01.mdl",
              "models/Humans/Group02/Female_02.mdl",
              "models/Humans/Group02/Female_03.mdl",
              "models/Humans/Group02/Female_04.mdl",
              "models/Humans/Group02/Female_06.mdl",
              "models/Humans/Group02/Female_07.mdl",
              "models/Humans/Group03/Female_01.mdl",
              "models/Humans/Group03/Female_02.mdl",
              "models/Humans/Group03/Female_03.mdl",
              "models/Humans/Group03/Female_04.mdl",
              "models/Humans/Group03/Female_06.mdl",
              "models/Humans/Group03/Female_07.mdl",
              "models/Humans/Group03m/Female_01.mdl",
              "models/Humans/Group03m/Female_02.mdl",
              "models/Humans/Group03m/Female_03.mdl",
              "models/Humans/Group03m/Female_04.mdl",
              "models/Humans/Group03m/Female_06.mdl",
              "models/Humans/Group03m/Female_07.mdl",
			  "models/Barnes/Refugee/female_01.mdl",
			  "models/Barnes/Refugee/female_02.mdl",
			  "models/Barnes/Refugee/female_03.mdl",
			  "models/Barnes/Refugee/female_04.mdl",
			  "models/Barnes/Refugee/female_05.mdl",
			  "models/Barnes/Refugee/female_06.mdl",
			  "models/Barnes/Refugee/female_07.mdl",
			  "models/Barnes/Citizen/female_01.mdl",
			  "models/Barnes/Citizen/female_02.mdl",
			  "models/Barnes/Citizen/female_03.mdl",
			  "models/Barnes/Citizen/female_04.mdl",
			  "models/Barnes/Citizen/female_05.mdl",
			  "models/Barnes/Citizen/female_06.mdl",
			  "models/Barnes/Citizen/female_07.mdl",
			  "models/humans/group02/casualfem.mdl",
			  "models/humans/darklgt/Darklight.mdl",
			  "models/police_female.mdl",
			  "models/humans/Group01/drconnors.mdl",
			  "models/mobileinfantry/fmi_01.mdl",
			  "models/mobileinfantry/fmi_02.mdl",
			  "models/mobileinfantry/fmi_03.mdl",
			  "models/mobileinfantry/fmi_04.mdl",
			  "models/mobileinfantry/fmi_06.mdl",
			  "models/mobileinfantry/fmi_07.mdl",
			  "models/mobileinfantry/fmi_m_01.mdl",
			  "models/mobileinfantry/fmi_m_02.mdl",
			  "models/mobileinfantry/fmi_m_03.mdl",
			  "models/mobileinfantry/fmi_m_04.mdl",
			  "models/mobileinfantry/fmi_m_06.mdl",
			  "models/mobileinfantry/fmi_m_07.mdl"			  
}

for k, v in pairs( NPCAnim.CitizenFemaleModels ) do

	NPCAnim.CitizenFemaleModels[k] = string.lower( v );

end


NPCAnim.CitizenFemaleAnim["idle"] = 1
NPCAnim.CitizenFemaleAnim["walk"] = 6
NPCAnim.CitizenFemaleAnim["run"] = 10
NPCAnim.CitizenFemaleAnim["glide"] = 27
NPCAnim.CitizenFemaleAnim["sit"] = 5
NPCAnim.CitizenFemaleAnim["crouch"] = 5
NPCAnim.CitizenFemaleAnim["crouchwalk"] = 8

NPCAnim.CitizenFemaleAnim["pistolidle"] = 1
NPCAnim.CitizenFemaleAnim["pistolwalk"] = 6
NPCAnim.CitizenFemaleAnim["pistolrun"] = 10
NPCAnim.CitizenFemaleAnim["pistolcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["pistolcrouch"] = 5
NPCAnim.CitizenFemaleAnim["pistolaimidle"] = 357
NPCAnim.CitizenFemaleAnim["pistolaimwalk"] = 340
NPCAnim.CitizenFemaleAnim["pistolaimrun"] = 10
NPCAnim.CitizenFemaleAnim["pistolaimcrouch"] = 60
NPCAnim.CitizenFemaleAnim["pistolaimcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["pistolreload"] = 359
NPCAnim.CitizenFemaleAnim["pistolfire"] = 285

NPCAnim.CitizenFemaleAnim["smgidle"] = 311
NPCAnim.CitizenFemaleAnim["smgrun"] = 346
NPCAnim.CitizenFemaleAnim["smgwalk"] = 337
NPCAnim.CitizenFemaleAnim["smgaimidle"] = 317
NPCAnim.CitizenFemaleAnim["smgaimwalk"] = 340
NPCAnim.CitizenFemaleAnim["smgcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["smgcrouch"] = 5
NPCAnim.CitizenFemaleAnim["smgaimcrouch"] = 279
NPCAnim.CitizenFemaleAnim["smgaimcrouchwalk"] = 342
NPCAnim.CitizenFemaleAnim["smgaimrun"] = 334
NPCAnim.CitizenFemaleAnim["smgreload"] = 359
NPCAnim.CitizenFemaleAnim["smgfire"] = 289

NPCAnim.CitizenFemaleAnim["ar2idle"] = 329
NPCAnim.CitizenFemaleAnim["ar2walk"] = 333
NPCAnim.CitizenFemaleAnim["ar2run"] = 344
NPCAnim.CitizenFemaleAnim["ar2aimidle"] = 322
NPCAnim.CitizenFemaleAnim["ar2aimwalk"] = 340
NPCAnim.CitizenFemaleAnim["ar2aimrun"] = 319
NPCAnim.CitizenFemaleAnim["ar2crouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["ar2crouch"] = 5
NPCAnim.CitizenFemaleAnim["ar2aimcrouch"] = 5
NPCAnim.CitizenFemaleAnim["ar2aimcrouchwalk"] = 342
NPCAnim.CitizenFemaleAnim["ar2reload"] = 359
NPCAnim.CitizenFemaleAnim["ar2fire"] = 281

NPCAnim.CitizenFemaleAnim["shotgunidle"] = 320
NPCAnim.CitizenFemaleAnim["shotgunwalk"] = 333
NPCAnim.CitizenFemaleAnim["shotgunrun"] = 319
NPCAnim.CitizenFemaleAnim["shotgunaimidle"] = 361
NPCAnim.CitizenFemaleAnim["shotgunaimwalk"] = 340
NPCAnim.CitizenFemaleAnim["shotgunaimrun"] = 340
NPCAnim.CitizenFemaleAnim["shotguncrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["shotguncrouch"] = 5
NPCAnim.CitizenFemaleAnim["shotgunaimcrouch"] = 5
NPCAnim.CitizenFemaleAnim["shotgunaimcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["shotgunreload"] = 361
NPCAnim.CitizenFemaleAnim["shotgunfire"] = 288

NPCAnim.CitizenFemaleAnim["crossbowidle"] = 311
NPCAnim.CitizenFemaleAnim["crossbowwalk"] = 333
NPCAnim.CitizenFemaleAnim["crossbowrun"] = 343
NPCAnim.CitizenFemaleAnim["crossbowaimidle"] = 317
NPCAnim.CitizenFemaleAnim["crossbowaimwalk"] = 340
NPCAnim.CitizenFemaleAnim["crossbowaimrun"] = 319
NPCAnim.CitizenFemaleAnim["crossbowcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["crossbowcrouch"] = 5
NPCAnim.CitizenFemaleAnim["crossbowaimcrouch"] = 5
NPCAnim.CitizenFemaleAnim["crossbowaimcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["crossbowreload"] = 359
NPCAnim.CitizenFemaleAnim["crossbowfire"] = 288

NPCAnim.CitizenFemaleAnim["meleeidle"] = 1
NPCAnim.CitizenFemaleAnim["meleewalk"] = 6
NPCAnim.CitizenFemaleAnim["meleerun"] = 10
NPCAnim.CitizenFemaleAnim["meleeaimidle"] = 329
NPCAnim.CitizenFemaleAnim["meleeaimcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["meleeaimcrouch"] = 5
NPCAnim.CitizenFemaleAnim["meleecrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["meleecrouch"] = 5
NPCAnim.CitizenFemaleAnim["meleeaimwalk"] = 6
NPCAnim.CitizenFemaleAnim["meleeaimrun"] = 10
NPCAnim.CitizenFemaleAnim["meleefire"] = 277

NPCAnim.CitizenFemaleAnim["rpgidle"] = 311
NPCAnim.CitizenFemaleAnim["rpgwalk"] = 333
NPCAnim.CitizenFemaleAnim["rpgrun"] = 343
NPCAnim.CitizenFemaleAnim["rpgaimidle"] = 317
NPCAnim.CitizenFemaleAnim["rpgaimwalk"] = 340
NPCAnim.CitizenFemaleAnim["rpgaimrun"] = 319
NPCAnim.CitizenFemaleAnim["rpgcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["rpgcrouch"] = 5
NPCAnim.CitizenFemaleAnim["rpgaimcrouch"] = 5
NPCAnim.CitizenFemaleAnim["rpgaimcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["rpgfire"] = 272

NPCAnim.CitizenFemaleAnim["grenadeidle"] = 1
NPCAnim.CitizenFemaleAnim["grenadewalk"] = 6
NPCAnim.CitizenFemaleAnim["grenaderun"] = 10
NPCAnim.CitizenFemaleAnim["grenadeaimidle"] = 1
NPCAnim.CitizenFemaleAnim["grenadeaimcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["grenadeaimcrouch"] = 5
NPCAnim.CitizenFemaleAnim["grenadecrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["grenadecrouch"] = 5
NPCAnim.CitizenFemaleAnim["grenadeaimwalk"] = 6
NPCAnim.CitizenFemaleAnim["grenadeaimrun"] = 10
NPCAnim.CitizenFemaleAnim["grenadefire"] = 273

NPCAnim.CitizenFemaleAnim["slamidle"] = 1
NPCAnim.CitizenFemaleAnim["slamwalk"] = 6
NPCAnim.CitizenFemaleAnim["slamrun"] = 10
NPCAnim.CitizenFemaleAnim["slamaimidle"] = 1
NPCAnim.CitizenFemaleAnim["slamaimcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["slamaimcrouch"] = 5
NPCAnim.CitizenFemaleAnim["slamcrouchwalk"] = 8
NPCAnim.CitizenFemaleAnim["slamcrouch"] = 5
NPCAnim.CitizenFemaleAnim["slamaimwalk"] = 6
NPCAnim.CitizenFemaleAnim["slamaimrun"] = 10
NPCAnim.CitizenFemaleAnim["slamfire"] = 273

NPCAnim.CitizenFemaleAnim["physgunidle"] = 311
NPCAnim.CitizenFemaleAnim["physgunwalk"] = 333
NPCAnim.CitizenFemaleAnim["physgunrun"] = 343
NPCAnim.CitizenFemaleAnim["physgunaimidle"] = 317
NPCAnim.CitizenFemaleAnim["physgunaimwalk"] = 340
NPCAnim.CitizenFemaleAnim["physgunaimrun"] = 340
NPCAnim.CitizenFemaleAnim["physgunaimcrouchwalk"] = 5
NPCAnim.CitizenFemaleAnim["physgunaimcrouch"] = 5


NPCAnim.CombineMetroAnim = { }
NPCAnim.CombineMetroModels =
{
	 "models/police.mdl",
	 "models/leet_police2.mdl",
	 "models/policetrench.mdl",
	 "models/yellowlake/BlaCop.mdl",
	 "models/metrold.mdl",
	 "models/player/ct_sas.mdl"

}

for k, v in pairs( NPCAnim.CombineMetroModels ) do

	NPCAnim.CombineMetroModels[k] = string.lower( v );

end


	NPCAnim.CombineMetroAnim["idle"] = 1
	NPCAnim.CombineMetroAnim["walk"] = 6
	NPCAnim.CombineMetroAnim["run"] = 10
	NPCAnim.CombineMetroAnim["glide"] = 27
	NPCAnim.CombineMetroAnim["sit"] = 360
	NPCAnim.CombineMetroAnim["crouch"] = 360
	NPCAnim.CombineMetroAnim["crouchwalk"] = 8

	NPCAnim.CombineMetroAnim["pistolidle"] = 1
	NPCAnim.CombineMetroAnim["pistolwalk"] = 6
	NPCAnim.CombineMetroAnim["pistolrun"] = 351
	NPCAnim.CombineMetroAnim["pistolcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["pistolcrouch"] = 282
	NPCAnim.CombineMetroAnim["pistolaimidle"] = 304
	NPCAnim.CombineMetroAnim["pistolaimwalk"] = 352
	NPCAnim.CombineMetroAnim["pistolaimrun"] = 353
	NPCAnim.CombineMetroAnim["pistolaimcrouch"] = 360
	NPCAnim.CombineMetroAnim["pistolaimcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["pistolreload"] = 359
	NPCAnim.CombineMetroAnim["pistolfire"] = 285

	NPCAnim.CombineMetroAnim["smgidle"] = 301
	NPCAnim.CombineMetroAnim["smgrun"] = 343
	NPCAnim.CombineMetroAnim["smgwalk"] = 339
	NPCAnim.CombineMetroAnim["smgaimidle"] = 302
	NPCAnim.CombineMetroAnim["smgaimwalk"] = 340
	NPCAnim.CombineMetroAnim["smgcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["smgcrouch"] = 358
	NPCAnim.CombineMetroAnim["smgaimcrouch"] = 360
	NPCAnim.CombineMetroAnim["smgaimcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["smgaimrun"] = 344
	NPCAnim.CombineMetroAnim["smgreload"] = 365
	NPCAnim.CombineMetroAnim["smgfire"] = 289

	NPCAnim.CombineMetroAnim["ar2idle"] = 301
	NPCAnim.CombineMetroAnim["ar2walk"] = 339
	NPCAnim.CombineMetroAnim["ar2run"] = 343
	NPCAnim.CombineMetroAnim["ar2aimidle"] = 302
	NPCAnim.CombineMetroAnim["ar2aimwalk"] = 340
	NPCAnim.CombineMetroAnim["ar2aimrun"] = 344
	NPCAnim.CombineMetroAnim["ar2crouchwalk"] = 8
	NPCAnim.CombineMetroAnim["ar2crouch"] = 358
	NPCAnim.CombineMetroAnim["ar2aimcrouch"] = 360
	NPCAnim.CombineMetroAnim["ar2aimcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["ar2reload"] = 359
	NPCAnim.CombineMetroAnim["ar2fire"] = 281

	NPCAnim.CombineMetroAnim["shotgunidle"] = 301
	NPCAnim.CombineMetroAnim["shotgunwalk"] = 6
	NPCAnim.CombineMetroAnim["shotgunrun"] = 10
	NPCAnim.CombineMetroAnim["shotgunaimidle"] = 302
	NPCAnim.CombineMetroAnim["shotgunaimwalk"] = 340
	NPCAnim.CombineMetroAnim["shotgunaimrun"] = 351
	NPCAnim.CombineMetroAnim["shotguncrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["shotguncrouch"] = 358
	NPCAnim.CombineMetroAnim["shotgunaimcrouch"] = 360
	NPCAnim.CombineMetroAnim["shotgunaimcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["shotgunreload"] = 359
	NPCAnim.CombineMetroAnim["shotgunfire"] = 281

	NPCAnim.CombineMetroAnim["crossbowidle"] = 301
	NPCAnim.CombineMetroAnim["crossbowwalk"] = 6
	NPCAnim.CombineMetroAnim["crossbowrun"] = 10
	NPCAnim.CombineMetroAnim["crossbowaimidle"] = 302
	NPCAnim.CombineMetroAnim["crossbowaimwalk"] = 340
	NPCAnim.CombineMetroAnim["crossbowaimrun"] = 351
	NPCAnim.CombineMetroAnim["crossbowcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["crossbowcrouch"] = 358
	NPCAnim.CombineMetroAnim["crossbowaimcrouch"] = 360
	NPCAnim.CombineMetroAnim["crossbowaimcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["crossbowreload"] = 359
	NPCAnim.CombineMetroAnim["crossbowfire"] = 288

	NPCAnim.CombineMetroAnim["meleeidle"] = 1
	NPCAnim.CombineMetroAnim["meleewalk"] = 6
	NPCAnim.CombineMetroAnim["meleerun"] = 10
	NPCAnim.CombineMetroAnim["meleeaimidle"] = 328
	NPCAnim.CombineMetroAnim["meleeaimcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["meleeaimcrouch"] = 360
	NPCAnim.CombineMetroAnim["meleecrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["meleecrouch"] = 358
	NPCAnim.CombineMetroAnim["meleeaimwalk"] = 323
	NPCAnim.CombineMetroAnim["meleeaimrun"] = 10
	NPCAnim.CombineMetroAnim["meleefire"] = 277

	NPCAnim.CombineMetroAnim["rpgidle"] = 301
	NPCAnim.CombineMetroAnim["rpgwalk"] = 6
	NPCAnim.CombineMetroAnim["rpgrun"] = 10
	NPCAnim.CombineMetroAnim["rpgaimidle"] = 302
	NPCAnim.CombineMetroAnim["rpgaimwalk"] = 340
	NPCAnim.CombineMetroAnim["rpgaimrun"] = 351
	NPCAnim.CombineMetroAnim["rpgcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["rpgcrouch"] = 60
	NPCAnim.CombineMetroAnim["rpgaimcrouch"] = 60
	NPCAnim.CombineMetroAnim["rpgaimcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["rpgreload"] = 359
	NPCAnim.CombineMetroAnim["rpgfire"] = 281

	NPCAnim.CombineMetroAnim["grenadeidle"] = 1467
	NPCAnim.CombineMetroAnim["grenadewalk"] = 6
	NPCAnim.CombineMetroAnim["grenaderun"] = 10
	NPCAnim.CombineMetroAnim["grenadeaimidle"] = 1467
	NPCAnim.CombineMetroAnim["grenadeaimcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["grenadeaimcrouch"] = 60
	NPCAnim.CombineMetroAnim["grenadecrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["grenadecrouch"] = 60
	NPCAnim.CombineMetroAnim["grenadeaimwalk"] = 6
	NPCAnim.CombineMetroAnim["grenadeaimrun"] = 10
	NPCAnim.CombineMetroAnim["grenadefire"] = 277

	NPCAnim.CombineMetroAnim["slamidle"] = 1
	NPCAnim.CombineMetroAnim["slamwalk"] = 6
	NPCAnim.CombineMetroAnim["slamrun"] = 10
	NPCAnim.CombineMetroAnim["slamaimidle"] = 1
	NPCAnim.CombineMetroAnim["slamaimcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["slamaimcrouch"] = 278
	NPCAnim.CombineMetroAnim["slamcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["slamcrouch"] = 278
	NPCAnim.CombineMetroAnim["slamaimwalk"] = 6
	NPCAnim.CombineMetroAnim["slamaimrun"] = 10
	NPCAnim.CombineMetroAnim["slamfire"] = 273

	NPCAnim.CombineMetroAnim["physgunidle"] = 301
	NPCAnim.CombineMetroAnim["physgunwalk"] = 6
	NPCAnim.CombineMetroAnim["physgunrun"] = 10
	NPCAnim.CombineMetroAnim["physgunaimidle"] = 302
	NPCAnim.CombineMetroAnim["physgunaimwalk"] = 340
	NPCAnim.CombineMetroAnim["physgunaimrun"] = 351
	NPCAnim.CombineMetroAnim["physgunaimcrouchwalk"] = 8
	NPCAnim.CombineMetroAnim["physgunaimcrouch"] = 60


NPCAnim.CombineOWAnim = { }

NPCAnim.CombineOWModels =
{
	
	"models/combine_super_soldier.mdl",
	"models/Combine_Soldier.mdl",
	"models/Combine_Black_Soldier.mdl",
	"models/urbantrenchcoat.mdl",
	"models/mobinfi_super_soldier.mdl"

}

for k, v in pairs( NPCAnim.CombineOWModels ) do

	NPCAnim.CombineOWModels[k] = string.lower( v );

end



NPCAnim.CombineOWAnim["idle"] = 1
NPCAnim.CombineOWAnim["walk"] = 339
NPCAnim.CombineOWAnim["run"] = 343
NPCAnim.CombineOWAnim["glide"] = 27
NPCAnim.CombineOWAnim["sit"] = 5
NPCAnim.CombineOWAnim["crouch"] = 5
NPCAnim.CombineOWAnim["crouchwalk"] = 341


NPCAnim.CombineOWAnim["pistolidle"] = 1
NPCAnim.CombineOWAnim["pistolwalk"] = 339
NPCAnim.CombineOWAnim["pistolrun"] = 343
NPCAnim.CombineOWAnim["pistolcrouchwalk"] = 341
NPCAnim.CombineOWAnim["pistolcrouch"] = 5
NPCAnim.CombineOWAnim["pistolaimidle"] = 302
NPCAnim.CombineOWAnim["pistolaimwalk"] = 340
NPCAnim.CombineOWAnim["pistolaimrun"] = 344
NPCAnim.CombineOWAnim["pistolaimcrouch"] = 5
NPCAnim.CombineOWAnim["pistolaimcrouchwalk"] = 341
NPCAnim.CombineOWAnim["pistolreload"] = 359
NPCAnim.CombineOWAnim["pistolfire"] = 289


NPCAnim.CombineOWAnim["smgidle"] = 1
NPCAnim.CombineOWAnim["smgrun"] = 343
NPCAnim.CombineOWAnim["smgwalk"] = 339
NPCAnim.CombineOWAnim["smgaimidle"] = 302
NPCAnim.CombineOWAnim["smgaimwalk"] = 340
NPCAnim.CombineOWAnim["smgcrouchwalk"] = 341
NPCAnim.CombineOWAnim["smgcrouch"] = 5
NPCAnim.CombineOWAnim["smgaimcrouch"] = 5
NPCAnim.CombineOWAnim["smgaimcrouchwalk"] = 341
NPCAnim.CombineOWAnim["smgaimrun"] = 344
NPCAnim.CombineOWAnim["smgreload"] = 359
NPCAnim.CombineOWAnim["smgfire"] = 289

NPCAnim.CombineOWAnim["ar2idle"] = 1
NPCAnim.CombineOWAnim["ar2walk"] = 339
NPCAnim.CombineOWAnim["ar2run"] = 343
NPCAnim.CombineOWAnim["ar2aimidle"] = 302
NPCAnim.CombineOWAnim["ar2aimwalk"] = 340
NPCAnim.CombineOWAnim["ar2aimrun"] = 344
NPCAnim.CombineOWAnim["ar2crouchwalk"] = 341
NPCAnim.CombineOWAnim["ar2crouch"] = 5
NPCAnim.CombineOWAnim["ar2aimcrouch"] = 5
NPCAnim.CombineOWAnim["ar2aimcrouchwalk"] = 341
NPCAnim.CombineOWAnim["ar2reload"] = 66
NPCAnim.CombineOWAnim["ar2fire"] = 416

NPCAnim.CombineOWAnim["shotgunidle"] = 1
NPCAnim.CombineOWAnim["shotgunwalk"] = 348
NPCAnim.CombineOWAnim["shotgunrun"] = 349
NPCAnim.CombineOWAnim["shotgunaimidle"] = 305
NPCAnim.CombineOWAnim["shotgunaimwalk"] = 340
NPCAnim.CombineOWAnim["shotgunaimrun"] = 344
NPCAnim.CombineOWAnim["shotguncrouchwalk"] = 341
NPCAnim.CombineOWAnim["shotguncrouch"] = 5
NPCAnim.CombineOWAnim["shotgunaimcrouch"] = 5
NPCAnim.CombineOWAnim["shotgunaimcrouchwalk"] = 341
NPCAnim.CombineOWAnim["shotgunreload"] = 359
NPCAnim.CombineOWAnim["shotgunfire"] = 281

NPCAnim.CombineOWAnim["crossbowidle"] = 1
NPCAnim.CombineOWAnim["crossbowwalk"] = 339
NPCAnim.CombineOWAnim["crossbowrun"] = 343
NPCAnim.CombineOWAnim["crossbowaimidle"] = 302
NPCAnim.CombineOWAnim["crossbowaimwalk"] = 340
NPCAnim.CombineOWAnim["crossbowaimrun"] = 344
NPCAnim.CombineOWAnim["crossbowcrouchwalk"] = 341
NPCAnim.CombineOWAnim["crossbowcrouch"] = 5
NPCAnim.CombineOWAnim["crossbowaimcrouch"] = 5
NPCAnim.CombineOWAnim["crossbowaimcrouchwalk"] = 341
NPCAnim.CombineOWAnim["crossbowreload"] = 359
NPCAnim.CombineOWAnim["crossbowfire"] = 281

NPCAnim.CombineOWAnim["meleeidle"] = 1
NPCAnim.CombineOWAnim["meleewalk"] = 339
NPCAnim.CombineOWAnim["meleerun"] = 343
NPCAnim.CombineOWAnim["meleeaimidle"] = 302
NPCAnim.CombineOWAnim["meleeaimcrouchwalk"] = 341
NPCAnim.CombineOWAnim["meleeaimcrouch"] = 5
NPCAnim.CombineOWAnim["meleecrouchwalk"] = 341
NPCAnim.CombineOWAnim["meleecrouch"] = 5
NPCAnim.CombineOWAnim["meleeaimwalk"] = 340
NPCAnim.CombineOWAnim["meleeaimrun"] = 344
NPCAnim.CombineOWAnim["meleefire"] = 281

NPCAnim.CombineOWAnim["rpgidle"] = 1
NPCAnim.CombineOWAnim["rpgwalk"] = 339
NPCAnim.CombineOWAnim["rpgrun"] = 343
NPCAnim.CombineOWAnim["rpgaimidle"] = 302
NPCAnim.CombineOWAnim["rpgaimwalk"] = 340
NPCAnim.CombineOWAnim["rpgaimrun"] = 344
NPCAnim.CombineOWAnim["rpgcrouchwalk"] = 341
NPCAnim.CombineOWAnim["rpgcrouch"] = 5
NPCAnim.CombineOWAnim["rpgaimcrouch"] = 5
NPCAnim.CombineOWAnim["rpgaimcrouchwalk"] = 341
NPCAnim.CombineOWAnim["rpgreload"] = 359
NPCAnim.CombineOWAnim["rpgfire"] = 281

NPCAnim.CombineOWAnim["grenadeidle"] = 1
NPCAnim.CombineOWAnim["grenadewalk"] = 335
NPCAnim.CombineOWAnim["grenaderun"] = 339
NPCAnim.CombineOWAnim["grenadeaimidle"] = 1
NPCAnim.CombineOWAnim["grenadeaimcrouchwalk"] = 337
NPCAnim.CombineOWAnim["grenadeaimcrouch"] = 5
NPCAnim.CombineOWAnim["grenadecrouchwalk"] = 337
NPCAnim.CombineOWAnim["grenadecrouch"] = 5
NPCAnim.CombineOWAnim["grenadeaimwalk"] = 336
NPCAnim.CombineOWAnim["grenadeaimrun"] = 340
NPCAnim.CombineOWAnim["grenadefire"] = 355

NPCAnim.CombineOWAnim["slamidle"] = 1
NPCAnim.CombineOWAnim["slamwalk"] = 335
NPCAnim.CombineOWAnim["slamrun"] = 339
NPCAnim.CombineOWAnim["slamaimidle"] = 1
NPCAnim.CombineOWAnim["slamaimcrouchwalk"] = 337
NPCAnim.CombineOWAnim["slamaimcrouch"] = 5
NPCAnim.CombineOWAnim["slamcrouchwalk"] = 337
NPCAnim.CombineOWAnim["slamcrouch"] = 5
NPCAnim.CombineOWAnim["slamaimwalk"] = 336
NPCAnim.CombineOWAnim["slamaimrun"] = 339
NPCAnim.CombineOWAnim["slamfire"] = 281

NPCAnim.CombineOWAnim["physgunidle"] = 1
NPCAnim.CombineOWAnim["physgunwalk"] = 339
NPCAnim.CombineOWAnim["physgunrun"] = 343
NPCAnim.CombineOWAnim["physgunaimidle"] = 302
NPCAnim.CombineOWAnim["physgunaimwalk"] = 340
NPCAnim.CombineOWAnim["physgunaimrun"] = 344
NPCAnim.CombineOWAnim["physgunaimcrouchwalk"] = 341
NPCAnim.CombineOWAnim["physgunaimcrouch"] = 5

WeapActivityTranslate = { }

WeapActivityTranslate[ACT_HL2MP_IDLE_PISTOL] = "pistol";
WeapActivityTranslate[ACT_HL2MP_IDLE_SMG1] = "smg";
WeapActivityTranslate[ACT_HL2MP_IDLE_AR2] = "ar2";
WeapActivityTranslate[ACT_HL2MP_IDLE_RPG] = "rpg";
WeapActivityTranslate[ACT_HL2MP_IDLE_GRENADE] = "grenade";
WeapActivityTranslate[ACT_HL2MP_IDLE_SHOTGUN] = "shotgun";
WeapActivityTranslate[ACT_HL2MP_IDLE_PHYSGUN] = "ar2";
WeapActivityTranslate[ACT_HL2MP_IDLE_CROSSBOW] = "shotgun";
WeapActivityTranslate[ACT_HL2MP_IDLE_SLAM] = "slam";
WeapActivityTranslate[ACT_HL2MP_IDLE_MELEE] = "melee";
WeapActivityTranslate[ACT_HL2MP_IDLE] = "";
WeapActivityTranslate["weapon_pistol"] = "pistol";
WeapActivityTranslate["weapon_357"] = "pistol";
WeapActivityTranslate["gmod_tool"] = "pistol";
WeapActivityTranslate["weapon_smg1"] = "smg";
WeapActivityTranslate["weapon_ar2"] = "ar2";
WeapActivityTranslate["weapon_rpg"] = "rpg";
WeapActivityTranslate["weapon_frag"] = "grenade";
WeapActivityTranslate["weapon_slam"] = "slam";
WeapActivityTranslate["weapon_physgun"] = "ar2";
WeapActivityTranslate["weapon_physcannon"] = "ar2";
WeapActivityTranslate["weapon_crossbow"] = "shotgun";
WeapActivityTranslate["weapon_shotgun"] = "shotgun";
WeapActivityTranslate["weapon_crowbar"] = "melee";
WeapActivityTranslate["weapon_stunstick"] = "melee";

function GetWeaponAct( ply, act )

	local weap = ply:GetActiveWeapon();
	
	if( weap ) then
	
		local class = weap:GetClass();
		
		local trans = "";
		local posttrans = "";
		
		if( weap:GetNWBool( "NPCAimed" ) ) then
			posttrans = "aim";	
		else
			
			if( weap:GetTable().NotHolsterAnim ) then
			
				act = weap:GetTable().NotHolsterAnim;
			
			end
		
		end

		if( act ~= -1 ) then
			trans = WeapActivityTranslate[act];
		else
			trans = WeapActivityTranslate[class];
		end
		
		if( ply:Team() == 2 ) then
		
			if( trans == "shotgun" or
			trans == "ar2" ) then trans = "smg"; end	

		else
		
			if( trans == "shotgun" or
			trans == "ar2" ) then trans = "smg"; end
		
		end
		
		return trans .. ( posttrans or "" );
		
	end
	
	return "";

end

function GM:SetPlayerAnimation( ply, weapanim )

	if( not NPC_ANIMS_ENABLED ) then return; end
	
	if( not ply:IsValid() or not ply:Alive() or ply:GetNWInt( "lyingdown" ) == 1 ) then
		return;
	end	
		

	if( LAG_TEST ) then
		
		Msg( "NPCAnim.SetPlayerAnimation : " .. ply:Nick() .. "\n" );
		
	end

	local seq = 0;
	
	if( not ply:GetField( "OverrideAnim" ) ) then

	
		--ply:SetField( "ChangeAnim", false );

	
		local weap = ply:GetActiveWeapon();
		local animname = ply:GetField( "WeapAnim" );
		
		
		local seqname = "";
		
		local speed = ply:GetVelocity():Length();
		
		if( speed >= 120 ) then
		
			if( ply:OnGround() and ply:Crouching() ) then
				seqname = animname .. "crouchrun";
			else
				seqname = animname .. "run";
			end
		
		elseif( speed >= 10 ) then
		
			if( ply:OnGround() and ply:Crouching() ) then
				seqname = animname .. "crouchwalk";
			else
				seqname = animname .. "walk";
			end
		
		else

			
			if( ply:OnGround() and ply:Crouching() ) then
				seqname = animname .. "crouch";
			else
				seqname = animname .. "idle";


			end
			
		end

		local AnimTable = ply:GetTable().AnimTable;
		
		if( not AnimTable ) then

		
			local model = string.lower( ply:GetModel() );
	
			ply:GetTable().AnimTable = NPCAnim.CitizenMaleAnim;
			
			if( table.HasValue( NPCAnim.CitizenFemaleModels, model ) ) then ply:GetTable().AnimTable = NPCAnim.CitizenFemaleAnim; end
			if( table.HasValue( NPCAnim.CombineMetroModels, model ) ) then ply:GetTable().AnimTable = NPCAnim.CombineMetroAnim; end
			if( table.HasValue( NPCAnim.CombineOWModels, model ) ) then ply:GetTable().AnimTable = NPCAnim.CombineOWAnim; end

			
			AnimTable = ply:GetTable().AnimTable;
		
		end
		
		if( ( weapanim == PLAYER_ATTACK1 or weapanim == PLAYER_RELOAD ) and weap:IsValid() ) then
	
			local act = nil;

		
			if( weapanim == PLAYER_RELOAD ) then
	


				local actname = string.gsub( seqname, "aim", "" ) .. "reload";
				actname = string.gsub( actname, "idle", "" );
			
				local act = tonumber( AnimTable[actname] );
				
				if( act == nil ) then
					return;
				end
	

				--ply:RestartGesture( act );
			
				--return true;
				 
			else
			
				if( ply:Team() == 2 and string.find( seqname, "melee" ) or string.find( seqname, "grenade" ) or string.find( seqname, "slam" ) ) then
				
					local actname = string.gsub( seqname, "aim", "" ) .. "fire";
					actname = string.gsub( actname, "idle", "" );

				
					local act = tonumber( AnimTable[actname] );
					
					if( act == nil ) then
						return;
					end
	
					ply:RestartGesture( act );
					ply:Weapon_SetActivity( act, 0 );
					
					return true;
					
				end
			
				return;
				
			end
		


		end
	
		if ( ( not ply:OnGround() or ply:WaterLevel() > 4 ) and not ply:InVehicle() ) then
			seqname = "glide";
		end
		
		if ( ply:InVehicle() ) then
			
			seqname = "sit";
			
		end

		local actid = AnimTable[seqname];
	
		if( actid == nil or actid == -1 ) then
			seq = ply:GetSequence();
		else
			seq = ply:SelectWeightedSequence( actid );
		end
		
		--ply:SetField( "CrntActID", seq );
		
	else
	
		seq = ply:GetField( "CrntActID" );
	
	end
	
	if( ply:GetModel() == "models/combine_scanner.mdl" ) then
		seq = "idle";
	end

	if ( ply:GetSequence() == seq ) then return true; end

	ply:SetPlaybackRate( 1 );
	ply:ResetSequence( seq );
	ply:SetCycle( 1 );
	
	return true;

end
