//==========================================================================================
//
//	baserace_b1bxmas.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	^4Tardis	07 November 2010	Initial Script
//
//==========================================================================================
//

// cs: note that this map script is entity number dependent, so ETPro map scripts that use the 'create' command can break it
global Map =
{
	Debug = 0, // please set to zero before distributing your script
	Talk = true, //set Talk to false if you don't want the bots to cheer after winning game:

	Roles =
	{
		AXIS = // Team
		{
			AllBots = true, // each bot is considered for a role
			DEFENDER = // the DEFENDER role
			{
				spawnpt = 1,			// users of this role will choose spawnpt 2
				numbots = 3,			// maximum of 3 bots
				crucialClass = CLASS.ENGINEER,	// first bot
			},
		},

		ALLIES =
		{
			AllBots = true, // default: every other bot
			DEFENDER =
			{
				spawnpt = 2,
				numbots = 3,
				crucialClass = CLASS.ENGINEER,
			},
		},
	},


	Navigation =
	{
		jump =
		{
			navigate = function( _this )
			{
				_this.Bot.PressButton( BTN.JUMP );
				_this.Bot.HoldButton( BTN.FORWARD, 3 );
				_this.Bot.HoldButton( BTN.SPRINT, 4 );
				sleep( 4 );
			},
		},
		// /bot waypoint_setproperty paththrough Navigation_PT:jump
	},

	Allied_Fence_Built = function( trigger )
	{
		if ( GetGameIdFromEntity(trigger.Entity) == 123 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Fence" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_121" );
			Util.MapDebugPrint( "Allied_Main_Fence_Built" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 81 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_East_Fence" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_136" );
			Util.MapDebugPrint( "Allied_East_Fence_Built" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 82 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_West_Fence" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_130" );
			Util.MapDebugPrint( "Allied_West_Fence_Built" );
		}
		//123 main fence (1)
		//81  east fence (1)
		//82  west fence (1)
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
	},

	Allied_Fence_Upgrade = function( trigger )
	{
		if ( GetGameIdFromEntity(trigger.Entity) == 123 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"BUILD_Allied_Fence",
				"CAPPOINT_121",
			});
			Util.MapDebugPrint( "Allied_Main_Fence_Finished" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 81 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"BUILD_Allied_East_Fence",
				"CAPPOINT_136",
			});
			Util.MapDebugPrint( "Allied_East_Fence_Finished" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 82 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"BUILD_Allied_West_Fence",
				"CAPPOINT_130",
			});
			Util.MapDebugPrint( "Allied_West_Fence_Finished" );
		}
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//123 main fence (1) Finished
		//81  east fence (1) Finished
		//82  west fence (1) Finished
	},

	Allied_Spawn_Defenses_Built = function( trigger )
	{
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//160 Spawn Build (1)
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Spawn_Defenses" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_141" );
		Util.MapDebugPrint( "Allied_Spawn_Defenses_Built" );
	},

	Allied_Spawn_Defenses_Upgrade = function( trigger )
	{
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//160 Spawn Build (1)
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Spawn_Defenses" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_141" );
		Util.MapDebugPrint( "Allied_Spawn_Defenses_Upgraded" );
	},

	Allied_Spawn_Defenses_Upgrade_Final = function( trigger )
	{
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//160 Spawn Build (1) Finished
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"BUILD_Allied_Spawn_Defenses",
			"CAPPOINT_141",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"AMMOCAB_ammocab_allied",
			"HEALTHCAB_healthcab_allied",
		});
		Util.MapDebugPrint( "Allied_Spawn_Defenses_Finished" );
	},

	Allied_Assult_Tower_Built = function( trigger )
	{
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//115 Assult Tower Build (1)
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Assult_Tower" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_147" );
		Util.MapDebugPrint( "Allied_Assult_Tower_Built" );
	},

	Allied_Assult_Tower_Upgrade = function( trigger )
	{
		if ( GetGameIdFromEntity(trigger.Entity) == 115 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"BUILD_Allied_Assult_Tower",
				"CAPPOINT_147",
			});
			Util.MapDebugPrint( "Assult_Tower_Finished" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 150 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"BUILD_Allied_Gate_Tower",
				"CAPPOINT_166",
			});
			Util.MapDebugPrint( "Gate_Tower_Finished" );
		}
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//150 Gate Tower Upgrade (1) Finished
		//115 Assult Tower Upgrade (1) Finished
	},

	Allied_Gate_Tower_Built  = function( trigger )
	{
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//150 Gate Tower Built (1)
		Wp.SetWaypointFlag("gate1","closed",false);
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Gate_Tower" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_166" );
		Util.MapDebugPrint( "Allied_Gate_Tower_Built" );
	},

	Allied_Construction_Materials_Taken = function( trigger )
	{
		Util.MapDebugPrint( "Allied_Construction_Materials_Taken" );
	},

	Allied_Construction_Materials_Returned = function( trigger )
	{
		Util.MapDebugPrint( "Allied_Construction_Materials_Returned" );
	},

	Allied_Construction_Materials_Secured = function( trigger )
	{
		if ( GetGameIdFromEntity(trigger.Entity) == 121 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Fence" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_121" );
			Util.MapDebugPrint( "Allied_Fence_Build" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 136 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_East_Fence" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_136" );
			Util.MapDebugPrint( "Allied_East_Fence_Build" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 130 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_West_Fence" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_130" );
			Util.MapDebugPrint( "Allied_West_Fence_Build" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 141 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Spawn_Defenses" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_141" );
			Util.MapDebugPrint( "Allied_Spawn_Build" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 166 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Gate_Tower" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_166" );
			Util.MapDebugPrint( "Allied_Gate_Tower_Build" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 147 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Assult_Tower" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_147" );
			Util.MapDebugPrint( "Allied_Assult_Tower_Build" );
		}

		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//121 main fence Build (2)
		//136 east fence Build (2)
		//130 west fence Build (2)
		//141 Spawn Build (3)
		//166 Gate Tower Build (2)
		//147 Assult Tower Build (2)

		Util.MapDebugPrint( "Allied_Construction_Materials_Secured" );
	},

	Allied_win = function( trigger )
	{
		//Game Over CHEER !
		ETUtil.WinningChat( TEAM.ALLIES );
		ETUtil.LosingChat( TEAM.AXIS );

		Util.MapDebugPrint( "Allied_win" );
	},

	axis_Fence_Built = function( trigger )
	{
		if ( GetGameIdFromEntity(trigger.Entity) == 220 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_axis_Fence" );
			SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_218" );
			Util.MapDebugPrint( "Axis_Main_Fence_Built" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 180 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_axis_East_Fence" );
			SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_180" );
			Util.MapDebugPrint( "Axis_East_Fence_Built" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 179 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_axis_West_Fence" );
			SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_233" );
			Util.MapDebugPrint( "Axis_West_Fence_Built" );
		}
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//220 main fence built (1)
		//179 west fence build (1)
		//180 east fence build (1)

	},

	axis_Fence_Upgrade = function( trigger )
	{
		if ( GetGameIdFromEntity(trigger.Entity) == 220 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"BUILD_axis_Fence",
				"CAPPOINT_218",
			});
			Util.MapDebugPrint( "Axis_Main_Fence_Finished" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 180 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"BUILD_axis_East_Fence",
				"CAPPOINT_180",
			});
			Util.MapDebugPrint( "Axis_East_Fence_Finished" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 179 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"BUILD_axis_West_Fence",
				"CAPPOINT_233",
			});
			Util.MapDebugPrint( "Axis_West_Fence_Finished" );
		}
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//220 main fence built (1) Finished
		//179 west fence build (1) Finished
		//180 east ence build (1) Finished
	},

	axis_Spawn_Defenses_Built = function( trigger )
	{
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//257 spawn build (1)
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_238" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_axis_Spawn_Defenses" );
		Util.MapDebugPrint( "Axis_Spawn_Defenses_Built" );
	},

	axis_Spawn_Defenses_Upgrade = function( trigger )
	{
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//257 spawn build (1)
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_238" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_axis_Spawn_Defenses" );
		Util.MapDebugPrint( "Axis_Spawn_Defenses_Upgraded" );
	},

	axis_Spawn_Defenses_Upgrade_Final = function( trigger )
	{
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//257 spawn build (1) Finished
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"CAPPOINT_238",
			"BUILD_axis_Spawn_Defenses",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"AMMOCAB_ammocab_axis",
			"HEALTHCAB_healthcab_axis",
		});
		Util.MapDebugPrint( "Axis_Spawn_Defenses_Finished" );
	},

	axis_Assult_Tower_Built = function( trigger )
	{
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//213 Assult_Tower_Built (1)
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_244" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_axis_Assult_Tower" );
		Util.MapDebugPrint( "Axis_Assult_Tower_Built" );
	},

	axis_Assult_Tower_Upgrade = function( trigger )
	{
		if ( GetGameIdFromEntity(trigger.Entity) == 213 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"CAPPOINT_244",
				"BUILD_axis_Assult_Tower",
			});
			Util.MapDebugPrint( "Axis_Assult_Tower_Upgraded" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 257 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"CAPPOINT_263",
				"BUILD_axis_Gate_Tower",
			});
			Util.MapDebugPrint( "Axis_Gate_Tower_Upgraded" );
		}
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//213 Assult_Tower_Upgrade (1) Finished
		//257 Gate_Tower_Upgrade (1) Finished

	},

	axis_Gate_Tower_Built  = function( trigger )
	{
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//247 Gate_Tower_Built
		Wp.SetWaypointFlag("gate","closed",false);
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_axis_Gate_Tower" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_263" );
		Util.MapDebugPrint( "Axis_Gate_Tower_Built" );
	},

	axis_Construction_Materials_Taken = function( trigger )
	{
		Util.MapDebugPrint( "Axis_Construction_Materials_Taken" );
	},

	axis_Construction_Materials_Returned = function( trigger )
	{
		Util.MapDebugPrint( "Axis_Construction_Materials_Returned" );
	},

	axis_Construction_Materials_Secured = function( trigger )
	{
		if ( GetGameIdFromEntity(trigger.Entity) == 218 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_axis_Fence" );
			SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_218" );
			Util.MapDebugPrint( "Axis_Main_Fence_Build" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 227 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_axis_East_Fence" );
			SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_180" );
			Util.MapDebugPrint( "Axis_East_Fence_Build" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 233 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_axis_West_Fence" );
			SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_233" );
			Util.MapDebugPrint( "Axis_West_Fence_Build" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 238 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_axis_Spawn_Defenses" );
			SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_238" );
			Util.MapDebugPrint( "Axis_Spawn_Build" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 263 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_axis_Gate_Tower" );
			SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_263" );
			Util.MapDebugPrint( "Axis_Gate_Tower_Build" );
		}
		else if ( GetGameIdFromEntity(trigger.Entity) == 244 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_axis_Assult_Tower" );
			SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_244" );
			Util.MapDebugPrint( "Axis_Assult_Tower_Build" );
		}
		//Util.MapDebugPrint(GetGameIdFromEntity(trigger.Entity));
		//218 main fence build (2)
		//233 west fence build (2)
		//227 east fence build (2)
		//238 spawn build (3)
		//263 Gate_Tower (2)
		//244 Assult_Tower (2)

		Util.MapDebugPrint( "Axis_Construction_Materials_Secured" );
	},

	axis_win = function( trigger )
	{
		//Game Over CHEER !
		ETUtil.WinningChat( TEAM.AXIS );
		ETUtil.LosingChat( TEAM.ALLIES );

		Util.MapDebugPrint( "Axis_Win" );
	},
};

global OnMapLoad = function()
{
	// Register callback functions

	OnTrigger( "Allies have stolen Construction Materials!", Map.Allied_Construction_Materials_Taken );
	OnTrigger( "Axis have returned Construction Materials!", Map.Allied_Construction_Materials_Returned );
	OnTrigger( "Allied team has secured Construction Materials!", Map.Allied_Construction_Materials_Secured );

	OnTrigger( "the Allies have built a fence!", Map.Allied_Fence_Built );
	OnTrigger( "the Allies have constructed the Spawn Defenses!", Map.Allied_Spawn_Defenses_Built );
	OnTrigger( "Allied Team has PWNED the Axis and completed their base first!", Map.Allied_win );
	OnTrigger( "the Allies have upgraded their fence!", Map.Allied_Fence_Upgrade );
	OnTrigger( "the Allies have constructed an Assault Tower!", Map.Allied_Assult_Tower_Built );
	OnTrigger( "the Allies have upgraded their Assault Tower!", Map.Allied_Assult_Tower_Upgrade );
	OnTrigger( "the Allies have constructed the Gate Tower!", Map.Allied_Gate_Tower_Built );
	OnTrigger( "the Allies have ungraded their Spawn Defenses!", Map.Allied_Spawn_Defenses_Upgrade );
	OnTrigger( "Allied team has built the Supply Shack!", Map.Allied_Spawn_Defenses_Upgrade_Final );

	OnTrigger( "the axis have built a fence!", Map.axis_Fence_Built );
	OnTrigger( "the axis have constructed the Spawn Defenses!", Map.axis_Spawn_Defenses_Built );
	OnTrigger( "Axis Team has PWNED the Allies and completed their base first!", Map.axis_win );
	OnTrigger( "the axis have upgraded their fence!", Map.axis_Fence_Upgrade );
	OnTrigger( "the axis have constructed an Assault Tower!", Map.axis_Assult_Tower_Built );
	OnTrigger( "the axis have upgraded their Assault Tower!", Map.axis_Assult_Tower_Upgrade );
	OnTrigger( "the axis have constructed the Gate Tower!", Map.axis_Gate_Tower_Built );
	OnTrigger( "the axis have ungraded their Spawn Defenses!", Map.axis_Spawn_Defenses_Upgrade );
	OnTrigger( "axis team has built the Supply Shack!", Map.axis_Spawn_Defenses_Upgrade_Final );

	OnTrigger( "Axis have stolen Construction Materials!", Map.axis_Construction_Materials_Taken );
	OnTrigger( "Allies have returned Construction Materials!", Map.axis_Construction_Materials_Returned );
	OnTrigger( "axis team has secured Construction Materials!", Map.axis_Construction_Materials_Secured );

	Util.DisableGoal( ".*", true ); // all but routes

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"FLAG_Construction_Materials_1",
		"FLAG_Construction_Materials_2",
	});
	SetAvailableMapGoals( TEAM.AXIS, true,	"CAPPOINT_218" ); //main fence build (2)
	SetAvailableMapGoals( TEAM.AXIS, true,	"CAPPOINT_233" ); //west fence build (2)
	SetAvailableMapGoals( TEAM.AXIS, true,	"CAPPOINT_180" ); //east fence build (2)
	SetAvailableMapGoals( TEAM.AXIS, true,	"CAPPOINT_238" ); //spawn build (3)
	SetAvailableMapGoals( TEAM.AXIS, true,	"CAPPOINT_263" ); //Gate_Tower (2)
	SetAvailableMapGoals( TEAM.AXIS, true,	"CAPPOINT_244" ); //Assult_Tower (2)
	SetAvailableMapGoals( TEAM.AXIS, true,	"PLANTMINE_axis.*" );
	Wp.SetWaypointFlag("gate","closed",true);
	SetAvailableMapGoals( TEAM.AXIS, true, "CAMP_rDefense.*" );
	Util.SetRoleForGoals("CAMP_rDefense.*", ROLE.DEFENDER);

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"FLAG_Construction_Materials",
		"FLAG_Construction_Materials_3",
	});
	SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_121" ); //main fence Build (2)
	SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_136" ); //east fence Build (2)
	SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_130" ); //west fence Build (2)
	SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_141" ); //Spawn Build (3)
	SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_166" ); //Gate Tower Build (2)
	SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_147" ); //Assult Tower Build (2)
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANTMINE_allied.*" );
	Wp.SetWaypointFlag("gate1","closed",true);
	SetAvailableMapGoals( TEAM.ALLIES, true, "CAMP_bDefense.*" );
	Util.SetRoleForGoals("CAMP_bDefense.*", ROLE.DEFENDER);

	// Max users per goal
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "BUILD_.*" );
	Util.SetMaxUsers( 1, "CAPPOINT_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "CAMP.*" );
	// Prioritys
	SetGoalPriority( "CAMP.*", 0.86, 0, 0, true );
	SetGoalPriority( "PLANTMINE.*", 1.1, 0, CLASS.ENGINEER );
	// Camp times
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=10, MaxCampTime=60} );
//Map Routes
	MapRoutes =
	{
		FLAG_Construction_Materials =
		{
			ROUTE_AlliesSpawn  =
			{
				ROUTE_main  =
				{
					ROUTE_main_1  =
					{
						ROUTE_main_2  =
						{
							ROUTE_main_3  =
							{
								ROUTE_main_4  =
								{
									ROUTE_main_5  =
									{
										ROUTE_main_6  =
										{
											ROUTE_main_7  =
											{
												ROUTE_main_8  =
												{
												},
											},
										},
									},
								},
								ROUTE_West  =
								{
									ROUTE_West_1  =
									{
										ROUTE_West_2  =
										{
											ROUTE_West_3  =
											{
												ROUTE_West_4  =
												{
												},
											},
										},
									},
								},
							},
						},
					},
					ROUTE_F  =
					{
						ROUTE_F_1  =
						{
							ROUTE_F_2  =
							{
								ROUTE_F_3  =
								{
									ROUTE_F_4  =
									{
										ROUTE_axis_under  =
										{
											ROUTE_axis_under_1  =
											{
												ROUTE_axis_under_2  =
												{
													ROUTE_axis_under_3  =
													{
														ROUTE_axis_under_4  =
														{
														},
													},
													ROUTE_axis_Under_Up  =
													{
													},
												},
											},
										},
									},
								},
								ROUTE_West  =
								{
									ROUTE_West_1  =
									{
										ROUTE_West_2  =
										{
											ROUTE_West_3  =
											{
												ROUTE_West_4  =
												{
												},
											},
										},
									},
								},
							},
						},
					},
				},
				ROUTE_Allied_Under_3  =
				{
					ROUTE_Allied_Under_2  =
					{
						ROUTE_Allied_Under_1  =
						{
							ROUTE_Allied_Under  =
							{
								ROUTE_C_4  =
								{
									ROUTE_C_3  =
									{
										ROUTE_C_2  =
										{
											ROUTE_C_1  =
											{
												ROUTE_C  =
												{
													ROUTE_main_8  =
													{
													},
												},
											},
										},
									},
								},
							},
						},
					},
				},
			},
		},
		FLAG_Construction_Materials_3 =
		{
			ROUTE_AlliesSpawn  =
			{
				ROUTE_main  =
				{
					ROUTE_F  =
					{
						ROUTE_F_1  =
						{
							ROUTE_F_2  =
							{
								ROUTE_F_3  =
								{
									ROUTE_F_4  =
									{
										ROUTE_Allied_Flag  =
										{
										},
									},
								},
							},
						},
					},
				},
			},
		},
		FLAG_Construction_Materials_1 =
		{
			ROUTE_AxisSpawn  =
			{
				ROUTE_main_8  =
				{
					ROUTE_main_7  =
					{
						ROUTE_main_6  =
						{
							ROUTE_main_5  =
							{
								ROUTE_main_4  =
								{
									ROUTE_main_3  =
									{
										ROUTE_main_2  =
										{
											ROUTE_main_1  =
											{
												ROUTE_main  =
												{
												},
											},
										},
									},
									ROUTE_East  =
									{
										ROUTE_East_1  =
										{
											ROUTE_East_2  =
											{
												ROUTE_East_3  =
												{
													ROUTE_East_4  =
													{
													},
												},
											},
										},
									},
								},
							},
						},
					},
					ROUTE_C  =
					{
						ROUTE_C_1  =
						{
							ROUTE_C_2  =
							{
								ROUTE_C_3  =
								{
									ROUTE_C_4  =
									{
										ROUTE_Allied_Under  =
										{
											ROUTE_Allied_Under_1  =
											{
												ROUTE_Allied_Under_2  =
												{
													ROUTE_Allied_Under_3  =
													{
													},
												},
												ROUTE_Under_Up  =
												{
												},
											},
										},
									},
								},
							},
							ROUTE_East  =
							{
								ROUTE_East_1  =
								{
									ROUTE_East_2  =
									{
										ROUTE_East_3  =
										{
											ROUTE_East_4  =
											{
											},
										},
									},
								},
							},
						},
					},
				},
				ROUTE_axis_under_4  =
				{
					ROUTE_axis_under_3  =
					{
						ROUTE_axis_under_2  =
						{
							ROUTE_axis_under_1  =
							{
								ROUTE_F_4  =
								{
									ROUTE_F_3  =
									{
										ROUTE_F_2  =
										{
											ROUTE_F_1  =
											{
												ROUTE_F  =
												{
												},
											},
										},
									},
								},
							},
						},
					},
				},
			},
		},
		FLAG_Construction_Materials_2 =
		{
			ROUTE_AxisSpawn  =
			{
				ROUTE_main_8  =
				{
					ROUTE_C  =
					{
						ROUTE_C_1  =
						{
							ROUTE_C_2  =
							{
								ROUTE_C_3  =
								{
									ROUTE_axis_flag  =
									{
									},
								},
							},
						},
					},
				},
			},
		},
	};

	Util.Routes(MapRoutes);

	Util.MapDebugPrint( "Omni-bot map script for " + GetMapName() + " executed." );
};

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 120.0;
	bot.MaxViewDistance = 1200;
};
