// FILENAME:	CTF_Luna_Sector.cs
//
// TERRAIN:       Luna_Sector.ted.vol
//
// CREATOR:  	Com. Sentinal [M.I.B.]
//------------------------------------------------------------------------------

$missionName = "CTF_Luna_Sector";

$maxFlagCount  = 8;          // no of flags required by a team to end the game
$flagValue     = 5;          // points your team gets for capturing
$carrierValue  = 2;          //  "      "    "    "    " killing carrier
$killPoints    = 1;
$deathPoints   = 1;
$flagTime = 300;

exec("multiplayerStdLib.cs");
exec("CTFstdLib.cs");

function setDefaultMissionOptions()
{
	$server::TeamPlay = true;
	$server::AllowDeathmatch = false;
	$server::AllowTeamPlay = true;	

   // what can the client choose for a team
	$server::AllowTeamRed = false;
	$server::AllowTeamBlue = true;
	$server::AllowTeamYellow = false;
	$server::AllowTeamPurple = true;

   // what can the server admin choose for available teams
   $server::disableTeamRed = true;
   $server::disableTeamBlue = false;
   $server::disableTeamYellow = true;
   $server::disableTeamPurple = false;
}

function onMissionStart()
{
   initGlobalVars();
   moonSounds();

   $door1 = getObjectId("Missiongroup\\door1");
   $door2 = getObjectId("Missiongroup\\door2");
   $door3 = getObjectId("Missiongroup\\door3");
   $door4 = getObjectId("Missiongroup\\door4");
   $HercsAtDoor1 = 0;
   $HercsAtDoor2 = 0;   
   $HercsAtDoor3 = 0;
   $HercsAtDoor4 = 0;
}

function onMissionLoad()
{
   cdAudioCycle("NewTech", "Terror", "Yougot", "Mechsoul"); 
}

function player::onAdd(%player)
{
   say(%player, 0, "Welcome to CTF Luna Sector! You can download CTF_Luna_Sector & other terrain-based missions made by Com. Sentinal [M.I.B.] in the \"MIB Terrain Pack\" on the MIB Website at www.starsiegemeninblack.cjb.net.");
   messageBox(%player, "This map requires that you download a new terrain to play. It is available for download in the \"MIB Terrain Pack\" on the MIB website at www.starsiegemeninblack.cjb.net");
}

function door1::trigger::onEnter(%trigger, %vehicleId)
{
   if($hercsAtDoor1 == 0)
   {
      playAnimSequence($door1, 0, true);
   }
   $hercsAtDoor1++;
}

function door1::trigger::onLeave(%trigger, %vehicleId)
{
   $hercsAtDoor1--;
   if($hercsAtDoor1 == 0)
   {
      playAnimSequence($door1, 0, false);
   }
}

function door2::trigger::onEnter(%trigger, %vehicleId)
{
   if($hercsAtDoor2 == 0)
   {
      playAnimSequence($door2, 0, true);
   }
   $hercsAtDoor2++;
}

function door2::trigger::onLeave(%trigger, %vehicleId)
{
   $hercsAtDoor2--;
   if($hercsAtDoor2 == 0)
   {
      playAnimSequence($door2, 0, false);
   }
}

function door3::trigger::onEnter(%trigger, %vehicleId)
{
   if($hercsAtDoor3 == 0)
   {
      playAnimSequence($door3, 0, true);
   }
   $hercsAtDoor3++;
}

function door3::trigger::onLeave(%trigger, %vehicleId)
{
   $hercsAtDoor3--;
   if($hercsAtDoor3 == 0)
   {
      playAnimSequence($door3, 0, false);
   }
}

function door4::trigger::onEnter(%trigger, %vehicleId)
{
   if($hercsAtDoor4 == 0)
   {
      playAnimSequence($door4, 0, true);
   }
   $hercsAtDoor4++;
}

function door4::trigger::onLeave(%trigger, %vehicleId)
{
   $hercsAtDoor4--;
   if($hercsAtDoor4 == 0)
   {
      playAnimSequence($door4, 0, false);
   }
}


