--mounting 3d model paths and texture paths 

mount_vfs_model_path (current_mod_path.."/Shapes")
mount_vfs_liveries_path (current_mod_path.."/Liveries")
mount_vfs_texture_path  (current_mod_path.."/Textures/MQ9_PREDATOR.zip")
mount_vfs_texture_path  (current_mod_path.."/Textures/Avionics")
mount_vfs_texture_path  (current_mod_path.."/Textures")
mount_vfs_texture_path  (current_mod_path.."/Textures/Textures_Cockpit_MQ9_PREDATOR.zip")
dofile(current_mod_path.."/Views.lua")

MQ9_PREDATOR =  {
        
	Name 				=   'MQ9_PREDATOR',
	DisplayName			= _('MQ9_PREDATOR'),
	Cannon = "yes",
	HumanCockpit 		= true,
	HumanCockpitPath    = current_mod_path..'/Cockpit/Scripts/',--current_mod_path..'/Cockpit/
	
	Picture 			= "MQ9_PREDATOR.png",
	Rate 				= 40, -- RewardPoint in Multiplayer
	Shape 				= "MQ9_PREDATOR",
	
	shape_table_data 	= 
	{
		{
			file  	 	= 'MQ9_PREDATOR';
			life  	 	= 20; -- lifebar
			vis   	 	= 3; -- visibility gain.
			desrt    		= 'Predator-oblomok'; -- Name of destroyed object file name
			fire  	 	= { 300, 2}; -- Fire on the ground after destoyed: 300sec 2m
			username	= 'MQ9_PREDATOR';
			index    	=  WSTYPE_PLACEHOLDER;
			classname 	= "lLandPlane";
			positioning = "BYNORMAL";
			drawonmap 	= true;
		},
		{
			name  = "MQ9_PREDATOR-oblomok";
			file  = "MQ9_PREDATOR-oblomok";
			fire  = { 240, 2};
		},

	},
	mapclasskey 		= "P0091000024",
	attribute  			= {wsType_Air, wsType_Airplane, wsType_Fighter, WSTYPE_PLACEHOLDER ,"Battleplanes","UAVs",},
	Categories= {"{78EFB7A2-FD52-4b57-A6A6-3BF0E1D6555F}", "",},	
	-------------------------	
		M_empty 					= 1600, -- kg
	M_nominal 					= 4273, -- kg
	M_max 						= 4900, -- kg
	M_fuel_max 					= 1500, -- kg --2225
	H_max 					 	= 13000, -- m
	average_fuel_consumption 	= 0.302, -- this is highly relative, but good estimates are 36-40l/min = 28-31kg/min = 0.47-0.52kg/s -- 45l/min = 35kg/min = 0.583kg/s
	CAS_min 					= 56, -- if this is not OVERAL FLIGHT TIME, but jus LOITER TIME, than it sholud be 10-15 minutes.....CAS capability in minute (for AI)
	V_opt 						= 125,-- Cruise speed (for AI)
	V_take_off 					= 53, -- Take off speed in m/s (for AI)
	V_land 						= 50, -- Land speed in m/s (for AI)
	V_max_sea_level 			= 208, -- Max speed at sea level in m/s (for AI)
	V_max_h 					= 230, -- Max speed at max altitude in m/s (for AI)
	Vy_max 						= 22, -- Max climb speed in m/s (for AI)
	Mach_max 					= 0.76, -- Max speed in Mach (for AI)
	Ny_min 						= -4, -- Min G (for AI)
	Ny_max 						= 8.0,  -- Max G (for AI)
	Ny_max_e 					= 8.0,  -- Max G (for AI)
	AOA_take_off 				= 0.157, -- AoA in take off (for AI)
	bank_angle_max 				= 60, -- Max bank angle (for AI)
		has_afteburner	=	false,
		has_speedbrake	=	false,
		nose_gear_pos				= 	{3.769,	-1.790,	0}, -- nosegear coord 3.769,	-2.353,	0
	        main_gear_pos  				= 	{-0.11,	-2.10,	1.187},
		nose_gear_amortizer_direct_stroke    =  1.795 - 1.795,  -- down from nose_gear_pos !!!
		nose_gear_amortizer_reversal_stroke  =  1.695 - 1.795,  -- up 
		main_gear_amortizer_direct_stroke	 =  1.6 - 1.6, --  down from main_gear_pos !!!
		main_gear_amortizer_reversal_stroke  = 	1.5 - 1.6, --  up 
		nose_gear_amortizer_normal_weight_stroke = -0.095,
		main_gear_amortizer_normal_weight_stroke = -0.114,
		radar_can_see_ground	=	false,
		
		AOA_take_off	=	0.14,
		stores_number	=	9,
		bank_angle_max	=	60,
		Ny_min	=	-2,
		Ny_max	=	5.9,
		tand_gear_max	=	0.577,
		V_max_sea_level	=	322,
		V_max_h	=	440,
		tanker_type	=	0,
		wing_area	=	49.24,
		wing_span	=	11.68,
		wing_type = 2,			
		thrust_sum_max	=	16240,
		thrust_sum_ab	=	16240,
		Vy_max	=	253,
		length	=	19.2,
		height	=	5,
		flaps_maneuver	=	1,
		Mach_max	=	2.17,
		range	=	2593,
		--crew_size	=	2,
		RCS	=	7,
		Ny_max_e	=	6,
		detection_range_max	=	100,
		IR_emission_coeff	=	1,
		IR_emission_coeff_ab	=	4,
		engines_count	=	1,
		wing_tip_pos = 	{-3.207,	-0.00,	10.2},--*
		nose_gear_wheel_diameter	=	0.754,
		main_gear_wheel_diameter	=	0.972,
		engines_nozzles = 
		{
			[1] = 
			{
				pos = 	{-3.605,	-0.65,	-0.50},--
				elevation	=	0.0,-- -1.5   winkel nach oben unten
				diameter	=	0.605,-- 0.765 cone diameter   Kreis Ø
				exhaust_length_ab	=	4, --lenght in m  Kreis Ø kegel efekt
				exhaust_length_ab_K	=	0.707,
				smokiness_level     = 	0.01, 
			}, -- end of [1]
			
		}, -- end of engines_nozzles
		crew_members = 
		{
			
		}, -- end of crew_members
		brakeshute_name	=	3,
		is_tanker	=	false,
		air_refuel_receptacle_pos = 	{0.000,	0.000,	0.000},--9.709,	1.305,	-0.866
		fires_pos = 
		{
			[1] = 	{-1.594,	-0.064,	0},
			[2] = 	{-1.073,	0.319,	3.304},
			[3] = 	{-1.187,	0.338,	-3.678},
			[4] = 	{-0.82,	0.265,	2.774},
			[5] = 	{-0.82,	0.265,	-2.774},
			[6] = 	{-0.82,	0.255,	2.274},
			[7] = 	{-0.82,	0.255,	-2.274},
			[8] = 	{-4.889,	-0.257,	1.193},
			[9] = 	{-4.889,	0.300,	-0.0},
			[10] = 	{-1.257,	0.283,	3.05},
			[11] = 	{-1.257,	0.283,	-3.05},
		}, -- end of fires_pos
		chaff_flare_dispenser = 
		{
			[1] = 
			{
				dir = 	{0,	1,	0},
				pos = 	{-5.776,	1.4,	-0.422},
			}, -- end of [1]
			[2] = 
			{
				dir = 	{0,	1,	0},
				pos = 	{-5.776,	1.4,	0.422},
			}, -- end of [2]
		}, -- end of chaff_flare_dispenser

        LandRWCategories = 
        {
            [1] = 
            {
                Name = "AircraftCarrier",
            }, -- end of [1]
        }, -- end of LandRWCategories
		MaxFuelWeight = "15245",
        MaxHeight = "20000",
        MaxSpeed = "3000",
        MaxTakeOffWeight = "41200",
        Picture = "MQ9_PREDATOR.png",
        Rate = "30",
        Shape = "MQ9_PREDATOR.png",
        TakeOffRWCategories = 
        {
            [1] = 
            {
                Name = "AircraftCarrier With Catapult",
            }, -- end of [1]
			[2] = 
            {
				Name = "AircraftCarrier With Tramplin",
            }, -- end of [2]
        }, -- end of TakeOffRWCategories
        WingSpan = "11.68",
        WorldID = MQ9_PREDATOR,

    -- Countermeasures
		passivCounterm = {
			CMDS_Edit = true,
			SingleChargeTotal = 256,
			-- PPR-26
			chaff = {default = 128, increment = 32, chargeSz = 1},
			-- PPI-26
			flare = {default = 128, increment = 32, chargeSz = 1}
        },
	
        CanopyGeometry = {
            azimuth = {-145.0, 145.0},
            elevation = {-50.0, 90.0}
        },

Sensors = {
RADAR = "AN/APQ-120",
IRST = "OLS-27",
OPTIC = {"TADS DTV", "TADS DVO", "TADS FLIR"},
RWR = "Abstract RWR"
},
	Failures = {
			{ id = 'asc', 		label = _('ASC'), 		enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'autopilot', label = _('AUTOPILOT'), enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'hydro',  	label = _('HYDRO'), 	enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'l_engine',  label = _('L-ENGINE'), 	enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'r_engine',  label = _('R-ENGINE'), 	enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'radar',  	label = _('RADAR'), 	enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'eos',  		label = _('EOS'), 		enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'helmet',  	label = _('HELMET'), 	enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			--{ id = 'mlws',  	label = _('MLWS'), 		enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'rws',  		label = _('RWS'), 		enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'ecm',   	label = _('ECM'), 		enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'hud',  		label = _('HUD'), 		enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },
			{ id = 'mfd',  		label = _('MFD'), 		enable = false, hh = 0, mm = 0, mmint = 1, prob = 100 },		
	},
	HumanRadio = {
		frequency = 127.5,  -- Radio Freq
		editable = true,
		minFrequency = 100.000,
		maxFrequency = 156.000,
		modulation = MODULATION_AM
	},
	mapclasskey = "P0091000024",



    Guns = {gun_mount("DEFA_554", { count = 00 },{muzzle_pos = {3.10000, -0.300000, -0.450000}})

},
Pylons =     {
	pylon(1, 0, -0.506000, -0.450000, -2.225000,
            {
                FiZ = 0,
            },
            {
                { CLSID = "{ee368869-c35a-486a-afe7-284beb7c5d52}",attach_point_position = {0.206000, 0.000000, -0.000000},arg = 52,arg_value = 0.3 },  --AGM114
                { CLSID = "AGM114x2_OH_58" },
               
            }
        ),
       pylon(2, 0, -0.216000, -0.507000, -1.305000,
            {
                FiZ = 0,
            },
            {
                { CLSID = "{ee368869-c35a-486a-afe7-284beb7c5d52}" ,attach_point_position = {-0.076000, 0.050000, -0.000000,},arg = 52,arg_value = 0.3 },     --AGM114
                { CLSID = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}",attach_point_position = {-0.216000, 0.040000, 0.011000,},arg = 52,arg_value = 0.3 },   --GBU-12
            }
        ),
        pylon(3, 0, -0.216000, -0.507000, 1.305000,
            {
                FiZ = 0,
            },
            {
                { CLSID = "{ee368869-c35a-486a-afe7-284beb7c5d52}" ,attach_point_position = {-0.076000, 0.050000, 0.000000,},arg = 52,arg_value = 0.3 },     --AGM114
                { CLSID = "{DB769D48-67D7-42ED-A2BE-108D566C8B1E}",attach_point_position = {-0.216000, 0.040000, -0.011000,},arg = 52,arg_value = 0.3 },   --GBU-12
            }
        ),
        pylon(4, 0, -0.506000, -0.450000, 2.225000,
            {
                FiZ = 0,
            },
            {
                { CLSID = "{ee368869-c35a-486a-afe7-284beb7c5d52}" ,attach_point_position = {0.206000, 0.000000, 0.000000},arg = 52,arg_value = 0.3 },  --AGM114
                { CLSID = "AGM114x2_OH_58" },
                   }
        ),
        pylon(5, 0, -0.216000, -0.507000, -1.305000,
            {
                FiZ = 0,
            },
            {
                {CLSID = "{B1EF6B0E-3D91-4047-A7A5-A99E7D8B4A8B}",attach_point_position = {-0.216000, 0.090000, 1.000000,},arg_value = 0.5 },-- Mercury LLTV Pod
            }
      
        ),
},
	
	EPLRS = true,
	Tasks = {
		aircraft_task(GroundAttack),
        aircraft_task(CAS),
        aircraft_task(AFAC),
		aircraft_task(Reconnaissance),
    },	
	DefaultTask = aircraft_task(GroundAttack),

	SFM_Data = {
		aerodynamics = -- Cx = Cx_0 + Cy^2*B2 +Cy^4*B4
		{
			Cy0			=	0.1,      -- zero AoA lift coefficient
			Mzalfa		=	4.355,  -- coefficients for pitch agility
			Mzalfadt	=	0.8,    -- coefficients for pitch agility
			kjx			=	2.25,    
			kjz			=	0.00125, 
			Czbe		=	-0.016, -- coefficient, along Z axis (perpendicular), affects yaw, negative value means force orientation in FC coordinate system
			cx_gear		=	0.012,    -- coefficient, drag, gear 0.0277
			cx_flap		=	0.095,   -- coefficient, drag, full flaps
			cy_flap		=	0.31,    -- coefficient, normal force, lift, flaps
			cx_brk		=	0.06,   -- coefficient, drag, breaks
			table_data  = 
			{	--        M		 Cx0	 Cya	  B		 B4	    Omxmax	   Aldop   Cymax
				[1] = 	{0,		0.024,	0.07,	0.075,	0.12,	0.5,		30,		1.2},
				[2] = 	{0.1,	0.024,	0.07,	0.075,	0.12,	1.5,		30,		1.2},
				[3] = 	{0.2,	0.024,	0.07,	0.075,	0.12,	0.79,		30,		1.2},
				[4] = 	{0.3,	0.0239,	0.073,	0.075,	0.12,	1.24,		30,		1.2},
				[5] = 	{0.4,	0.024,	0.076,	0.075,	0.12,	1.323,		28.7,	1.18},
				[6] = 	{0.5,	0.0235,	0.079,	0.075,	0.12,	1.13,		27.3,	1.16},
				[7] = 	{0.6,	0.025,	0.083,	0.075,	0.125,	0.94,		26,		1.14},
				[8] = 	{0.7,	0.044,	0.085,	0.14,	0.1,	0.67,		24.7,	1.12},
				[9] = 	{0.8,	0.0465,	0.0855,	0.1775,	0.125,	0.57,		24,		1.11},
				[10] = 	{0.9,	0.049,	0.086,	0.215,	0.15,	0.456,		18,		1.1},
				[11] = 	{1.9,	0.049,	0.083,	0.228,	0.17,	0.32,		17,		1.05},
			}, -- end of table_data
			
		}, -- end of aerodynamics
		engine = 
		{
			Nmg	=	20.5, -- RPM at idle
			MinRUD	=	0, -- Min state of the throttle
			MaxRUD	=	1, -- Max state of the throttle
			MaksRUD	=	1, -- Military power state of the throttle
			ForsRUD	=	1, -- Afterburner state of the throttle
			typeng	=	3,--PISTON ENGINE
			--[[
				E_TURBOJET = 0
				E_TURBOJET_AB = 1
				E_PISTON = 2
				E_TURBOPROP = 3
				E_TURBOFAN				= 4
				E_TURBOSHAFT = 5
			--]]
			
			hMaxEng	=	12.5, -- Max altitude for safe engine operation in km
			dcx_eng	=	0.015, -- Engine drag coeficient
			cemax	=	0.37, -- not used for fuel calulation , only for AI routines to check flight time ( fuel calculation algorithm is built in )
			cefor	=	0.37, -- not used for fuel calulation , only for AI routines to check flight time ( fuel calculation algorithm is built in )
			dpdh_m	=	1800, --  altitude coefficient for max thrust
			dpdh_f	=	1800,  --  altitude coefficient for AB thrust
			
			k_adiab_1			= 0.037923,
			k_adiab_2			= 0.0562,
			MAX_Manifold_P_1	= 155774,		
			MAX_Manifold_P_2	= 206570,		
			MAX_Manifold_P_3	= 226648,		
			k_after_cool		= 0.,
			Displ				= 35,
			k_Eps				= 6.5,
			Stroke				= 0.165,
			V_pist_0			= 13,
			Nu_0				= 1.2,
			Nu_1				= 0.9,
			Nu_2				= 0.001,
			N_indic_0			= 1052480,
			N_fr_0				= 0.04,
			N_fr_1				= 0.001,
			Init_Mom			= 220,
			D_prop				= 3.5,
			MOI_prop			= 45,
			k_gearbox			= 2.4,
			P_oil				= 495438,
			k_boost				= 3,
			k_cfug				= 0.003,
			k_oil				= 0.00004,
			k_piston			= 3000,
			k_reg				= 0.003,
			k_vel				= 0.017,
			table_data = 
			{
			--   M			Pmax
				{0.0,		16620.0},
				{0.1,		15600.0},
				{0.2,		14340.0},
				{0.3,		13320.0},
				{0.4,		12230.0},
				{0.5,		11300.0},
				{0.6,		10600.0},
				{0.7,		10050.0},
				{0.8,		 9820.0},
				{0.9,		 5902.0},
				{1.9,		 3469.0}
			}
			-- M - Mach number
			-- Pmax - Engine thrust at military power
			-- Pfor - Engine thrust at AFB
		}, -- end of engine
	},


	--damage , index meaning see in  Scripts\Aircrafts\_Common\Damage.lua
	Damage = {
				[0] = {critical_damage = 5, args = {82}},
				[3] = {critical_damage = 10, args = {65}},
				[8] = {critical_damage = 10},
				[11] = {critical_damage = 3},
				[12] = {critical_damage = 3},
				[15] = {critical_damage = 10},
				[16] = {critical_damage = 10},
				[17] = {critical_damage = 3},
				[18] = {critical_damage = 3},
				[25] = {critical_damage = 5, args = {53}},
				[26] = {critical_damage = 5, args = {54}},
				[35] = {critical_damage = 10, args = {67}, deps_cells = {25, 37}},
				[36] = {critical_damage = 10, args = {68}, deps_cells = {26, 38}},
				[37] = {critical_damage = 4, args = {55}},
				[38] = {critical_damage = 4, args = {56}},
				[43] = {critical_damage = 4, args = {61}, deps_cells = {53}},
				[44] = {critical_damage = 4, args = {62}, deps_cells = {54}},
				[47] = {critical_damage = 5, args = {63}, deps_cells = {51}},
				[48] = {critical_damage = 5, args = {64}, deps_cells = {52}},
				[51] = {critical_damage = 2, args = {59}},
				[52] = {critical_damage = 2, args = {60}},
				[53] = {critical_damage = 2, args = {57}},
				[54] = {critical_damage = 2, args = {58}},
				[55] = {critical_damage = 5, args = {81}},
				[83]	= {critical_damage = 3, args = {134}}, -- nose wheel                                  
				[84]	= {critical_damage = 3, args = {136}}, -- left wheel                                  
				[85]	= {critical_damage = 3, args = {135}}, -- right wheel
	},
	
	DamageParts = 
	{  
		[1] = "MQ9_PREDATOR_oblomok_R", -- wing R
		[2] = "MQ9_PREDATOR_oblomok_L", -- wing L
		[3] = "MQ9_PREDATOR_oblomok", -- nose
		--[4] = "MQ9_PREDATOR-oblomok-tail-r", -- tail
		--[5] = "MQ9_PREDATOR-oblomok-tail-l", -- tail
	},
	
	lights_data = {	typename = "collection", lights = {
    [1] = {typename = "collection",lights = {}},




	
    [3]	= {	typename = "collection",
								lights = {-- Left Position Light (red)
								{typename = "omnilight",
								 connector = "BANO_2",
								 color = {0.99, 0.11, 0.3},
								 pos_correction  = {0.1, 0, -0.2},
								 argument  = 209
								},
								 -- Right Position Light (green)
								{typename = "omnilight",
								connector = "BANO_1",
								color = {0, 0.894, 0.6},
								pos_correction = {0.1, 0, 0.2},
								argument  = 208
								--},
								-- Tail Position Light (white)
								--{typename = "omnilight",
								--connector = "BANO_0",
								--color = {1, 1, 1},
								--pos_correction  = {0, 0, 0},
								--argument  = 192							},									 
  						                  },
								  {typename = "natostrobelight",
								   connector = "WHITE_BEACON L",
								   argument_1 = 195,
								   period = 1.2,
								   phase_shift = 0
								  },
								  -- Right Anticollision Light
								  {typename = "natostrobelight",
								   connector = "WHITE_BEACON R",
								   argument_1 = 196,
								   period = 1.2,
								   phase_shift = 0
								  },
								  -- Tail Anticollision Light
								  {typename = "natostrobelight",
								   connector = "BANO_0_BACK",
								   argument_1 = 192,
								   period = 1.2,
								   phase_shift = 0
                                                               
	
								  }}
									},




    [2] = { typename = "collection",
							lights = {-- Landing light
									  {typename = "spotlight",
									   connector = "MAIN_SPOT_PTR_02",
									   argument = 209,
									   dir_correction = {elevation = math.rad(-1)}
									  },
									  {-- Landing/Taxi light
									   typename = "spotlight",
									   connector = "MAIN_SPOT_PTR_01",
									   argument = 208,
									   dir_correction = {elevation = math.rad(3)}
									  }
									 }
						},
	[5]	= {typename = "collection",lights = {}},
	}}
}

add_aircraft(MQ9_PREDATOR)





