///////////////////////////////Default stuff, No changes here ///////////////////////////////////
#define true 1
#define false 0

#define VSoft 0
#define VArmor 1
#define VAir 2

#define private 0
#define protected 1
#define public 2

#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define ReadAndWrite 0
#define ReadAndCreate 1
#define ReadOnly 2
#define ReadOnlyVerified 3
/////////////////////////////// ^^ Default Stuff ^^ ///////////////////////////////

class CfgPatches
{
	class smurfc_m2a2_repl
	{
		units[] = {"smurfc_m2a2", "smurfc_m2a2_o", "smurfc_m2a2_b", "smurfc_m2a2_g", "smurfc_m2a2_stinger", "smurfc_m2a2_stinger_b", "smurfc_m2a2_stinger_g", "smurfc_m2a2_stinger_o"};		
		weapons[] = {"smurfc_bushmaster", "smurfc_m2a2_repl_smokelauncher", "smurfc_m2a2_stingerlauncher", "smurfc_TOWLauncher"};
		requiredVersion = 1.090000;
		requiredAddons[] = { "CATracked", "CAWeapons", "WarfareBuildings_Stinger_Twice_static", "smurfc_m2a2", "Extended_EventHandlers"};
	};
};

class Extended_Init_EventHandlers {
    class smurfc_m2a2 { smurfc_m2a2_init = "[_this select 0, -1] execVM ""\smurfc_m2a2_repl\assignNumber.sqf"";";};
};

class Extended_Fired_EventHandlers {
	class smurfc_m2a2 { smurfc_m2a2_fired = "[_this] execVM ""\smurfc_m2a2_repl\maingunrecoil.sqf"";"; };
};

class CfgVehicleClasses
{
	class PirSmurfC_ERA_110_Armor
	{
		displayName = "SmurfC";
	};
};

class CfgAmmo {
	class B_30mm_HE;
	class smurfc_B_25mm_HE: B_30mm_HE {hit=31; indirectHit=25; indirectHitRange=3.8; cost=400;
		tracerColor[] = {0.800000, 0.100000, 0.100000, 0.040000};
		tracerColorR[] = {0.800000, 0.100000, 0.100000, 0.040000};
		SIX_tracerColor = "R"; SIX_tracerEnable = 1;};
	class B_30mm_AP;
	class smurfc_B_25mm_AP: B_30mm_AP {hit=75; indirectHit=3; indirectHitRange=0.1; cost=600; irLock = 1;
		tracerColor[] = {0.800000, 0.100000, 0.100000, 0.040000};
		tracerColorR[] = {0.800000, 0.100000, 0.100000, 0.040000};
		SIX_tracerColor = "R"; SIX_tracerEnable = 1;};
	class smurfc_B_25mm_ADPU: B_30mm_AP {hit=105; indirectHit=4; indirectHitRange=0.4; cost=1000; irLock = 1;
		tracerColor[] = {0.800000, 0.100000, 0.100000, 0.040000};
		tracerColorR[] = {0.800000, 0.100000, 0.100000, 0.040000};
		SIX_tracerColor = "R"; SIX_tracerEnable = 1;};	
	class M_Stinger_AA;
	class smurfc_M_Stinger_AA: M_Stinger_AA {trackLead = 0.5;};
	class G_40mm_HE;
	class smurfc_m2a2_repl_Smoke_White: G_40mm_HE { model = "";	hit=0; indirectHit=0; indirectHitRange=0; explosive = 0; 
													visibleFire = 0; audibleFire = 0; visibleFireTime = 0;simulation="shotBullet";
													soundHit[] = {"", 1, 1}; soundFly[] = {"", 1, 1};
													tracerColor[]={0.00000,0.00000,0.00000,0.00000};
													tracerColorR[]={0.00000,0.00000,0.00000,0.00000};};
};

