//==========================================================================================
//
//	et_slide.gm
//
//	Who  	  	When			What
//------------------------------------------------------------------------------------------
//	^4Tardis	14 October 2010		Initial Script
//
//==========================================================================================
//

global Map =
{
	Allied_Slide_Dyno = 0,
	Axis_Slide_Dyno = 0,
	Talk = true, //set Talk to false if you don't want the bots to cheer after winning game:

	Allied_Slide_Planted = function()
	{
		Map.Allied_Slide_Dyno += 1;
		Util.MapDebugPrint( "Allied_Slide_Planted" );
	},

	Axis_Slide_Planted = function()
	{
		Map.Axis_Slide_Dyno += 1;
		Util.MapDebugPrint( "Axis_Slide_Planted" );
	},

	Allied_Slide_Defused = function()
	{
		Map.Allied_Slide_Dyno -= 1;
		Util.MapDebugPrint( "Allied_Slide_Defused" );
	},

	Axis_Slide_Defused = function()
	{
		Map.Axis_Slide_Dyno -= 1;
		Util.MapDebugPrint( "Axis_Slide_Defused" );
	},

	Allied_Slide_Destroyed = function()
	{
		Map.Allied_Slide_Dyno = 0;

		ETUtil.WinningChat( TEAM.AXIS );
		ETUtil.LosingChat( TEAM.ALLIES );
		Util.MapDebugPrint( "Allied_Slide_Destroyed" );
	},

	Axis_Slide_Destroyed = function()
	{
		Map.Axis_Slide_Dyno = 0;

		ETUtil.WinningChat( TEAM.ALLIES );
		ETUtil.LosingChat( TEAM.AXIS );
		Util.MapDebugPrint( "Axis_Slide_Destroyed" );
	},

};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "Planted at the Allied Slide", Map.Allied_Slide_Planted );
	OnTrigger( "Planted at the Axis Slide", Map.Axis_Slide_Planted );
	OnTrigger( "Defused at the Allied Slide", Map.Allied_Slide_Defused );
	OnTrigger( "Defused at the Axis Slide", Map.Axis_Slide_Defused );
	OnTrigger( "Axis have destroyed the Allied Slide!", Map.Allied_Slide_Destroyed );
	OnTrigger( "Allies have destroyed the Axis Slide!", Map.Axis_Slide_Destroyed );

	Util.DisableGoal( ".*", true ); // all but routes
	// *** AXIS GOALS ***
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"ATTACK_slideA_.*",
		"DEFEND_slide_.*",
		"PLANT_Allied_Slide",
		"HEALTHCAB_.*",
		"AMMOCAB_.*",
	});
	// *** ALLIES GOALS ***
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"ATTACK_slide_.*",
		"DEFEND_slideA_.*",
		"PLANT_Axis_Slide",
		"HEALTHCAB_.*",
		"AMMOCAB_.*",
	});
	//Add Use Wp
	Util.AddUseWp("PLANT_Axis_Slide", "axis_slide");
	Util.AddUseWp("PLANT_Axis_Slide", "axis_slide1");
	Util.AddUseWp("PLANT_Allied_Slide", "allied_slide");
	Util.AddUseWp("PLANT_Allied_Slide", "allied_slide1");
	// Max users per goal
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );

	// *** ALLIED GOALS PRIORITY ***
	SetGoalPriority( "ATTACK_.*", 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "DEFEND_.*", 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "ATTACK_.*", 0.0, TEAM.ALLIES, CLASS.MEDIC );
	SetGoalPriority( "DEFEND_.*", 0.0, TEAM.ALLIES, CLASS.MEDIC );
	SetGoalPriority( "PLANT_Axis_Slide", 1.0, TEAM.ALLIES, CLASS.ENGINEER );

	// *** AXIS GOALS PRIORITY ***
	SetGoalPriority( "DEFEND_.*", 0.0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "ATTACK_.*", 0.0, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "DEFEND_.*", 0.0, TEAM.AXIS, CLASS.MEDIC );
	SetGoalPriority( "ATTACK_.*", 0.0, TEAM.AXIS, CLASS.MEDIC );
	SetGoalPriority( "PLANT_Allied_Slide", 1.0, TEAM.AXIS, CLASS.ENGINEER );

	// Camp times
	SetMapGoalProperties( "ATTACK_.*", {mincamptime=30, maxcamptime=45});
	SetMapGoalProperties( "DEFEND_.*", {mincamptime=60, maxcamptime=120});

	// Max users per goal
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 2, "PLANT_.*" );
//Map Routes
	MapRoutes =
	{
		PLANT_Allied_Slide =
		{
			ROUTE_Spawn_Allies  =
			{
				ROUTE_slide  =
				{
					ROUTE_slide_1  =
					{
						ROUTE_slide_2  =
						{
							ROUTE_slide_3  =
							{
								ROUTE_slide_4  =
								{
									ROUTE_slide_5  =
									{
										ROUTE_slide_6  =
										{
										},
									},
								},
							},
						},
					},
					ROUTE_back  =
					{
						ROUTE_back_1  =
						{
							ROUTE_back_2  =
							{
								ROUTE_back_3  =
								{
									ROUTE_back_4  =
									{
										ROUTE_back_5  =
										{
											ROUTE_back_6  =
											{
												ROUTE_back_7  =
												{
													ROUTE_backA_1  =
													{
														ROUTE_slide_3  =
														{
															ROUTE_slide_4  =
															{
																ROUTE_slide_5  =
																{
																	ROUTE_slide_6  =
																	{
																	},
																},
															},
														},
													},
												},
											},
										},
									},
								},
							},
						},
					},
				},
			},
		},
		PLANT_Axis_Slide =
		{
			ROUTE_Axis_Spawn  =
			{
				ROUTE_slideA  =
				{
					ROUTE_slideA_1  =
					{
						ROUTE_slideA_2  =
						{
							ROUTE_slideA_3  =
							{
								ROUTE_slideA_4  =
								{
									ROUTE_slideA_5  =
									{
										ROUTE_slideA_6  =
										{
											ROUTE_slideA_7  =
											{
											},
										},
									},
								},
							},
						},
					},
					ROUTE_backA  =
					{
						ROUTE_backA_1  =
						{
							ROUTE_backA_2  =
							{
								ROUTE_backA_3  =
								{
									ROUTE_backA_4  =
									{
										ROUTE_backA_5  =
										{
											ROUTE_backA_6  =
											{
												ROUTE_backA_7  =
												{
													ROUTE_backA_8  =
													{
														ROUTE_backA_9  =
														{
															ROUTE_slideA_4  =
															{
																ROUTE_slideA_5  =
																{
																	ROUTE_slideA_6  =
																	{
																		ROUTE_slideA_7  =
																		{
																		},
																	},
																},
															},
														},
													},
												},
											},
										},
									},
								},
							},
						},
					},
				},
			},
		},
	};

	Util.Routes(MapRoutes);

	Util.MapDebugPrint( "Omni-bot map script for " + GetMapName() + " executed." );
};

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 90.0;
};
