Aircraft Lua - Editing

This Lua of the A4e features pretty much all the features inside a single lua. Hence it will be much more "complicated" or complex overall.

### **2. Basic LUA(example by Pande4360) - Breakdown:**

This is a more simple Lua, with a very basic structure with only the most neccessary stuff.

```
-- Lua starts off with creating Gunpods for the aircraft. Missiles and bombs are
--handled in a seperate lua see "\_weapons.lua"
--Part 1: Ammonuition
local LASREBY = {
	category = CAT\_SHELLS,              --type
	user\_name = \_("LASREBY"),
	model\_name    = "RedLaser",         --edm for the projectile
	v0    = 7000.0,                     --speed
	Dv0   = 0.00108,                    --speed variation
	Da0     = 0.0001,                   --spread variation
	Da1     = 0.0,
	mass      = 1,                      --factors into overall mass of aircraft too,
	                                    -- the more mass the more dmg also
	explosive     = 0.5,
	life\_time     = 4,
	caliber     = 120.0,
	s         = 0.0,
	j         = 0.0,
	l         = 0.0,
	charTime    = 0,
	cx        = {1.0,0.78,0.60,0.15,1.80},  --drag
	k1        = 9.4e-09,
	tracer\_off    = 10,
	scale\_tracer  = 100,

	name = "LASREBY",

	cartridge = 0,                          --cartridge or not?
	};
declare\_weapon(LASREBY);

local LASREBYL = {
	category = CAT\_SHELLS,
	user\_name = \_("LASREBYL"),
	model\_name    = "RedLaser",
	v0    = 7000.0,
	Dv0   = 0.00108,
	Da0     = 0.0001,
	Da1     = 0.0,
	mass      = 4,
	explosive     = 0.5,
	life\_time     = 4,
	caliber     = 240.0,
	s         = 0.0,
	j         = 0.0,
	l         = 0.0,
	charTime    = 0,
	cx        = {1.0,0.78,0.60,0.15,1.80},
	k1        = 9.4e-09,
	tracer\_off    = 10,
	scale\_tracer  = 250,

	name = "LASREBYL",

	cartridge = 0,
	};
declare\_weapon(LASREBYL);
--Part2: the actual gunpod
local function LASERREBY(tbl)               --creating a gunpod table

    tbl.category = CAT\_GUN\_MOUNT            --type
    tbl.name      = "LASERREBY"
    tbl.supply      =
    {
        shells = {"LASREBY"},               --shell name being used
        --mixes = {{1,2,1,2,1,3}}, -- 50% HE-i, 25% AP-I, 25% AP-T
        count  = 600,
    }
    if tbl.mixes then
       tbl.supply.mixes = tbl.mixes
       tbl.mixes        = nil
    end
    tbl.gun =
    {
        max\_burst\_length    = 100000,   --max rounds per burst
        rates               = {150},    --will be overwritten further down this file
        recoil\_coeff        = 0.1\*0.1,
        barrels\_count       = 1,
    }
    if tbl.rates then
       tbl.gun.rates        =  tbl.rates
       tbl.rates            = nil
    end
    tbl.ejector\_pos             = tbl.ejector\_pos or {0, 0, 0}
    tbl.ejector\_pos\_connector   = tbl.ejector\_pos\_connector     or  "Gun\_point"
    tbl.ejector\_dir             = {-1, -6, 0} -- left/right; back/front;?/?
    tbl.supply\_position         = tbl.supply\_position   or {0,  0.3, -0.3}
    tbl.aft\_gun\_mount           = false
    tbl.effective\_fire\_distance = 2000
    tbl.drop\_cartridge          = 204
    tbl.muzzle\_pos              = tbl.muzzle\_pos            or  {0,0,0}     -- all position from connector
    tbl.muzzle\_pos\_connector    = tbl.muzzle\_pos\_connector  or  "Gun\_point" -- all position from connector
    tbl.azimuth\_initial         = tbl.azimuth\_initial       or  0
    tbl.elevation\_initial       = tbl.elevation\_initial     or  0
    if  tbl.effects == nil then
        tbl.effects = {{ name = "FireEffect"     , arg = tbl.effect\_arg\_number or 436 },
                       { name = "HeatEffectExt"  , shot\_heat = 7.823, barrel\_k = 0.462 \* 2.7, body\_k = 0.462 \* 14.3 },
                       { name = "SmokeEffect"}}
    end
    return declare\_weapon(tbl)
end

local function LASERREBYL(tbl)

    tbl.category = CAT\_GUN\_MOUNT
    tbl.name      = "LASERREBYL"
    tbl.supply      =
    {
        shells = {"LASREBYL"},

        count  = 150,
    }
    if tbl.mixes then
       tbl.supply.mixes = tbl.mixes
       tbl.mixes        = nil
    end
    tbl.gun =
    {
        max\_burst\_length    = 100000,
        rates               = {10},
        recoil\_coeff        = 0.1\*0.1,
        barrels\_count       = 1,
    }
    if tbl.rates then
       tbl.gun.rates        =  tbl.rates
       tbl.rates            = nil
    end
    tbl.ejector\_pos             = tbl.ejector\_pos or {0, 0, 0}
    tbl.ejector\_pos\_connector   = tbl.ejector\_pos\_connector     or  "Gun\_point"
    tbl.ejector\_dir             = {-1, -6, 0} -- left/right; back/front;?/?
    tbl.supply\_position         = tbl.supply\_position   or {0,  0.3, -0.3}
    tbl.aft\_gun\_mount           = false
    tbl.effective\_fire\_distance = 2000
    tbl.drop\_cartridge          = 204
    tbl.muzzle\_pos              = tbl.muzzle\_pos            or  {0,0,0}
    tbl.muzzle\_pos\_connector    = tbl.muzzle\_pos\_connector  or  "Gun\_point"
    tbl.azimuth\_initial         = tbl.azimuth\_initial       or  0
    tbl.elevation\_initial       = tbl.elevation\_initial     or  0
    if  tbl.effects == nil then
        tbl.effects = {{ name = "FireEffect"     , arg = tbl.effect\_arg\_number or 436 },
                       { name = "HeatEffectExt"  , shot\_heat = 7.823, barrel\_k = 0.462 \* 2.7, body\_k = 0.462 \* 14.3 },
                       { name = "SmokeEffect"}}
    end
    return declare\_weapon(tbl)
end
--the gunpod will be later called further down this code to apply it to the aircraft

YWING =  {
      --Basic information
		Name 			= 'YWING',--AG
		DisplayName		= \_('SW - Y-WING'),--AG
        Picture 		= "VSN\_UFO.png",
        Rate 			= "50",
        Shape			= "YWING",
        WorldID			=  YWING,

	shape\_table\_data 	=
	{
		{
			file  	 	= 'YWING';--AG --edm file name
			life  	 	= 5; -- lifebar
			vis   	 	= 3; -- visibility gain.
			desrt    	= 'YWING\_destr'; -- Name of destroyed object edm name
			fire  	 	= { 300, 2}; -- Fire on the ground after destoyed: 300sec 2m
			username	= 'YWING';
			index       =  WSTYPE\_PLACEHOLDER;
			-- classname = "lLandPlane";
			-- positioning = "BYNORMAL";
		},
		{
			name  		= "YWING\_destr";
			file  		= "YWING\_destr"; --edm name
			fire  		= { 240, 2};
		},

	},

	LandRWCategories = --types of allowed landing on carriers
        {
        [1] =
        {
			Name = "AircraftCarrier",
        },
        [2] =
        {
            Name = "AircraftCarrier With Catapult",
        },
        [3] =
        {
            Name = "AircraftCarrier With Tramplin",
        },
    }, -- end of LandRWCategories
        TakeOffRWCategories =
        {
        [1] =
        {
			Name = "AircraftCarrier",
        },
        [2] =
        {
            Name = "AircraftCarrier With Catapult",
        },
        [3] =
        {
            Name = "AircraftCarrier With Tramplin",
        },
    }, -- end of TakeOffRWCategories

	mapclasskey 		= "P0091000025",
	--check for "WS type List" :
	attribute  			= {wsType\_Air, wsType\_Airplane, wsType\_Fighter, WSTYPE\_PLACEHOLDER, "Fighters", "Refuelable",},--

	Categories= {"{78EFB7A2-FD52-4b57-A6A6-3BF0E1D6555F}", "Interceptor",},
	-- Basic stats
	--Weight
		M\_empty						=	2000,--13380,
		M\_nominal					=	6000,--19000,
		M\_max						=	30000,--30845,
		M\_fuel\_max					=	10000,--6103,
	--
		H\_max						=	50000,--18300,--height
		average\_fuel\_consumption	=	0.001,--0.271,
		CAS\_min						=	150, --min speed that is shwon in hud
		V\_opt						=	220, --cruisespeed
		V\_take\_off					=	61,  --takeoff speed
		V\_land						=	71,  --landing speed
		has\_afteburner				=	true,
		has\_speedbrake				=	true,
		radar\_can\_see\_ground		=	true,

		AOA\_take\_off				=	0.16,	-- AoA in take off (for AI)
		stores\_number				=	12,
		bank\_angle\_max				=	60,		-- Max bank angle (for AI)
		Ny\_min						=	-3,		-- Min G (for AI)
		Ny\_max						=	8,		-- Max G (for AI)
		V\_max\_sea\_level				=	403,	-- Max speed at sea level in m/s (for AI)
		V\_max\_h						=	736.11,	-- Max speed at max altitude in m/s (for AI)
		wing\_area					=	130.5,	-- wing area in m2, important for FM
		thrust\_sum\_max				=	13347,	-- thrust in kgf (64.3 kN)
		thrust\_sum\_ab				=	21952,	-- thrust in kgf (95.1 kN)
		Vy\_max						=	275,	-- Max climb speed in m/s (for AI)
		flaps\_maneuver				=	1,
		Mach\_max					=	2.5,	-- Max speed in Mach (for AI)
		range						=	2540,	-- Max range in km (for AI)
		RCS							=	0.05,		-- Radar Cross Section m2
		Ny\_max\_e					=	8,		-- Max G (for AI)
		detection\_range\_max			=	250,
		IR\_emission\_coeff			=	0.91,	-- Normal engine -- IR\_emission\_coeff = 1 is Su-27 without afterburner. It is reference.
		IR\_emission\_coeff\_ab		=	4,		-- With afterburner
		tand\_gear\_max				=	3.73,--XX 1.732 FA18 3.73,
		tanker\_type					=	0,-- F14=2/S33=4/M29=0/S27=0/F15=1/F16=1/To=0/F18=2/A10A=1/M29K=4/M2000=2/F4=0/F5=0/
		wing\_span					=	10,
		wing\_type 					= 	0,-- FIXED\_WING = 0/VARIABLE\_GEOMETRY = 1/FOLDED\_WING = 2/ARIABLE\_GEOMETRY\_FOLDED = 3
		length						=	19.43,
		height						=	5.63,
		crew\_size					=	1,
		engines\_count				=	2,
		wing\_tip\_pos 				= 	{-3,	0,	4.4},

	----------------- SUSPENSION CODE BEGINS

   tand\_gear\_max								=	3.73,
	nose\_gear\_pos								= 	{4.14,	-3.25,	0},
	nose\_gear\_amortizer\_direct\_stroke			= 	0.3,			-- down from nose\_gear\_pos !!!
	nose\_gear\_amortizer\_reversal\_stroke			= 	-0.2,			-- up
	nose\_gear\_amortizer\_normal\_weight\_stroke	= 	-0.4,	-- down from nose\_gear\_pos
	nose\_gear\_wheel\_diameter					=	0.90,
	nose\_gear\_door\_close\_after\_retract			=	false,

	main\_gear\_pos								= 	{-0.97,	-3.25,	3.9},
	main\_gear\_amortizer\_direct\_stroke			=	0.3,			-- down from main\_gear\_pos !!!
	main\_gear\_amortizer\_reversal\_stroke			= 	-0.3,			-- up
	main\_gear\_amortizer\_normal\_weight\_stroke	= 	-0.50,	-- down from main\_gear\_pos
	main\_gear\_wheel\_diameter					=	0.80,
	main\_gear\_door\_close\_after\_retract			=	false,

	----------------- SUSPENSION CODE ENDS

		--SOUNDERS Start
		sounderName= "aircraft/Planes/YWING",
		--Sounders End
		--Engine visuals
		engines\_nozzles =
		{
			[1] =
			{           --forw.&backw,height,left&right
				pos = 	{-5.6,	-0.24,	3.551},
				elevation	=	0, --vertical rotation in degree
				azimuth= 0,     -- horizontal rotation in degree
				diameter	=	0.45,
				exhaust\_length\_ab	=	8,
				exhaust\_length\_ab\_K	=	0.6,
				smokiness\_level     = 	0.1,
			}, -- end of [1]
			[2] =
			{
				pos = 	{-5.6,	-0.24,	-3.551},
				elevation	=	0,
				diameter	=	0.45,
				exhaust\_length\_ab	=	8,
				exhaust\_length\_ab\_K	=	0.6,
				smokiness\_level     = 	0.1,
			}, -- end of [1]
		}, -- end of engines\_nozzles
		crew\_members =
		{
			[1] =
			{
				ejection\_seat\_name	=	17,

				pos = 	{15.0,	1.4,	0},
			}, -- end of [1]
		}, -- end of crew\_members
		brakeshute\_name	=	0,
		is\_tanker	=	false,
		air\_refuel\_receptacle\_pos = 	{6.731,	0.825,	0.492},
		fires\_pos =
		{
			[1] = 	{-0.707,	0.553,	-0.213},
			[2] = 	{-0.037,	0.285,	1.391},
			[3] = 	{-0.037,	0.285,	-1.391},
			[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] = 	{-5.003,	0.261,	0},
			[9] = 	{-5.003,	0.261,	0},
			[10] = 	{-0.707,	0.453,	1.036},
			[11] = 	{-0.707,	0.453,	-1.036},
		}, -- end of fires\_pos
		chaff\_flare\_dispenser =
		{
			[1] =
			{
				dir = 	{1,  0, 1.5},
				pos = 	{-6, 0,	0},
			}, -- end of [1]
			[2] =
			{
				dir = 	{1,  0, -1.5},
				pos = 	{-6, 0,	0},
			}, -- end of [2]
		}, -- end of chaff\_flare\_dispenser

        -- Countermeasures
passivCounterm 		= {
CMDS\_Edit 			= true,
SingleChargeTotal 	= 10000,
chaff 				= {default = 5000, increment = 5000, chargeSz = 1},
flare 				= {default = 5000, increment = 5000, chargeSz = 1}
 },

        CanopyGeometry 	= {
            azimuth 	= {-145.0, 145.0},-- pilot view horizontal (AI)
            elevation 	= {-50.0, 90.0}-- pilot view vertical (AI)
        },

Sensors = {
RADAR 			= "AN/APG-63",--F15
 IRST = "OLS-27",
        OPTIC = "Shkval",--necessite un profil 25T.
        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 		= 127.5,  -- Radio Freq
		editable 		= true,
		minFrequency	= 100.000,
		maxFrequency 	= 156.000,
		modulation 		= MODULATION\_AM
	},

		--GUNpods, refer to the declarations at the beginning
		--each entry will create one gunpod
		    Guns = {
            LASERREBY({muzzle\_pos\_connector = "L1", --name of gunpod(see top),connector being used(in edm files)
                count = {5000},                     --number of rounds
				rates = {600},                      --firerate
                --mixes = {{2,1,1,1,1,1}},
                effect\_arg\_number = 434,
                supply\_position = {0, 0, 0},
                ejector\_pos\_connector = "GUN\_EJECT\_1",
                }),

            LASERREBY({muzzle\_pos\_connector = "L2",
			   count = {5000},
			   rates = {600},
                --mixes = {{2,1,1,1,1,1}},
                effect\_arg\_number = 434,
                supply\_position = {0, 0, 0},
                ejector\_pos\_connector = "GUN\_EJECT\_2",
                }),

				LASERREBYL({muzzle\_pos\_connector = "L3",
			   count = {5000},
			   rates = {600},
                --mixes = {{2,1,1,1,1,1}},
                effect\_arg\_number = 434,
                supply\_position = {0, 0, 0},
                ejector\_pos\_connector = "GUN\_EJECT\_2",
                }),

				LASERREBYL({muzzle\_pos\_connector = "L4",
			   count = {5000},
			   rates = {600},
                --mixes = {{2,1,1,1,1,1}},
                effect\_arg\_number = 434,
                supply\_position = {0, 0, 0},
                ejector\_pos\_connector = "GUN\_EJECT\_2",
                }),
		    },

	--Pylon code: add your desired weapons, more details below the code
Pylons = {

              --number of pylon, type,Bck/Frwrd,Up/Down,-Left/Right
              --Types: 0=direct,1=delayed, 2=invisible
		pylon(1, 2, -2.777,-1.2, -1.002, --1, 0, -1.943000, 0.173000, -7.280000,
            {
			-- arg = 308 ,arg\_value = 0,
			-- use\_full\_connector\_position=true, --if you have connectors in the edm
            },
            {
                --you can call any weapon defined in other luas, refer to weapon "clsid list" on this wiki
                { CLSID = "{PROTONB}",connector = shrikeConnector },
				--{ CLSID = "{PROTONMissile}" },

            }
        ),
         --Bck/Frwrd Up/Down -Left/Right
		pylon(2, 2, -2.777,-1.2, 1.002, --1, 0, -1.943000, 0.173000, -7.280000,
            {
			-- arg = 308 ,arg\_value = 0,
			-- use\_full\_connector\_position=true,
            },
            {
                { CLSID = "{PROTONB}",connector = shrikeConnector },
					--{ CLSID = "{PROTONMissile}" },
            }
        ),

			  --Bck/Frwrd Up/Down -Left/Right
		pylon(3, 2, -2.777,-1.2, -1.002, --1, 0, -1.943000, 0.173000, -7.280000,
            {
			-- arg = 308 ,arg\_value = 0,
			-- use\_full\_connector\_position=true,
            },
            {
                { CLSID = "{PROTONB}",connector = shrikeConnector },

            }
        ),
         --Bck/Frwrd Up/Down -Left/Right
		pylon(4, 2, -2.777,-1.2, 1.002, --1, 0, -1.943000, 0.173000, -7.280000,
            {
			-- arg = 308 ,arg\_value = 0,
			-- use\_full\_connector\_position=true,
            },
            {
                { CLSID = "{PROTONB}",connector = shrikeConnector },

            }
        ),
		pylon(5, 2, -2.777,-1.2, -1.002, --1, 0, -1.943000, 0.173000, -7.280000,
            {
			-- arg = 308 ,arg\_value = 0,
			-- use\_full\_connector\_position=true,
            },
            {
                { CLSID = "{PROTONB}",connector = shrikeConnector },

            }
        ),
         --Bck/Frwrd Up/Down -Left/Right
		pylon(6, 2, -2.777,-1.2, 1.002, --1, 0, -1.943000, 0.173000, -7.280000,
            {
			-- arg = 308 ,arg\_value = 0,
			-- use\_full\_connector\_position=true,
            },
            {
                { CLSID = "{PROTONB}",connector = shrikeConnector },

            }
        ),
			 pylon(7, 2, -0.777,-1.2, -0.002, --1, 0, -1.943000, 0.173000, -7.280000,
            {
			-- arg = 308 ,arg\_value = 0,
			-- use\_full\_connector\_position=true,
            },
            {
                { CLSID = "{TIRFUEL}" },

            }
        ),
         --Bck/Frwrd Up/Down -Left/Right
		pylon(8, 2, -0.777,-1.2, -0.002, --1, 0, -1.943000, 0.173000, -7.280000,
            {
			-- arg = 308 ,arg\_value = 0,
			-- use\_full\_connector\_position=true,
            },
            {
                { CLSID = "{TIRFUEL}" },
            }
        ),
},

	Tasks = {
         aircraft\_task(CAP),
     	 aircraft\_task(Escort),
      	 aircraft\_task(FighterSweep),
		 aircraft\_task(Intercept),
		aircraft\_task(Reconnaissance),
 	aircraft\_task(GroundAttack),
    	aircraft\_task(CAS),
     aircraft\_task(AFAC),
	    aircraft\_task(RunwayAttack),
 	aircraft\_task(AntishipStrike),
    },
	DefaultTask = aircraft\_task(CAS),

	-- 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
			-- B2 - Polar 2nd power 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)

	SFM\_Data = {
	aerodynamics = --F15
		{
			Cy0	=	0,
			Mzalfa	=	6,
			Mzalfadt	=	1,
			kjx = 2.95,
			kjz = 0.00125,
			Czbe = -0.016,
			cx\_gear = 0.0268,
			cx\_flap = 0.06,
			cy\_flap = 0.4,
			cx\_brk = 0.06,
			table\_data =
				{
			-- M Cx0 Cya B B4 Omxmax Aldop Cymax
				{0.0,	0.0215,		0.055,		0.08,		1.0,	0.65,	25.0,	1.2 	},
				{0.2,	0.0215,		0.055,		0.08,		1.0,	1.80,	25.0,	1.2     },
				{0.4,	0.0215,		0.055,		0.08,	   	1.0,	3.00,	25.0,	1.2     },
				{0.6,	0.0215,		0.055,		0.05,		1.0,	4.20,	25.0,	1.2     },
				{0.7,	0.0215,		0.055,		0.05,		1.0,	4.20,	23.0,	1.15    },
				{0.8,	0.0215,		0.055,		0.05,		0.28,	4.20,	21.7,	1.1     },
				{0.9,	0.0230,		0.058,		0.09,		0.20,	4.20,	20.1,	1.07    },
				{1.0,	0.0320,		0.062,		0.17,		0.15,	4.20,	18.9,	1.04    },
				{1.1,	0.0430,		0.062,	   	0.235,		0.09,	3.78,	17.4,	1.02    },
				{1.2,	0.0460,		0.062,	   	0.285,		0.08,	2.94,	17.0,	1.00 	},
				{1.3,	0.0470,		0.06,	   	0.29,		0.10,	2.10,	16.0,	0.92 	},
				{1.4,	0.0470,		0.056,	   	0.3,		0.136,	1.80,	15.0,	0.80 	},
				{1.6,	0.0470,		0.052,	   	0.34,		0.21,	1.08,	13.0,	0.7 	},
				{1.8,	0.0460,		0.042,	   	0.34,		2.43,	0.96,	12.0,	0.55 	},
				{2.2,	0.0420,		0.037,	   	0.49,		3.5,	0.84,	 10.0,	0.37 	},
				{2.5,	0.0420,		0.033,		0.6,		4.7,	0.84,	 9.0,	0.3 	},
				{3.9,	0.0400,		0.023,		0.9,		6.0,	0.84,	 7.0,	0.2		},
			}, -- end of table\_data
		}, -- end of aerodynamics
		engine =
		{
			Nmg	=	55,
			MinRUD	=	0,
			MaxRUD	=	1,
			MaksRUD	=	0.85,
			ForsRUD	=	0.91,
			type	=	"TurboJet",
			hMaxEng	=	60.5,
			dcx\_eng	=	0.0114,
			cemax	=	1.24,
			cefor	=	2.56,
			dpdh\_m	=	1000,
			dpdh\_f	=	4000.0,
			table\_data = {
			-- M Pmax Pfor
				{0.0,	115000,		212000},
				{0.2,	 94000,		200000},
				{0.4,	 92000,		205000},
				{0.6,	103000,		207000},
				{0.7,	105000,		210000},
				{0.8,	105000,		220000},
				{0.9,	105000,		235000},
				{1.0,	70000,		80000},
				{1.1,	70000,		88000},
				{1.2,	 84000,		88000},
				{1.3,	 84000,		85000},
				{1.4,	 71000,		80000},
				{1.6,	 34000,		88000},
				{1.8,	 19000,		87000},
				{2.2,	 17000,		80000},
				{2.5,	 19000,		80000},
				{3.9,	 82000,		80000},
			}, -- end of table\_data
		}, -- end of engine
	},

	--damage , index meaning see in Scripts\Aircrafts\\_Common\Damage.lua
	--the higher the number the more damage it can tank though exact functionality is a bit complicated and not always clear
	Damage = {
	[0]  = {critical\_damage = 5,  args = {146}},
	[1]  = {critical\_damage = 3,  args = {296}},
	[2]  = {critical\_damage = 3,  args = {297}},
	[3]  = {critical\_damage = 8, args = {65}},
	[4]  = {critical\_damage = 2,  args = {298}},
	[5]  = {critical\_damage = 2,  args = {301}},
	[7]  = {critical\_damage = 2,  args = {249}},
	[8]  = {critical\_damage = 3,  args = {265}},
	[9]  = {critical\_damage = 3,  args = {154}},
	[10] = {critical\_damage = 100,  args = {153}},
	[11] = {critical\_damage = 1,  args = {167}},
	[12] = {critical\_damage = 1,  args = {161}},
	[13] = {critical\_damage = 2,  args = {169}},
	[14] = {critical\_damage = 2,  args = {163}},
	[15] = {critical\_damage = 0,  args = {267}},
	[16] = {critical\_damage = 0,  args = {266}},
	[17] = {critical\_damage = 2,  args = {168}},
	[18] = {critical\_damage = 2,  args = {162}},
	[20] = {critical\_damage = 2,  args = {183}},
	[23] = {critical\_damage = 5, args = {223}},
	[24] = {critical\_damage = 5, args = {213}},
	[25] = {critical\_damage = 2,  args = {226}},
	[26] = {critical\_damage = 2,  args = {216}},
	[29] = {critical\_damage = 5, args = {224}, deps\_cells = {23, 25}},
	[30] = {critical\_damage = 5, args = {214}, deps\_cells = {24, 26}},
	[35] = {critical\_damage = 30, args = {67}, deps\_cells = {23, 29, 25, 37}},
	[36] = {critical\_damage = 30, args = {68}, deps\_cells = {24, 30, 26, 38}},
	[37] = {critical\_damage = 2,  args = {228}},
	[38] = {critical\_damage = 2,  args = {218}},
	[39] = {critical\_damage = 2,  args = {244}, deps\_cells = {53}},
	[40] = {critical\_damage = 2,  args = {241}, deps\_cells = {54}},
	[43] = {critical\_damage = 2,  args = {243}, deps\_cells = {39, 53}},
	[44] = {critical\_damage = 2,  args = {242}, deps\_cells = {40, 54}},
	[51] = {critical\_damage = 2,  args = {240}},
	[52] = {critical\_damage = 2,  args = {238}},
	[53] = {critical\_damage = 2,  args = {248}},
	[54] = {critical\_damage = 2,  args = {247}},
	[56] = {critical\_damage = 2,  args = {158}},
	[57] = {critical\_damage = 2,  args = {157}},
	[59] = {critical\_damage = 3,  args = {148}},
	[61] = {critical\_damage = 2,  args = {147}},
	[82] = {critical\_damage = 2,  args = {152}},
	},

		DamageParts =
	{
		[1] = "YWING\_oblomok\_wing\_R", -- wing R
		[2] = "YWING\_oblomok\_wing\_L", -- wing L

	},

-- VSN DCS World\Scripts\Aircrafts\\_Common\Lights.lua

	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 = 195, period = 1.2, color = {0.8,0,0}, connector = "WHITE\_BEACON L"},--195
						--{typename = "natostrobelight", argument\_1 = 196, period = 1.2, color = {0.8,0,0}, connector = "WHITE\_BEACON R"},--196
						--{typename = "natostrobelight", argument\_1 = 192, period = 1.2, color = {0.8,0,0}, connector = "BANO\_0\_BACK"},
						{typename  = "natostrobelight",	argument\_1  = 195, period = 1.2, color = {0.8,0,0}, connector = "RED\_BEACON L"},
						{typename  = "natostrobelight",	argument\_1  = 196, period = 1.2, color = {0.8,0,0}, connector = "RED\_BEACON R"},
							}
			},
	[2] = { typename = "collection",
					lights = {-- 1=Landing light -- 2=Landing/Taxi light
						{typename = "spotlight", connector = "MAIN\_SPOT\_PTR", argument = 209, dir\_correction = {elevation = math.rad(-1)}},--"MAIN\_SPOT\_PTR\_02","RESERV\_SPOT\_PTR"
						{typename = "spotlight", connector = "MAIN\_SPOT\_PTR", argument = 208, dir\_correction = {elevation = math.rad(3)}},--"MAIN\_SPOT\_PTR\_01","RESERV\_SPOT\_PTR","MAIN\_SPOT\_PTL",
							}
			},
	[3]	= {	typename = "collection",
					lights = {
							-- Left Position Light (red)
						{typename = "omnilight",connector = "BANO\_1",color = {0.99, 0.11, 0.3},pos\_correction  = {0.1, 0, -0.2},argument  = 190},
							-- Right Position Light (green)
						{typename = "omnilight",connector = "BANO\_2",color = {0, 0.894, 0.6},pos\_correction = {0.1, 0, 0.2},argument  = 191},
							-- Tail Position Light (white)
						{typename = "omnilight",connector = "BANO\_0",color = {1, 1, 1},pos\_correction  = {0, 0, 0},argument  = 192}}
			},
	[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
							}
			},
--[[
 [5] = { typename = "collection", -- strobe\_lights\_default
 lights = {
 {typename = "strobelight",connector = "RED\_BEACON" ,argument = 193, color = {0.8,0,0}},-- Arg 193, 83,
 {typename = "strobelight",connector = "RED\_BEACON\_2",argument = 194, color = {0.8,0,0}},-- (-1"RESERV\_RED\_BEACON")
 {typename = "strobelight",connector = "RED\_BEACON" ,argument = 83, color = {0.8,0,0}},-- Arg 193, 83,
 }
 },
--]]
	}},
}

add\_aircraft(YWING) --AG

```

### Lines 1-145:

1. Gun Decleration: Weapon system which is later used as onboard guns. Consists of 2 parts the shell declaration and the gunpod decleration which calls the shell. In this case 2 guns and 2 shells are being created, e.g. the shell "lasreby" is used by the gunpod "laserreby"