--------------------------------------------------------
--E-8 JSTAR by 4thVEAW Modding Team--
--3D Model : Kleeman
--Script : Voodoo
--Date 18/05/2020
--V1.0
---------------------------------------------------------	
E8_JSTAR =  {
      
		Name 			= 'E8_JSTAR',--AG
		DisplayName		= _('E-8 JSTAR'),--AG
        Picture 		= "E8_JSTAR.png",
        Rate 			= "100",
        Shape			= "E8_JSTAR",--AG	
        WorldID		=  WSTYPE_PLACEHOLDER, 
        
	shape_table_data 	= 
	{
		{
			file  	 	= 'E8_JSTAR';
			life  	 	= 50; -- lifebar
			vis   	 	= 3; -- visibility gain.
			desrt    	= 'E8_JSTAR-oblomok'; -- Name of destroyed object file name
			fire  	 	= { 300, 2}; 			-- Fire on the ground after destoyed: 300sec 2m
			username	= 'E8_JSTAR';
			index       =  WSTYPE_PLACEHOLDER;
			classname   = "lLandPlane";
			positioning = "BYNORMAL";
		},
		{
			name  		= "E8_JSTAR-oblomok";
			file  		= "E8_JSTAR-oblomok";
			fire  		= { 240, 2};
		},
	},
	
	
	mapclasskey 		= "P0091000064",
	attribute  			= {wsType_Air, wsType_Airplane, wsType_Cruiser, WSTYPE_PLACEHOLDER, "AWACS", "Refuelable", "Datalink", "Link16"},
	Categories= {"{8A302789-A55D-4897-B647-66493FA6826F}", "",},
	
		singleInFlight = true,
		
		M_empty	=	77000,		-- with pilot and nose load, kg
		M_nominal	=	140000,	-- kg (Empty Plus Full Internal Fuel)
		M_max	=	152000,		-- kg (Maximum Take Off Weight)
		M_fuel_max	=	90700,	-- kg (Internal Fuel Only)
		H_max	=	13000,
		average_fuel_consumption	=	0.127,
		CAS_min	=	54,
		V_opt	=	208,
		V_take_off	=	58, 	-- Take off speed in m/s (for AI)
		V_land	=	61,			-- Land speed in m/s (for AI)
		has_afteburner	=	false, -- AFB yes/no
		has_speedbrake	=	false, -- Speedbrake yes/no
		has_differential_stabilizer = false,
		main_gear_pos = 	{-0.4,	-5.343,	0},
		radar_can_see_ground	=	false,
		nose_gear_pos = 	{17.886,	-5.373,	0},
		AOA_take_off	=	0.17, 	-- AoA in take off (for AI)
		stores_number	=	0,
		bank_angle_max	=	45, 	-- Max bank angle (for AI)
		Ny_min	=	0.5,			-- Min G (for AI)
		Ny_max	=	2.5,			-- Max G (for AI)
		tand_gear_max	=	0.577,
		V_max_sea_level	=	510,	-- Max speed at sea level in m/s (for AI)
		V_max_h	=	510,			-- Max speed at max altitude in m/s (for AI)
		tanker_type	=	1,--***
		wing_area	=	283,		-- wing area in m2
		wing_span	=	44.2,		--  wing spain in m,
		thrust_sum_max	=	100000,	-- 51.2 kN --> 15200
		thrust_sum_ab	=	100000,	-- 84.6 kN --> 25000
		Vy_max	=	10,				-- Max climb speed in m/s (for AI)
		length	=	46.47,
		height	=	13,
		flaps_maneuver	=	0.5,	-- Max flaps in take-off and maneuver (0.5 = 1st stage; 1.0 = 2nd stage) (for AI)
		Mach_max	=	0.77,		-- Max speed in Mach (for AI)
		range	=	9300,			-- Max range in km (for AI)
		crew_size	=	4,--***
		RCS	=	100,					-- Radar Cross Section m2
		Ny_max_e	=	2,
		detection_range_max	=	0,
		IR_emission_coeff	=	2,	-- Normal engine -- IR_emission_coeff = 1 is Su-27 without afterburner. It is reference.
		IR_emission_coeff_ab	=	0,	-- With afterburner
		engines_count	=	4,
		wing_tip_pos = 	{-8.286,	-0.271,	22},
		nose_gear_wheel_diameter	=	0.754, -- in m
		main_gear_wheel_diameter	=	0.972, -- in m
		engines_nozzles = 
		{
			{
				pos = 	{-3.88,	-1.941,	16.191},
				elevation	=	0,
				diameter	=	1.523,
				exhaust_length_ab	=	11.794,	-- lenght in m
				exhaust_length_ab_K	=	0.76,	-- AB animation
			},
			{
				pos = 	{0.15,	-2.539,	9.78},
				elevation	=	0,
				diameter	=	1.523,
				exhaust_length_ab	=	11.794,
				exhaust_length_ab_K	=	0.76,
			},
			{
				pos = 	{0.15,	-2.539, -9.816},
				elevation	=	0,
				diameter	=	1.523,
				exhaust_length_ab	=	11.794,
				exhaust_length_ab_K	=	0.76,
			},
			{
				pos = 	{-3.88,	-1.941,	-16.153},
				elevation	=	0,
				diameter	=	1.523,
				exhaust_length_ab	=	11.794,
				exhaust_length_ab_K	=	0.76,
			},
		}, -- end of engines_nozzles
		crew_members = 
		{
			[1] = 
			{
				ejection_seat_name	=	0,
				drop_canopy_name	=	0,
				pos = 	{7.916,	0.986,	0},
			}, -- end of [1]
			[2] = 
			{
				ejection_seat_name	=	0,
				drop_canopy_name	=	0,
				pos = 	{3.949,	1.01,	0},
			}, -- end of [2]
			[3] = 
			{
				ejection_seat_name	=	0,
				drop_canopy_name	=	0,
				pos = 	{3.949,	1.01,	0},
			}, -- end of [3]
			[4] = 
			{
				ejection_seat_name	=	0,
				drop_canopy_name	=	0,
				pos = 	{3.949,	1.01,	0},
			}, -- end of [4]
		}, -- end of crew_members
		brakeshute_name	=	0,
		
		air_refuel_receptacle_pos = 	{ 19.11,   0.267,   0.00},

		fires_pos = 
		{
			[1] = 	{-3.88,	-1.941,	16.191},
			[2] = 	{0.15,	-2.539,	9.78},
			[3] = 	{0.15,	-2.539, -9.816},
			[4] = 	{-3.88,	-1.941,	-16.153},
					}, -- end of fires_pos
		
		--chaff_flare_dispenser = 
		{
			[1] = 
			{
				dir = 	{0,	-1,	0},
				pos = 	{1.158,	-1.77,	-0.967},
			}, -- end of [1]
			[2] = 
			{
				dir = 	{0,	-1,	0},
				pos = 	{1.158,	-1.77,	0.967},
			}, -- end of [2]
		}, -- end of chaff_flare_dispenser


		-- Countermeasures, 
		passivCounterm = {
			CMDS_Edit = true,
			SingleChargeTotal = 240,
			chaff = {default = 120, increment = 30, chargeSz = 1},
			flare = {default = 60, increment = 15, chargeSz = 2}
        },
	
        CanopyGeometry = {
            azimuth = {-145.0, 145.0},
            elevation = {-50.0, 90.0}
        },

Sensors = {
RADAR = "AN/APG-63",--f15
RWR = "Abstract RWR"
},
Countermeasures = {
ECM = "AN/ALQ-135"--f15
},
	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 = 251.5,  -- Radio Freq
		editable = true,
		minFrequency = 225.000,
		maxFrequency = 327.000,
		modulation = MODULATION_AM
	},