class CfgMagazines {
	class 230Rnd_30mmHE_2A42;
	class smurfc_210Rnd_25mmHE_M2A2: 230Rnd_30mmHE_2A42 {ammo = "smurfc_B_25mm_HE"; count=210;initSpeed = 1000;maxLeadSpeed=150;
	class Library {libTextDesc = "690 rounds of 25mm High Explosive Incendiary";};};
	class 230Rnd_30mmAP_2A42;
	class smurfc_210Rnd_25mmAP_M2A2: 230Rnd_30mmAP_2A42 {ammo = "smurfc_B_25mm_AP"; count=210;initSpeed = 1345;maxLeadSpeed=150;
	class Library {libTextDesc = "210 rounds of 25mm Armor Piercing";};};
	class smurfc_210Rnd_25mmADPU_M2A2: 230Rnd_30mmAP_2A42 {ammo = "smurfc_B_25mm_ADPU"; count=210;initSpeed = 1385;maxLeadSpeed=150;
	class Library {libTextDesc = "210 rounds of 25mm Armor-Piercing, Fin-Stabilized Discarding Sabot";};};
	/*extern*/ class 48Rnd_40mm_MK19;
	class smurfc_m2a2_repl_Smoke_White_nsv: 48Rnd_40mm_MK19   {ammo = "smurfc_m2a2_repl_Smoke_White"; count=1;initSpeed = 2;};
	class 6Rnd_TOW_TriPod;
	class smurfc_m2a2_stinger: 6Rnd_TOW_TriPod {ammo = "smurfc_M_Stinger_AA";count=4; maxLeadSpeed = 1000;picture = "\CA\weapons\data\equip\m_Stinger_ca.paa";sound[] = {"\ca\Weapons\Data\Sound\rocket1", 1.000000, 1};};
	class smurfc_m2a2_2RndTOW: 6Rnd_TOW_TriPod {count=2;};
};

class cfgWeapons {
	class CannonCore;
	class smurfc_bushmaster: CannonCore {
		scope = 1;
		autoFire = 1;
		magazines[] = {"smurfc_210Rnd_25mmHE_M2A2", "smurfc_210Rnd_25mmAP_M2A2", "smurfc_210Rnd_25mmADPU_M2A2", "230Rnd_30mmAP_2A42", "230Rnd_30mmHE_2A42", "250Rnd_30mmAP_2A42", "250Rnd_30mmHE_2A42"};		
		shotFromTurret = 1;
		canLock = 2;
		flash = "gunfire";
		flashSize = 0.100000;
		recoil = "Empty";
		maxLeadSpeed = 600;
		aiDispersionCoefX = 2;
		ffMagnitude = 0.500000;
		ffFrequency = 11;
		ffCount = 6;
		dispersion = 0.001000;
		//displayName="25mm Autocannon low ROF";
		displayName="25mm Autocannon";
		burst = 1;
		multiplier = 1;
		sound[] = {"\smurfc_m2a2_repl\25mm.ogg", 17.782795, 1};
		reloadTime=0.3;
		magazineReloadTime = 0;
		minRange = 10;
		minRangeProbab = 0.70000;
		midRange = 1800;
		midRangeProbab = 0.900000;
		maxRange = 4100;
		maxRangeProbab = 0.001000;
		//aiRateOfFire = 1.000000;
		//aiRateOfFireDistance = 1000;
		aiRateOfFire = 0.300000;
		aiRateOfFireDistance = 3000;
	};
//	class smurfc_bushmaster_hrof: smurfc_bushmaster {
//		displayName="25mm Autocannon high ROF";
//		burst = 1;
//		multiplier = 1;
//		sound[] = {"\smurfc_m2a2_repl\25mm.ogg", 17.782795, 1};	soundBurst = 0;
//		reloadTime = 0.0100000;
//		magazineReloadTime = 0;
//		minRange = 10;
//		minRangeProbab = 0.70000;
//		midRange = 500;
//		midRangeProbab = 0.900000;
//		maxRange = 1400;
//		maxRangeProbab = 0.000010;
//	};
	class MK19;
	class smurfc_m2a2_repl_smokelauncher: MK19 {		
		displayName = "Smokelauncher";
		magazines[] = {"smurfc_m2a2_repl_Smoke_White_nsv"};
		sound[] = {"\ca\Weapons\Data\Sound\Grenade_launch1_A", 0.100000, 1};
		reloadMagazineSound[] = {"\ca\Weapons\Data\Sound\flare_reload", 0.000316, 1};
		magazineReloadTime = 2;
	};
	class StingerLauncher_twice;
	class smurfc_m2a2_stingerlauncher: StingerLauncher_twice {
		magazineReloadTime = 30;
		magazines[] = {"smurfc_m2a2_stinger"};
	};
	class TOWLauncher;
	class smurfc_TOWLauncher: TOWLauncher {
		magazines[] = {"smurfc_m2a2_2RndTOW"};
	};
};

class Turrets;
class MainTurret;
class CommanderOptics;
class ViewPilot;

