//==========================================//
//					    //
//	  Do not edit this file		    //
//					    //
//==========================================//


if (isnull player) exitwith {};

sleep 1;

//================================================================

if (ammo_b1_c == "he") then
{
	if (b1_he_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b1_c == "timed") then
		{
			ammo_cal_he_b1 = duration_b1 / rof_b1;
			sleep 1;
			if (b1_he_ammo_current < ammo_cal_he_b1) then
			{
				duration_b1 = ammo_cal_he_b1;
				publicvariable "duration_b1";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b1];
			};
		}
		else
		{
			if (b1_he_ammo_current < duration_b1) then
			{
				duration_b1 = b1_he_ammo_current;
				publicvariable "duration_b1";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b1_c, duration_b1];
			};
			if (b1_he_ammo_current <= duration_b1) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================

if (ammo_b1_c == "illum") then
{
	if (b1_illum_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b1_c == "timed") then
		{
			ammo_cal_illum_b1 = duration_b1 / rof_b1;
			sleep 1;
			if (b1_illum_ammo_current < ammo_cal_illum_b1) then
			{
				duration_b1 = ammo_cal_illum_b1;
				publicvariable "duration_b1";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b1];
			};
		}
		else
		{
			if (b1_illum_ammo_current < duration_b1) then
			{
				duration_b1 = b1_illum_ammo_current;
				publicvariable "duration_b1";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b1_c, duration_b1];
			};
			if (b1_illum_ammo_current <= duration_b1) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================

if (ammo_b1_c == "wp") then
{
	if (b1_wp_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b1_c == "timed") then
		{
			ammo_cal_wp_b1 = duration_b1 / rof_b1;
			sleep 1;
			if (b1_wp_ammo_current < ammo_cal_wp_b1) then
			{
				duration_b1 = ammo_cal_wp_b1;
				publicvariable "duration_b1";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b1];
			};
		}
		else
		{
			if (b1_wp_ammo_current < duration_b1) then
			{
				duration_b1 = b1_wp_ammo_current;
				publicvariable "duration_b1";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b1_c, duration_b1];
			};
			if (b1_wp_ammo_current <= duration_b1) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================

if (ammo_b1_c == "laser") then
{
	if (b1_laser_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b1_c == "timed") then
		{
			ammo_cal_laser_b1 = duration_b1 / rof_b1;
			sleep 1;
			if (b1_laser_ammo_current < ammo_cal_laser_b1) then
			{
				duration_b1 = ammo_cal_laser_b1;
				publicvariable "duration_b1";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b1];
			};
		}
		else
		{
			if (b1_laser_ammo_current < duration_b1) then
			{
				duration_b1 = b1_laser_ammo_current;
				publicvariable "duration_b1";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b1_c, duration_b1];
			};
			if (b1_laser_ammo_current <= duration_b1) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================

if (ammo_b1_c == "sadarm") then
{
	if (b1_sadarm_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b1_c == "timed") then
		{
			ammo_cal_sadarm_b1 = duration_b1 / rof_b1;
			sleep 1;
			if (b1_sadarm_ammo_current < ammo_cal_sadarm_b1) then
			{
				duration_b1 = ammo_cal_sadarm_b1;
				publicvariable "duration_b1";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b1];
			};
		}
		else
		{
			if (b1_sadarm_ammo_current < duration_b1) then
			{
				duration_b1 = b1_sadarm_ammo_current;
				publicvariable "duration_b1";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b1_c, duration_b1];
			};
			if (b1_sadarm_ammo_current <= duration_b1) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================

if (ammo_b1_c == "smoke") then
{
	if (b1_smoke_ammo_current < 1) then
	{
		out_of_ammo = true;
	}
	else
	{
		if (mission_b1_c == "timed") then
		{
			ammo_cal_smoke_b1 = duration_b1 / rof_b1;
			sleep 1;
			if (b1_smoke_ammo_current < ammo_cal_smoke_b1) then
			{
				duration_b1 = ammo_cal_smoke_b1;
				publicvariable "duration_b1";
				out_of_ammo2 = true;
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %1 Seconds", duration_b1];
			};
		}
		else
		{
			if (b1_smoke_ammo_current < duration_b1) then
			{
				duration_b1 = b1_smoke_ammo_current;
				publicvariable "duration_b1";
				sleep 0.5;
				headquarters sidechat format ["Not Enough Ammo, Fire Mission changed to %2 %1 rounds", ammo_b1_c, duration_b1];
			};
			if (b1_smoke_ammo_current <= duration_b1) then
			{
				out_of_ammo2 = true;
			};
		};
	};
};


//====================================================================