Guns = {gun_mount("M_61", { count = 0 },{muzzle_pos = {5.00000, 0.250000, 0.000000}})--
},


	Pylons =     {

		pylon(1, 0, 0, 0, 0,
            {
                FiZ = 0,--Winkel
				FiX = 0,--Drehung
            },
            {
                --
            }
        ),
},
	
	Tasks = {
		aircraft_task(Transport),
		aircraft_task(AWACS),
    },	
	DefaultTask = aircraft_task(AWACS),

	SFM_Data = {     --kc-135
	aerodynamics = 
		{
			Cy0	=	0,
			Mzalfa	=	6.6,
			Mzalfadt	=	1,
			kjx	=	2.85,
			kjz	=	0.00125,
			Czbe	=	-0.012,
			cx_gear	=	0.015,
			cx_flap	=	0.08,
			cy_flap	=	1.6,
			cx_brk	=	0.06,
			table_data = 
			{
				[1] = 	{0,	0.023,	0.1,	0.064,	0,	0.5,	20,	1.4},
				[2] = 	{0.2,	0.023,	0.1,	0.064,	0,	1.5,	20,	1.4},
				[3] = 	{0.4,	0.023,	0.1,	0.064,	0,	2.5,	20,	1.4},
				[4] = 	{0.6,	0.025,	0.1,	0.064,	0.022,	3.5,	20,	1.4},
				[5] = 	{0.7,	0.03,	0.1,	0.083,	0.031,	3.5,	20,	1.2},
				[6] = 	{0.8,	0.032,	0.1,	0.107,	0.04,	3.5,	20,	1},
				[7] = 	{0.9,	0.045,	0.1,	0.148,	0.058,	3.5,	20,	0.8},
				[8] = 	{1,	0.054,	0.1,	0.199,	0.1,	3.5,	20,	0.7},
				[9] = 	{1.5,	0.054,	0.1,	0.199,	0.1,	3.5,	20,	0.2},
			}, -- end of table_data
		}, -- end of aerodynamics
		engine = 
		{
			Nmg	=	60.00001,--67.5,
			MinRUD	=	0,
			MaxRUD	=	1,
			MaksRUD	=	1,
			ForsRUD	=	1,
			type	=	"TurboJet",
			hMaxEng	=	19.5,
			dcx_eng	=	0.0085,
			cemax	=	0.37,
			cefor	=	0.37,
			dpdh_m	=	6200,
			dpdh_f	=	6200,
			table_data = 
			{
				[1] = 	{0,	480000,	480000},
				[2] = 	{0.2,	400000,	400000},
				[3] = 	{0.4,	343000,	343000},
				[4] = 	{0.6,	300000,	300000},
				[5] = 	{0.7,	285000,	285000},
				[6] = 	{0.8,	264000,	264000},
				[7] = 	{0.9,	254000,	254000},
				[8] = 	{1,	233000,	233000},
				[9] = 	{1.1,	217000,	217000},
			}, -- end of table_data
		}, -- end of engine
	},


	--damage , index meaning see in  Scripts\Aircrafts\_Common\Damage.lua
	Damage = {
	[0]  = {critical_damage = 5,  args = {146}},--NOSE_CENTER
	[1]  = {critical_damage = 3,  args = {296}},--NOSE_LEFT_SIDE
	[2]  = {critical_damage = 3,  args = {297}},--NOSE_RIGHT_SIDE
	[3]  = {critical_damage = 8, args = {65}},--CABINA / COCKPIT
	[4]  = {critical_damage = 2,  args = {298}},--CABIN_LEFT_SIDE
	[5]  = {critical_damage = 2,  args = {301}},--CABIN_RIGHT_SIDE
	[7]  = {critical_damage = 2,  args = {249}},--GUN
	[8]  = {critical_damage = 3,  args = {265}},--FRONT_GEAR_BOX
	[9]  = {critical_damage = 3,  args = {154}},--FUSELAGE_LEFT_SIDE
	[10] = {critical_damage = 3,  args = {153}},--MAIN / FUSELAGE_RIGHT_SIDE
	[11] = {critical_damage = 1,  args = {167}},--ENGINE_L
	[12] = {critical_damage = 1,  args = {161}},--ENGINE_R
	[13] = {critical_damage = 2,  args = {169}},--MTG_L_BOTTOM
	[14] = {critical_damage = 2,  args = {163}},--MTG_R_BOTTOM
	[15] = {critical_damage = 2,  args = {267}},--LEFT_GEAR_BOX
	[16] = {critical_damage = 2,  args = {266}},--RIGHT_GEAR_BOX
	[17] = {critical_damage = 2,  args = {168}},--ENGINE_L_OUT
	[18] = {critical_damage = 2,  args = {162}},--ENGINE_R_OUT
	[20] = {critical_damage = 2,  args = {183}},--AIR_BRAKE_R
	[23] = {critical_damage = 5, args = {223}},--WING_L_OUT
	[24] = {critical_damage = 5, args = {213}},--WING_R_OUT
	[25] = {critical_damage = 2,  args = {226}},--ELERON_L
	[26] = {critical_damage = 2,  args = {216}},--ELERON_R
	[29] = {critical_damage = 5, args = {224}, deps_cells = {23, 25}},--WING_L_CENTER
	[30] = {critical_damage = 5, args = {214}, deps_cells = {24, 26}},--WING_R_CENTER
	[35] = {critical_damage = 6, args = {225}, deps_cells = {23, 29, 25, 37}},--WING_L_IN
	[36] = {critical_damage = 6, args = {215}, deps_cells = {24, 30, 26, 38}},--WING_R_IN
	[37] = {critical_damage = 2,  args = {228}},--FLAP_L_IN
	[38] = {critical_damage = 2,  args = {218}},--FLAP_R_IN
	[39] = {critical_damage = 2,  args = {244}, deps_cells = {53}},--FIN_L_TOP
	[40] = {critical_damage = 2,  args = {241}, deps_cells = {54}},--FIN_R_TOP 
	[43] = {critical_damage = 2,  args = {243}, deps_cells = {39, 53}},--FIN_L_BOTTOM
	[44] = {critical_damage = 2,  args = {242}, deps_cells = {40, 54}},--FIN_R_BOTTOM 
	[51] = {critical_damage = 2,  args = {240}},--ELEVATOR_L_IN
	[52] = {critical_damage = 2,  args = {238}},--ELEVATOR_R_IN
	[53] = {critical_damage = 2,  args = {248}},--RUDDER_L
	[54] = {critical_damage = 2,  args = {247}},--RUDDER_R
	[56] = {critical_damage = 2,  args = {158}},--TAIL_LEFT_SIDE
	[57] = {critical_damage = 2,  args = {157}},--TAIL_RIGHT_SIDE
	[59] = {critical_damage = 3,  args = {148}},--NOSE_BOTTOM
	[61] = {critical_damage = 2,  args = {147}},--FUEL_TANK_F
	[82] = {critical_damage = 2,  args = {152}},--FUSELAGE_BOTTOM
	[105] = {critical_damage = 2,  args = {603}},--ENGINE_3
	[106] = {critical_damage = 2,  args = {604}},--ENGINE_4
	},
	
	
	lights_data = { typename = "collection", lights = {
	
    [1] = { typename = "collection", -- WOLALIGHT_STROBES
					lights = {	
						--{typename  = "natostrobelight",	argument_1  = 199, period = 1.2, color = {0.8,0,0}, connector = "RESERV_BANO_1"},--R
						--{typename  = "natostrobelight",	argument_1  = 199, period = 1.2, color = {0.8,0,0}, connector = "RESERV1_BANO_1"},--L
						--{typename  = "natostrobelight",	argument_1  = 199, period = 1.2, color = {0.8,0,0}, connector = "RESERV2_BANO_1"},--H
						--{typename  = "natostrobelight",	argument_1  = 196, period = 1.2, color = {0.8,0,0}, connector = "WHITE_BEACON R"},--195
						--{typename  = "natostrobelight",	argument_1  = 195, period = 1.2, color = {0.8,0,0}, connector = "WHITE_BEACON L"},--196
						--{typename  = "natostrobelight",	argument_1  = 192, period = 1.2, color = {0.8,0,0}, connector = "BANO_0_BACK"},
						--{typename  = "natostrobelight",	argument_1  = 204, period = 1.2, color = {0.8,0,0}, connector = "WHITE_BEACON R"},
						--{typename  = "natostrobelight",	argument_1  = 204, period = 1.2, color = {0.8,0,0}, connector = "WHITE_BEACON L"},
							}
			},
	[2] = { typename = "collection",
					lights = {-- Landing light
										{typename = "spotlight",	connector = "MAIN_SPOT_PTM",argument = 208},
										{typename = "spotlight",	connector = "MAIN_SPOT_PTL",argument = 208},
										{typename = "spotlight",	connector = "MAIN_SPOT_PTR",argument = 208},
										--{typename = "spotlight",	connector = "RESERV_SPOT_PTL",	argument = 209},
										--{typename = "spotlight",	connector = "RESERV_SPOT_PTR",	argument = 209}
									 }
						},
    [3]	= {	typename = "collection", -- nav_lights_default
					lights = {
						{typename  = "omnilight",connector =  "BANO_1"  ,argument  =  190,color = {0.99, 0.11, 0.3}},-- Left Position(red)
						{typename  = "omnilight",connector =  "BANO_2"  ,argument  =  191,color = {0, 0.894, 0.6}},-- Right Position(green)
						{typename  = "omnilight",connector =  "BANO_0"  ,argument  =  192,color = {1, 1, 1}},-- Tail Position white)
							}
			},
	[4] = { typename = "collection", -- formation_lights_default
					lights = {
						--{typename  = "argumentlight" ,argument  = 200,},--formation_lights_tail_1 = 200;
						--{typename  = "argumentlight" ,argument  = 201,},--formation_lights_tail_2 = 201;
						--{typename  = "argumentlight" ,argument  = 202,},--formation_lights_left   = 202;
						--{typename  = "argumentlight" ,argument  = 203,},--formation_lights_right  = 203;
						--{typename  = "argumentlight" ,argument  =  88,},--old aircraft arg
							}
			},
	}},
}

add_aircraft(E8_JSTAR)