class CfgVehicles
{ 
	class Tank;
	class smurfc_m2a2 : Tank
	{
		soundEnviron[]={"\smurfc_m2a2_repl\m2treads.ogg",db17,0.8};
		soundEngine[]={"\smurfc_m2a2_repl\m2engine.ogg",db18,1};
		class Turrets: Turrets
		{
			class MainTurret: MainTurret
			{
				weapons[] = {smurfc_bushmaster, M240_veh, smurfc_TOWLauncher};
				magazines[] = {"smurfc_210Rnd_25mmAP_M2A2", "smurfc_210Rnd_25mmHE_M2A2", "smurfc_210Rnd_25mmHE_M2A2", 1200Rnd_762x51_M240, smurfc_m2a2_2RndTOW,smurfc_m2a2_2RndTOW,smurfc_m2a2_2RndTOW,smurfc_m2a2_2RndTOW};
				class Turrets  : Turrets {
					class CommanderOptics  : CommanderOptics {
						weapons[]={smurfc_m2a2_repl_smokelauncher};
						magazines[]={smurfc_m2a2_repl_Smoke_White_nsv,smurfc_m2a2_repl_Smoke_White_nsv,smurfc_m2a2_repl_Smoke_White_nsv,smurfc_m2a2_repl_Smoke_White_nsv,smurfc_m2a2_repl_Smoke_White_nsv};
					};
				};
			};
		};
		class AnimationSources {
			class smurfc_m2a2_MainGunReload {
	            source = "reload";
	            weapon = smurfc_bushmaster;
			};
			class smurfc_m2a2_damageTurret
			{
				animPeriod=0;
			};
			class smurfc_m2a2_damageGun
			{
				animPeriod=0;
			};
		};
	};
	class smurfc_m2a2_o : smurfc_m2a2
	{
		side=TWest;
		vehicleClass = "PirSmurfC_ERA_110_Armor";
		displayName = "M2 Bradley (OFP)";
		crew = SoldierWCrew;
		typicalCargo[]={SoldierWCrew,SoldierWCrew,SoldierWCrew};
	};
	class smurfc_m2a2_b : smurfc_m2a2
	{
		side=TWest;
		vehicleClass = "Armored";
		crew = SoldierWCrew;
		typicalCargo[]={SoldierWCrew,SoldierWCrew,SoldierWCrew};
		class Turrets: Turrets
		{
			class MainTurret: MainTurret
			{
				magazines[] = {"smurfc_210Rnd_25mmADPU_M2A2", "smurfc_210Rnd_25mmHE_M2A2", "smurfc_210Rnd_25mmHE_M2A2", 1200Rnd_762x51_M240, smurfc_m2a2_2RndTOW,smurfc_m2a2_2RndTOW,smurfc_m2a2_2RndTOW,smurfc_m2a2_2RndTOW};
			};
		};
	};
	class smurfc_m2a2_g : smurfc_m2a2
	{
		side=TGuerrila;
		vehicleClass = "Armored";
		displayName = "M2 Bradley (RACS)";
		crew = SoldierGCrew;
		typicalCargo[]={SoldierGCrew,SoldierGCrew,SoldierGCrew};
	};

	class smurfc_m2a2_stinger: smurfc_m2a2
	{
		class Turrets: Turrets
		{
			class MainTurret: MainTurret
			{
				weapons[] = {smurfc_m2a2_stingerlauncher, smurfc_bushmaster, M240_veh};
//				weapons[] = {smurfc_m2a2_stingerlauncher, M240_veh};
				magazines[] = {smurfc_m2a2_stinger, smurfc_m2a2_stinger, "smurfc_210Rnd_25mmHE_M2A2", "smurfc_210Rnd_25mmHE_M2A2", "smurfc_210Rnd_25mmAP_M2A2", 1200Rnd_762x51_M240};		
			};
		};
	};
	class smurfc_m2a2_stinger_o: smurfc_m2a2_stinger
	{
		side=TWest;
		vehicleClass = "PirSmurfC_ERA_110_Armor";
		displayName = "M6 Linebacker (OFP)";
		crew = SoldierWCrew;
		typicalCargo[]={SoldierWCrew,SoldierWCrew,SoldierWCrew};
	};
	class smurfc_m2a2_stinger_b: smurfc_m2a2_stinger
	{
		side=TWest;
		vehicleClass = "Armored";
		crew = SoldierWCrew;
		typicalCargo[]={SoldierWCrew,SoldierWCrew,SoldierWCrew};
	};
	class smurfc_m2a2_stinger_g: smurfc_m2a2_stinger
	{
		side=TGuerrila;
		vehicleClass = "Armored";
		displayName = "M6 Linebacker (RACS)";
		crew = SoldierGCrew;
		typicalCargo[]={SoldierGCrew,SoldierGCrew,SoldierGCrew};
	};
};