mount_vfs_model_path	(current_mod_path.."/Shapes")
mount_vfs_texture_path  (current_mod_path.."/Textures")

AN_M64_12 = 
{
	CLSID        = "AN_M64_12",
	category     = CAT_BOMBS,
	Picture	=	"M64.png",
	attribute	=	{4,	5,	9,	90},
	displayName	=	_("12 AN-M64"),
	Count	=	12,
	Weight	=	2724,
	Elements	=	
	{
		[1]	=	
		{
			Position	=	{0,	0,	0},
			ShapeName	=	"AN-M64",
		}, 
	}, -- end of Elements
}
declare_loadout(AN_M64_12)

B_29 = 
{
	Name 				=   'B-29',
	DisplayName			= _('B-29'),
--	HumanCockpit 		= false,
	Picture 			= current_mod_path.."/B-29.png",
	Rate 				= 40, -- RewardPoint in Multiplayer
	Shape 				= "B-29",
	shape_table_data 	= 
	{
		{
			file  	 = 'B-29';
			life  	 = 18; -- lifebar
			vis   	 = 3; -- visibility gain.
			desrt    = 'B-29_destr'; -- Name of destroyed object file name
			fire  	 = { 300, 2}; -- Fire on the ground after destoyed: 300sec 2m
			username = 'B-29';
			index    =  WSTYPE_PLACEHOLDER;
			classname 	= "lLandPlane";
			positioning = "BYNORMAL";
			drawonmap 	= true;
		},
		{
			name  = "B-29_destr";
			file  = "B-29-destr";
			fire  = { 240, 2};
		},

	},
	mapclasskey = "P0091000027",
	attribute  			= {wsType_Air, wsType_Airplane, wsType_Intruder, WSTYPE_PLACEHOLDER , "Strategic bombers"},
	Categories 			= {},

	-------------------------
	M_empty 					= 32400, -- kg
	M_nominal 					= 62000, -- kg
	M_max 						= 64000, -- kg
	M_fuel_max 					= 19900, -- kg
	length 						= 30.2, -- full lenght in m
	height 						= 8.5, -- height in m
	wing_area 					= 151.0, -- wing area in m2
	wing_span 					= 43.1, -- wing spain in m
	wing_type 					= 0,
	wing_tip_pos 				=  {0.908,	1.636, 21.415}, -- wingtip coords for visual effects
	nose_gear_pos 				= {12.448,	-2.587,	0}, -- nosegear coord
	main_gear_pos 				= {1.993,	-2.587,	4.503}, -- main gear coords
	tand_gear_max 				= 0.577,
	nose_gear_wheel_diameter 	= 0.793, -- in m
	main_gear_wheel_diameter 	= 1.395, -- in m
	stores_number				=	0,
	V_opt 						= 150,-- Cruise speed (for AI)
	V_take_off 					= 80, -- Take off speed in m/s (for AI) 288km/h
	V_land 						= 75, -- Land speed in m/s (for AI)
	V_max_sea_level 			= 110, -- Max speed at sea level in m/s (for AI)
	V_max_h 					= 125, -- Max speed at max altitude in m/s (for AI)
	Vy_max 						= 0, -- Max climb speed in m/s (for AI) 2.68
	Mach_max 					= 0.40, -- Max speed in Mach (for AI)
	H_max 					 	= 7000, -- m
	Ny_min 						= 1, -- Min G (for AI) 0
	Ny_max 						= 1,  -- Max G (for AI) 2.5 
	Ny_max_e 					= 1,  -- Max G (for AI) 2
	AOA_take_off 				= 0, -- AoA in take off (for AI) 0.14
	bank_angle_max 				= 0, -- Max bank angle (for AI) 45
	average_fuel_consumption 	= 0.2527, -- 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
	range 						= 6600, -- Max range in km (for AI)
	CAS_min 					= 72, -- if this is not OVERAL FLIGHT TIME, but jus LOITER TIME, than it sholud be 10-15 minutes.....CAS capability in minute (for AI)
	thrust_sum_max 				= 50000,
	thrust_sum_ab 				= 50000,
	has_afteburner 				= false, -- AFB yes/no
	has_speedbrake 				= false, -- Speedbrake yes/no
	tanker_type 				= 0, -- Tanker type if the plane is airrefuel capable
	flaps_maneuver 				= 0, -- Max flaps in take-off and maneuver (0.5 = 1st stage; 1.0 = 2nd stage) (for AI) 0.5
	brakeshute_name 			= 0, -- Landing - brake chute visual shape after separation
	is_tanker 					= false, -- Tanker yes/no
	air_refuel_receptacle_pos 	= {0, 0, 0}, -- refuel coords
	RCS 						= 100, -- Radar Cross Section m2
	IR_emission_coeff 			= 1.5, -- Normal engine -- IR_emission_coeff = 1 is Su-27 without afterburner. It is reference.
	IR_emission_coeff_ab 		= 0, -- With afterburner
	engines_count				= 4, -- Engines count
	engines_nozzles = 
	{
		[1] = 
		{
			pos 		=  {4.522,	0.584,	-9.834}, -- nozzle coords
			elevation   =  0, -- AFB cone elevation
			diameter	 = 1.523, -- AFB cone diameter
			exhaust_length_ab	=	11.794,
			exhaust_length_ab_K	=	0.76,
		},
		[2] = 
		{
			pos 		=  {4.522,	0,	-4.578}, -- nozzle coords
			elevation   =  0, -- AFB cone elevation
			diameter	 = 1.523, -- AFB cone diameter
			exhaust_length_ab	=	11.794,
			exhaust_length_ab_K	=	0.76,
		},
		[3] = 
		{
			pos 		=  {4.522,	0,	4.578}, -- nozzle coords
			elevation   =  0, -- AFB cone elevation
			diameter	 = 1.523, -- AFB cone diameter
			exhaust_length_ab	=	11.794,
			exhaust_length_ab_K	=	0.76,
		},
		[4] = 
		{
			pos 		=  {4.522,	0.584,	9.834}, -- nozzle coords
			elevation   =  0, -- AFB cone elevation
			diameter	 = 1.523, -- AFB cone diameter
			exhaust_length_ab	=	11.794,
			exhaust_length_ab_K	=	0.76,
		},
	}, -- end of engines_nozzles

	crew_size	 = 11,
	crew_members = 
	{
	}, -- end of crew_members

	fires_pos = 
	{
		[1] = 	{-2.117,	-0.9,	0},
		[2] = 	{4.00,	0.213,	2.182},
		[3] = 	{4.00,	0.213,	-2.182},
		[4] = 	{-0.82,	0.265,	2.774},
		[5] = 	{-0.82,	0.265,	-2.774},
		[6] = 	{-0.82,	0.255,	4.274},
		[7] = 	{-0.82,	0.255,	-4.274},
		[8] = 	{6.5,	-0.5,	4.578},
		[9] = 	{6.5,	-0.5,	-4.578},
		[10] = 	{6.0,	0.084,	9.834},
		[11] = 	{6.0,	0.084,	-9.834},
	}, -- end of fires_pos
	
	-- Countermeasures
	SingleChargeTotal	 	= 0,
	CMDS_Incrementation 	= 0,
	ChaffDefault 			= 0, 
	ChaffChargeSize 		= 0,
	FlareDefault 			= 0, 
	FlareChargeSize 		= 0,
	CMDS_Edit 				= false,
	chaff_flare_dispenser 	= 
	{
	}, -- end of chaff_flare_dispenser

	--sensors
	
	detection_range_max		 = 60,
	radar_can_see_ground 	 = true, -- this should be examined (what is this exactly?)
	CanopyGeometry = 
	{
		azimuth   = {-160.0, 160.0}, -- pilot view horizontal (AI)
		elevation = {-50.0, 90.0} -- pilot view vertical (AI)
	},
	Sensors = 
	{
	},
	HumanRadio = 
	{
		frequency = 127.5,  -- Radio Freq
		editable = true,
		minFrequency = 100.000,
		maxFrequency = 156.000,
		modulation = MODULATION_AM
	},

	Guns = 
	{
		gun_mount("M_2",
			{count = 1000},
			{muzzle_pos = {11.67, 1.57, 0.0},
			 supply_position = {11.67, 1.57, 0.0},
			 aft_gun_mount = true,
			}
		),
		gun_mount("M_2",
			{count = 1000},
			{muzzle_pos = {11.3, -1.57, 0.0},
			 supply_position = {11.3, -1.57, 0.0},
			 aft_gun_mount = true,
			}
		),
		gun_mount("M_2",
			{count = 1000},
			{muzzle_pos = {-3.16, 1.57, 0.0},
			 supply_position = {-3.16, 1.57, 0.0},
			 aft_gun_mount = true,
			}
		),
		gun_mount("M_2",
			{count = 1000},
			{muzzle_pos = {-8.77, -0.56, 0.0},
			 supply_position = {-8.77, -0.56, 0.0},
			 aft_gun_mount = false,
			}
		),
		gun_mount("M_2",
			{count = 1000},
			{muzzle_pos = {-14.48, 0.99, 0.0},
			 supply_position = {-14.48, 0.99, 0.0},
			 aft_gun_mount = false,
			}
		),
	},
	
	Pylons = 
    {
		-- Parameter 2 = Internal or External pylon, so if its set to 2 it fires the Argument #26
        pylon(1, 2, 7.7, -0.5, 0,
            {
            },
            {
				{ CLSID = "AN_M64_12" },
            }
        ),
        pylon(2, 2, 1.8, -0.5, 0,
            {
            },
            {
				{ CLSID = "AN_M64_12" },
            }
        ),
    },

	Tasks = 
	{
		aircraft_task(GroundAttack),
		aircraft_task(RunwayAttack),
		aircraft_task(PinpointStrike),
--		aircraft_task(CAP),
--      aircraft_task(FighterSweep),
    },	
	DefaultTask = aircraft_task(PinpointStrike),

	SFM_Data = {
		aerodynamics = -- Cx = Cx_0 + Cy^2*B2 +Cy^4*B4
		{
			Cy0			=	0,      -- zero AoA lift coefficient
			Mzalfa		=	0,--6.6,  -- coefficients for pitch agility
			Mzalfadt	=	0,--1,    -- coefficients for pitch agility
			kjx			=	0,--2.85,    
			kjz			=	0,--0.00125, 
			Czbe		=	0,---0.012, -- coefficient, along Z axis (perpendicular), affects yaw, negative value means force orientation in FC coordinate system
			cx_gear		=	0.015,    -- coefficient, drag, gear
			cx_flap		=	0.08,   -- coefficient, drag, full flaps
			cy_flap		=	1,    -- coefficient, normal force, lift, flaps
			cx_brk		=	0.06,   -- coefficient, drag, breaks
			table_data  = 
			{
			--   M		Cx0		Cya		B		B4			Omxmax	Aldop	Cymax
				{0,		0.025,	0.1,	0.0384,	0.000001,	0,	5,	1},
				{0.2,	0.025,	0.1,	0.0384,	0.000001,	0,	5,	1},
				{0.4,	0.025,	0.1,	0.0384,	0.000001,	0,	5,	1},
				{0.6,	0.032,	0.1,	0,		0.3,		0,	5,	1},
				{0.7,	0.034,	0.1,	0.045,	0.9,		0,	5,	1},
				{0.8,	0.036,	0.1,	0.107,	1,			0,	5,	1},
				{0.9,	0.045,	0.1,	0.148,	0.058,		0,	5,	0.2},
				{1,		0.054,	0.1,	0.199,	0.1,		0,	5,	0.2},
				{1.5,	0.054,	0.1,	0.199,	0.1,		0,	5,	0.2},
			}, -- end of table_data
			-- M - Mach number
			-- Cx0 - Coefficient, drag, profile, of the airplane
			-- Cya - Normal force coefficient of the wing and body of the aircraft in the normal direction to that of flight. Inversely proportional to the available G-loading at any Mach value. (lower the Cya value, higher G available) per 1 degree AOA
			-- B - Polar quad coeff
			-- B4 - Polar 4th power coeff
			-- Omxmax - roll rate, rad/s
			-- Aldop - Alfadop Max AOA at current M - departure threshold
			-- Cymax - Coefficient, lift, maximum possible (ignores other calculations if current Cy > Cymax)
		}, -- end of aerodynamics
		engine = 
		{
			Nmg	=	67.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	=	2,
			--	E_TURBOJET = 0
			--	E_TURBOJET_AB = 1
			--	E_PISTON = 2
			--	E_TURBOPROP = 3
			--	E_TURBOFAN	= 4
			--	E_TURBOSHAFT = 5
			hMaxEng	=	11.0, -- Max altitude for safe engine operation in km
			dcx_eng	=	0.0085, -- 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	=	6400, --  altitude coefficient for max thrust
			dpdh_f	=	6400,  --  altitude coefficient for AB thrust
			table_data = 
			{
			--   M		Pmax		 Pfor	
				{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}
			}, -- end of table_data
			-- M - Mach number
			-- Pmax - Engine thrust at military power
			-- Pfor - Engine thrust at AFB
			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.54,
			Displ				= 27,
			k_Eps				= 6,
			Stroke				= 0.152,
			V_pist_0			= 12,
			Nu_0				= 15.0,
			Nu_1				= 2.4,
			Nu_2				= 0.001,
			N_indic_0			= 1023040,
			N_fr_0				= 0.072,
			N_fr_1				= 0.02,
			Init_Mom			= 220,
			D_prop				= 3.45,
			MOI_prop			= 65,
			k_gearbox			= 2.088,
			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,
		}, -- end of engine
	}, -- end of SFM_Data

	--damage , index meaning see in  Scripts\Aircrafts\_Common\Damage.lua
	Damage = 
	{
		[10] = {critical_damage = 10},
		[11] = {critical_damage = 3},
		[12] = {critical_damage = 3},
		[23] = {critical_damage = 5, args = {223}, deps_cells = {53}},
		[24] = {critical_damage = 5, args = {213}, deps_cells = {54}},
		[25] = {critical_damage = 5, args = {53}},
		[26] = {critical_damage = 5, args = {54}},
		[35] = {critical_damage = 20, args = {67}, deps_cells = {11, 23, 25, 37}},
		[36] = {critical_damage = 20, args = {68}, deps_cells = {12, 24, 26, 38}},
		[37] = {critical_damage = 4, args = {55}},
		[38] = {critical_damage = 4, args = {56}},
		[43] = {critical_damage = 4, args = {61}, deps_cells = {53}},
		[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}},
	},  -- end of Damage
	
	DamageParts = 
	{  
		[1] = "B-29-OBLOMOK-WING-R",
		[2] = "B-29-OBLOMOK-WING-L",
	},


	lights_data = 
	{
		typename = "collection",
		lights = 
		{
			[1] = -- ストロボライト
			{
			},
			[2] = -- ランディングライト
			{
			},
		    [3]	= -- ナビゲーションライト
			{
		    	typename = "collection",
				lights =
				{
					-- Left Position Light (red)
					{typename = "omnilight",
					color = {0.32, 0.0, 0.07},
					position  = {3.74, 1.44, -21.45},
					argument  = 190
					},
					-- Right Position Light (green)
					{typename = "omnilight",
					color = {0, 0.26, 0.18},
					position = {3.74, 1.44, 21.45},
					argument  = 191
					},
					-- Tail Position Light (white)
					{typename = "omnilight",
					color = {0.8, 0.8, 0.8},
					position  = {-13.2, 0.33, 0.0},
					argument  = 203
					},
				}
			},
		    [4] = -- フォーメーションライト
			{
			},
			[5]	=
			{
			}
		}
	},  -- end of lights_data

}

add_aircraft(B_29)
