// FILENAME: DOE_Bacon_Run.cs
//
// AUTHORS:  =DOE= NightShade & /ST/ BrokenHope /LD/


$missionName = "DOE_Bacon_Run";

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


function setDefaultMissionOptions(){
	$server::TeamPlay = true;
	$server::AllowDeathmatch = false;
	$server::AllowTeamPlay = true;	
	
	$server::AllowTeamRed = true;
	$server::AllowTeamBlue = true;
	$server::AllowTeamYellow = false;
	$server::AllowTeamPurple = false;

	$server::disableTeamRed = false;
	$server::disableTeamBlue = false;
	$server::disableTeamYellow = true;
	$server::disableTeamPurple = true;
}

function onMissionStart(){
	marsSounds();
}


function player::onAdd(%this)
{
   player::onAddLog(%this);
      say(%this,0, "Welcome to Bacon Run! "@
      "Enjoy your stay! "@
      "Visit =DOE= at www.clhnexus.com");
}

function onMissionLoad()
{
   cdAudioCycle("Purge", "Mechsoul", "SS3"); 
}

//ZENPAD FUNCTIONS
//------------------------------------------------


$zenWaitTime = 0;

//TELPORTER FUNCTIONS
//------------------------------------------------

function ZenTransporter1::trigger::onContact(%this, %object)
{
	randomTransport(%object, -3820, -405, -3750, -50);
}

function ZenTransporter2::trigger::onContact(%this, %object)
{
	randomTransport(%object, 1310, -1115, 1025, -1000);
}

//If someone shoots LOKI's Bacon, his houses blow up revealing a nasty surprise
//------------------------------------------------
function tur1::turret::onAdd(%this)
{
	$turret1=%this;
	order($turret1,ShutDown,true);
}
function tur2::turret::onAdd(%this)
{
	$turret2=%this;
	order($turret2,ShutDown,true);
}
function tur3::turret::onAdd(%this)
{
	$turret3=%this;
	order($turret3,ShutDown,true);
}

function Bacon::structure::onAttacked(%attacked,%attacker)
{
	%bang1=getObjectId("MissionGroup\\extra\\house1");
	healObject(%bang1,-30000);
	order($turret1,ShutDown,false);
	order($turret1, Attack, %attacker);
	%bang2=getObjectId("MissionGroup\\extra\\house2");
	healObject(%bang2,-30000);
	order($turret2,ShutDown,false);
	order($turret2, Attack, %attacker);
	%bang3=getObjectId("MissionGroup\\extra\\house3");
	healObject(%bang3,-30000);
	order($turret3,ShutDown,false);
	order($turret3, Attack, %attacker);
	say(%this,0, "Hey! Don't Mess With My Bacon!");
}

