//==========================================================================================
//
//	the_port_b1.gm
//
//	Who		When			What
//------------------------------------------------------------------------------------------
//	MickyP		15 September 2010	Initial Script
//	palota		22 May 2011	fixed goal names
//
//==========================================================================================
//
// To Do:
// Routing
//
global Map =
{
	truckstatus = true,  //true = built; false = damaged
	barrier1built = false,
	barrier2built = false,
	truckatbarrier1 = false,
	truckatbarrier2 = false,
	goldsecured = false,
	escort = false,

	// for compat with 'old' versions
	BUILD_Neutral_Command_Post = "BUILD_Neutral_Command_Post",
	BUILD_Sewer_Gate = "BUILD_Sewer_Gate",
	BUILD_Truck = "BUILD_Truck",
	BUILD_Truck_Barrier_1 = "BUILD_Truck_Barrier_1",
	BUILD_Truck_Barrier_2 = "BUILD_Truck_Barrier_2",
	PLANT_Neutral_Command_Post = "PLANT_Neutral_Command_Post",
	PLANT_Port_gate = "PLANT_Port_gate",
	PLANT_Sewer_Gate = "PLANT_Sewer_Gate",
	PLANT_Train_gate = "PLANT_Train_gate",
	PLANT_Truck_Barrier_1 = "PLANT_Truck_Barrier_1",
	PLANT_Truck_Barrier_2 = "PLANT_Truck_Barrier_2",


	Switches =
	{
		outside =
		{
			Enabled = true,
			Priority = 0,
			WaypointName = "outside",
			Timeout = 2000,
			//AimPosition = Vec3(10829.165, 12304.125, 54.814),
			LimitBots = 1,
		},
		inside =
		{
			Enabled = true,
			Priority = 0,
			WaypointName = "inside",
			Timeout = 2000,
			//AimPosition = Vec3(-2037.579, 1107.875, 39.673),
			LimitBots = 1,
		},
		biggate =
		{
			Enabled = true,
			Priority = 0,
			WaypointName = "biggate",
			Timeout = 2000,
			//AimPosition = Vec3(-738.781, 3219.875, 64.059),
			LimitBots = 1,
		},
	},

	Neutral_Command_Post_Built = function( trigger )
	{
		Util.MapDebugPrint( "Neutral_Command_Post_Built" );
	},

	Neutral_Command_Post_Destroyed = function( trigger )
	{
		Util.MapDebugPrint( "Neutral_Command_Post_Destroyed" );
	},

	flag_Axis_Captured = function( trigger )
	{
		Util.LimitToTeam(TEAM.AXIS, Map.PLANT_Neutral_Command_Post);
		Util.LimitToTeam(TEAM.AXIS, Map.BUILD_Neutral_Command_Post);
		Util.SetMaxUsers( 4, "CHECKPOINT_flag" );
		Util.MapDebugPrint( "flag_Axis_Captured" );
	},

	flag_Allies_Captured = function( trigger )
	{
		Util.LimitToTeam(TEAM.ALLIES, Map.PLANT_Neutral_Command_Post);
		Util.LimitToTeam(TEAM.ALLIES, Map.BUILD_Neutral_Command_Post);
		Util.SetMaxUsers( 1, "CHECKPOINT_flag" );
		Util.MapDebugPrint( "flag_Allies_Captured" );
	},

	Port_gate_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"FLAG_keycard_flag",
			"CHECKPOINT_flag",
			"CAPPOINT_Keycard",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Port_Gate.*" );

		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Port_Gate.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			Map.BUILD_Truck_Barrier_1,
			Map.BUILD_Truck_Barrier_2,
			"CHECKPOINT_flag",
			"DEFEND_Yard.*",
			"MOUNTMG42_mg42_bank",
			"REPAIRMG42_mg42_bank",
		});

		Util.EnableGoal( Map.BUILD_Neutral_Command_Post );
		Util.EnableGoal( Map.PLANT_Neutral_Command_Post );

		Util.MapDebugPrint( "Port_gate_Destroyed" );
	},

	Sewer_Gate_Built = function( trigger )
	{
		Util.MapDebugPrint( "Sewer_Gate_Built" );
	},

	Sewer_Gate_Destroyed = function( trigger )
	{
		Util.MapDebugPrint( "Sewer_Gate_Destroyed" );
	},

	keycard_flag_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Key.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Key.*" );
		Map.cardtaken = true;
		Util.MapDebugPrint( "keycard_flag_Taken" );
	},

	keycard_flag_Returned = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Key.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Key.*" );
		Map.cardtaken = false;
		Util.MapDebugPrint( "keycard_flag_Returned" );
	},

	keycard_flag_Secured = function( trigger )
	{
		sleep(2.8); // Small delay while door opens
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Key.*",
			"CAPPOINT_Keycard",
			"FLAG_keycard_flag",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"SWITCH_Train_Doors",
			"DEFEND_Truck.*",
		});

		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Key.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Truck.*" );

		Util.MapDebugPrint( "keycard_flag_Secured" );
	},

	train_doors_opening = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"SWITCH_Train_Doors",
			"DEFEND_Truck.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.PLANT_Train_gate,
			"ATTACK_Train.*",
		});

		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Train.*" );

		Util.MapDebugPrint( "train_doors_opening" );
	},

	Train_gate_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"CAPPOINT_Gold_Battery",
			"FLAG_Gold_Bar",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Train.*" );

		Util.MapDebugPrint( "Train_gate_Destroyed" );
	},

	Gold_Bar_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Truck.*" );

		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Truck.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Train.*" );

		Util.MapDebugPrint( "Gold_Bar_Taken" );
	},

	Gold_Bar_Returned = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Truck.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Train.*" );

		Util.MapDebugPrint( "Gold_Bar_Returned" );
	},

	Gold_Bar_Secured = function( trigger )
	{
		if ( Map.goldsecured == true)
			{ return; }

		SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_Gold_Bar" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_Radar_Door" );
		Wp.SetWaypointFlag( "train", "closed", true );
		Map.goldsecured = true;
		Util.MapDebugPrint( "Gold_Bar_Secured" );
	},

	Radar_doors_opening = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Truck.*",
			"SWITCH_Radar_Door",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_radarbox1" );

		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Radar.*" );

		Util.MapDebugPrint( "Radar_doors_opening" );
	},

	radarbox1_Taken = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Truck.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Truck.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Radar.*" );
		Util.MapDebugPrint( "radarbox1_Taken" );
	},

	radarbox1_Returned = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Truck.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Radar.*" );
		Util.MapDebugPrint( "radarbox1_Returned" );
	},

	radarbox1_Secured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Truck.*",
			"FLAG_radarbox1",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Barrier_1.*",
			Map.BUILD_Truck,
			"ESCORT_Truck",
			Map.PLANT_Truck_Barrier_1,
			Map.PLANT_Truck_Barrier_2,
		});

		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Barrier_1.*" );
		SetGoalPriority( Map.BUILD_Truck_Barrier_1, 0.91, TEAM.AXIS);
		Map.escort = true;
		Util.MapDebugPrint( "radarbox1_Secured" );
	},

	Truck_Barrier_1_Built = function( trigger )
	{
		if ( Map.truckatbarrier1 == true )
		{
			Map.escort = false;
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"ESCORT_Truck",
				Map.BUILD_Truck,
			});
		}

		Map.barrier1built = true;
		Util.MapDebugPrint( "Truck_Barrier_1_Built" );
	},

	Truck_Barrier_2_Built = function( trigger )
	{
		if ( Map.truckatbarrier2 == true )
		{
			Map.escort = false;
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"ESCORT_Truck",
				Map.BUILD_Truck,
			});
		}
		Map.barrier2built = true;
		Util.MapDebugPrint( "Truck_Barrier_2_Built" );
	},

	Truck_Barrier_1_Destroyed = function( trigger )
	{
		if ( Map.truckatbarrier1 == true )
		{
			Map.escort = true;
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.BUILD_Truck );
		}

		if ( Map.truckstatus == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_Truck" );
		}

		Map.barrier1built = false;
		Util.MapDebugPrint( "Truck_Barrier_1_Destroyed" );
	},

	Truck_Barrier_2_Destroyed = function( trigger )
	{
		if ( Map.truckatbarrier2 == true )
		{
			Map.escort = true;
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.BUILD_Truck );
		}

		if ( Map.truckstatus == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_Truck" );
		}
		Map.barrier2built = false;
		Util.MapDebugPrint( "Truck_Barrier_2_Destroyed" );
	},

	truck_repaired = function( trigger )
	{
		Map.truckstatus = true;

		if ( Map.escort == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_Truck" );
		}
		Util.MapDebugPrint( "truck_repaired" );
	},

	truck_damaged = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_Truck" );
		Util.MapDebugPrint( "truck_damaged" );
	},

	truck_at_barrier1 = function( trigger )
	{
		if ( Map.barrier1built == true )
		{
			Map.escort = false;
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"ESCORT_Truck",
				Map.BUILD_Truck,
			});
		}
		Map.truckatbarrier1 = true;
		Util.MapDebugPrint( "truck_at_barrier1" );
	},

	truck_at_barrier2 = function( trigger )
	{
		if ( Map.barrier2built == true )
		{
			Map.escort = false;
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"ESCORT_Truck",
				Map.BUILD_Truck,
			});
		}
		Map.truckatbarrier2 = true;
		Util.MapDebugPrint( "truck_at_barrier2" );
	},

	truck_past_barrier1 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Barrier_1.*",
			Map.PLANT_Truck_Barrier_1,
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Barrier_2.*" );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Yard.*",
			"DEFEND_Barrier_1.*",
			Map.BUILD_Truck_Barrier_1,
			"MOUNTMG42_mg42_bank",
			"REPAIRMG42_mg42_bank",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Barrier_2.*" );
		SetGoalPriority( Map.BUILD_Truck_Barrier_2, 0.91, TEAM.AXIS);
		Map.truckatbarrier1 = false;
		Util.MapDebugPrint( "truck_past_barrier1" );
	},

	truck_past_barrier2 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"DEFEND_Barrier_2.*",
			Map.PLANT_Truck_Barrier_2,
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_End.*" );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Barrier_2.*",
			Map.BUILD_Truck_Barrier_2,
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_End.*" );
		Map.truckatbarrier1 = false;
		Util.MapDebugPrint( "truck_past_barrier2" );
	},

	vehicle_at_location = function( trigger )
	{
		switch(Map.VehicleLocation)
		{
			case 1:
			{
				Map.truck_at_barrier1();
			}
			case 2:
			{
				Map.truck_at_barrier2();
			}
		}
		Util.MapDebugPrint("vehicle at location " + Map.VehicleLocation, true);
	},

	side_door_trigger = function( trigger )
	{
		vel = ToVector(trigger.Action);

		if ( vel.z > 0 )
		{
			sleep(1.5);
			Map.Switches.outside.Enabled = true;
			Map.Switches.inside.Enabled = true;
			Map.DoorStatus = 0;
			Util.MapDebugPrint( "side door closed", true );
		}
		else if ( vel.z < 0 )
		{
			Map.Switches.outside.Enabled = false;
			Map.Switches.inside.Enabled = false;
			Map.DoorStatus = 1;
			Util.MapDebugPrint( "side door open", true );
		}
	},

	big_door_trigger = function( trigger )
	{
		vel = ToVector(trigger.Action);

		if ( vel.x > 0 )
		{
			sleep(1.5);
			Map.Switches.biggate.Enabled = true;
			Map.DoorStatus = 0;
			Util.MapDebugPrint( "big door closed", true );
		}
		else if ( vel.x < 0 )
		{
			Map.Switches.biggate.Enabled = false;
			Map.DoorStatus = 1;
			Util.MapDebugPrint( "big_door open", true );
		}
	},
};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "^4Allied Command Post constructed. Charge speed increased!", Map.Neutral_Command_Post_Built );
	OnTrigger( "^1Axis Command Post constructed. Charge speed increased!", Map.Neutral_Command_Post_Built );
	OnTrigger( "^1Axis team has destroyed the Allied Command Post!", Map.Neutral_Command_Post_Destroyed );
	OnTrigger( "^4Allied team has destroyed the Axis Command Post!", Map.Neutral_Command_Post_Destroyed );

	OnTrigger( "^1Axis captured the forward spawn!", Map.flag_Axis_Captured );
	OnTrigger( "^4Allies captured the forward spawn!", Map.flag_Allies_Captured );

	OnTrigger( "^4The Allies have destroyed the Port gate!", Map.Port_gate_Destroyed );

	OnTrigger( "Allies have stolen the Keycard!", Map.keycard_flag_Taken );
	OnTrigger( "Flag returned keycard_flag!", Map.keycard_flag_Returned );
	OnTrigger( "^4Allied team has used the keycard!", Map.keycard_flag_Secured );

	OnTrigger( "^3The train doors are opening!", Map.train_doors_opening );
	OnTrigger( "^4The Allies have destroyed the Train gate!", Map.Train_gate_Destroyed );
	OnTrigger( "Allies have stolen The Gold Bar!", Map.Gold_Bar_Taken );
	OnTrigger( "goldrush_axis_gold1_returned", Map.Gold_Bar_Returned );
	OnTrigger( "^4Allied team has secured the first Gold Crate!", Map.Gold_Bar_Secured );

	OnTrigger( "^3The Radar gate are opening!", Map.Radar_doors_opening );
	OnTrigger( "radar_allies_radarw_taken", Map.radarbox1_Taken );
	OnTrigger( "radar_allies_radarw_returned", Map.radarbox1_Returned );
	OnTrigger( "^4Allied team is escaping with the Gold Crate and radar part!", Map.radarbox1_Secured );

	OnTrigger( "^1Axis team have constructed The Sewer Gate", Map.Sewer_Gate_Built );
	OnTrigger( "^4Allied team have destroyed The Sewer Gate", Map.Sewer_Gate_Destroyed );

	OnTrigger( "^1Truck Barrier #1 has been constructed.", Map.Truck_Barrier_1_Built );
	OnTrigger( "^4Truck Barrier #1 has been destroyed.", Map.Truck_Barrier_1_Destroyed );

	OnTrigger( "^1Truck Barrier #2 has been constructed.", Map.Truck_Barrier_2_Built );
	OnTrigger( "^4Truck Barrier #2 has been destroyed.", Map.Truck_Barrier_2_Destroyed );

	OnTrigger( "^4The Truck has been repaired!", Map.truck_repaired );
	OnTrigger( "^1The Truck has been damaged!", Map.truck_damaged );

	OnTrigger( "truck at location", Map.vehicle_at_location );

	OnTrigger( "goldrush_allies_truck_barrier1", Map.truck_past_barrier1 );
	OnTrigger( "goldrush_allies_truck_barrier2", Map.truck_past_barrier2 );

	OnTrigger( "rightdoor_lever1_goto", Map.side_door_trigger );
	OnTrigger( "door_2_goto", Map.big_door_trigger );

	barrier1 = OnTriggerRegion(AABB(-1791.296,-1854.212,1.125,-1525.994,-1785.886,97.373), RegionTrigger.VehicleTrigger);
	barrier2 = OnTriggerRegion(AABB(-2887.417,-685.607,7.125,-2640.125,-623.803,84.741), RegionTrigger.VehicleTrigger);

	// cs: need to detect if these goals exist since color strings have been completely stripped in the latest version
	if (GetGoal(Map.PLANT_Port_gate)==null) {
		Map.BUILD_Neutral_Command_Post = "BUILD_3Neutral_Command_Post";
		Map.BUILD_Sewer_Gate = "BUILD_3Sewer_Gate";
		Map.BUILD_Truck = "BUILD_3Truck";
		Map.BUILD_Truck_Barrier_1 = "BUILD_3Truck_Barrier_1";
		Map.BUILD_Truck_Barrier_2 = "BUILD_3Truck_Barrier_2";
		Map.PLANT_Neutral_Command_Post = "PLANT_3Neutral_Command_Post";
		Map.PLANT_Port_gate = "PLANT_3Port_gate";
		Map.PLANT_Sewer_Gate = "PLANT_3Sewer_Gate";
		Map.PLANT_Train_gate = "PLANT_3Train_gate";
		Map.PLANT_Truck_Barrier_1 = "PLANT_3Truck_Barrier_1";
		Map.PLANT_Truck_Barrier_2 = "PLANT_3Truck_Barrier_2";
	}

	Util.DisableGoal( ".*", true ); // all but routes
	Util.EnableGoal( "AMMOCAB.*" );
	Util.EnableGoal( "HEALTHCAB.*" );

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		Map.PLANT_Port_gate,
		"ATTACK_Port_Gate.*",
	});

	SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Port_Gate.*" );

	// Max users per goal
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );

	Util.SetGoalOffset( 100, 0, 0, Map.PLANT_Train_gate );

	SetGoalPriority( "DEFEND_Yard.*", 0.49, TEAM.AXIS);

	Wp.SetWaypointFlag( "train", "closed", false );


	// Camp times
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=10, MaxCampTime=60} );

	Util.UpdateSwitchData();

	MapRoutes =
	{
		DEFEND_Port_Gate_1 =
		{
			ROUTE_Axis_Top_Spawn  =
			{
				ROUTE_Spiril_Stairs  =
				{
				},
				ROUTE_Boat_Beam  =
				{
				},
				ROUTE_Port_Wood_Stairs  =
				{
					ROUTE_Boat_Side  =
					{
					},
					ROUTE_Port_Gate_Entry  =
					{
					},
				},
			},
		},
		CHECKPOINT_flag =
		{
			ROUTE_Gate_Spawn  =
			{
				ROUTE_Lever_Door  =
				{
				},
				ROUTE_Crane_Exit  =
				{
				},
			},
			ROUTE_Axis_Yard_Spawn  =
			{
				ROUTE_Yard_South_Door  =
				{
				},
				ROUTE_Yard_North_Exit  =
				{
				},
			},
		},
		CAPPOINT_Keycard =
		{
			ROUTE_Flag_Spawn  =
			{
				ROUTE_Flag_East  =
				{
				},
				ROUTE_West_Flag  =
				{
				},
			},
		},
		DEFEND_Radar_1 =
		{
			ROUTE_Axis_Yard_Spawn  =
			{
				ROUTE_Yard_South_Door  =
				{
					ROUTE_Yard_South_Ladder  =
					{
					},
				},
				ROUTE_Yard_North_Exit  =
				{
					ROUTE_Yard_North_Ladder  =
					{
					},
				},
			},
			ROUTE_Flag_Spawn  =
			{
				ROUTE_Flag_East  =
				{
				},
				ROUTE_West_Flag  =
				{
				},
			},
		},
		DEFEND_Barrier_1_1 =
		{
			ROUTE_Axis_Yard_Spawn  =
			{
				ROUTE_Yard_North_Exit  =
				{
				},
				ROUTE_Yard_South_Door  =
				{
				},
			},
		},
		ATTACK_Barrier_1_1 =
		{
			ROUTE_Flag_Spawn  =
			{
			},
			ROUTE_Flag_East  =
			{
			},
			ROUTE_Flag_Side  =
			{
			},
		},
		DEFEND_Barrier_2_1 =
		{
			ROUTE_Axis_Yard_Spawn  =
			{
				ROUTE_Yard_North_Exit  =
				{
				},
				ROUTE_Yard_South_Door  =
				{
				},
			},
			ROUTE_Flag_Spawn  =
			{
				ROUTE_West_Flag  =
				{
				},
				ROUTE_Flag_East  =
				{
				},
				ROUTE_Flag_Side  =
				{
				},
			},
		},
		DEFEND_Truck_1 =
		{
			ROUTE_Axis_Yard_Spawn  =
			{
				ROUTE_Yard_North_Exit  =
				{
				},
				ROUTE_Yard_South_Door  =
				{
				},
			},
			ROUTE_Flag_Spawn  =
			{
				ROUTE_Flag_East  =
				{
				},
				ROUTE_West_Flag  =
				{
				},
			},
		},
		FLAG_radarbox1 =
		{
			ROUTE_Flag_Spawn  =
			{
				ROUTE_Flag_East  =
				{
					ROUTE_Yard_North_Ladder  =
					{
					},
					ROUTE_Yard_South_Ladder  =
					{
					},
				},
				ROUTE_West_Flag  =
				{
					ROUTE_Yard_North_Ladder  =
					{
					},
					ROUTE_Yard_South_Ladder  =
					{
					},
				},
			},
			ROUTE_Switches  =
			{
				ROUTE_Yard_South_Ladder  =
				{
				},
				ROUTE_Yard_North_Ladder  =
				{
				},
			},
		},
		DEFEND_End_1 =
		{
			ROUTE_Axis_Yard_Spawn  =
			{
				ROUTE_Yard_North_Exit  =
				{
				},
				ROUTE_Yard_South_Door  =
				{
				},
			},
			ROUTE_Flag_Spawn  =
			{
				ROUTE_Flag_Side  =
				{
				},
				ROUTE_West_Flag  =
				{
				},
				ROUTE_Flag_East  =
				{
				},
			},
		},
		CAPPOINT_Gold_Battery =
		{
			ROUTE_Gold_Bar  =
			{
				ROUTE_Truck_Front  =
				{
				},
				ROUTE_Main_Yard_Path  =
				{
				},
			},
			ROUTE_Radar_Parts  =
			{
				ROUTE_North_Wall_Drop  =
				{
					ROUTE_Truck_Front  =
					{
					},
					ROUTE_Main_Yard_Path  =
					{
					},
				},
				ROUTE_Empty_Train_Top  =
				{
					ROUTE_Truck_Front  =
					{
					},
					ROUTE_Main_Yard_Path  =
					{
					},
				},
			},
		},
	};

	portGate =
	{
		ROUTE_Allies_1st_Spawn  =
		{
			ROUTE_Port_Gate_Passage  =
			{
			},
			ROUTE_Wire_Reels  =
			{
				ROUTE_Boat_Side  =
				{
				},
				ROUTE_Port_Gate_Entry  =
				{
				},
			},
			ROUTE_Lighthouse_Path  =
			{
				ROUTE_Port_Gate_Entry  =
				{
				},
				ROUTE_Boat_Side  =
				{
				},
			},
		},
	};
	MapRoutes[Map.PLANT_Port_gate] = portGate;
	MapRoutes.ATTACK_Port_Gate_1 = portGate;
	MapRoutes.ATTACK_Port_Gate_2 = portGate;
	MapRoutes.ATTACK_Port_Gate_3 = portGate;
	MapRoutes.ATTACK_Port_Gate_4 = portGate;
	MapRoutes.ATTACK_Port_Gate_5 = portGate;
	MapRoutes.ATTACK_Port_Gate_6 = portGate;
	MapRoutes.DEFEND_Port_Gate_2 = MapRoutes.DEFEND_Port_Gate_1;
	MapRoutes.DEFEND_Port_Gate_3 = MapRoutes.DEFEND_Port_Gate_1;
	MapRoutes.DEFEND_Port_Gate_4 = MapRoutes.DEFEND_Port_Gate_1;
	MapRoutes.DEFEND_Port_Gate_5 = MapRoutes.DEFEND_Port_Gate_1;
	MapRoutes.DEFEND_Port_Gate_6 = MapRoutes.DEFEND_Port_Gate_1;
	MapRoutes.DEFEND_Port_Gate_7 = MapRoutes.DEFEND_Port_Gate_1;
	MapRoutes.DEFEND_Port_Gate_8 = MapRoutes.DEFEND_Port_Gate_1;
	MapRoutes.ATTACK_Barrier_1_2 = MapRoutes.ATTACK_Barrier_1_1;
	MapRoutes.ATTACK_Barrier_1_3 = MapRoutes.ATTACK_Barrier_1_1;
	MapRoutes.ATTACK_Barrier_1_4 = MapRoutes.ATTACK_Barrier_1_1;
	MapRoutes.ATTACK_Barrier_1_5 = MapRoutes.ATTACK_Barrier_1_1;
	MapRoutes.ATTACK_Barrier_1_6 = MapRoutes.ATTACK_Barrier_1_1;
	MapRoutes.DEFEND_Barrier_1_2 = MapRoutes.DEFEND_Barrier_1_1;
	MapRoutes.DEFEND_Barrier_1_3 = MapRoutes.DEFEND_Barrier_1_1;
	MapRoutes.DEFEND_Barrier_1_4 = MapRoutes.DEFEND_Barrier_1_1;
	MapRoutes.DEFEND_Barrier_1_5 = MapRoutes.DEFEND_Barrier_1_1;
	MapRoutes.DEFEND_Barrier_1_6 = MapRoutes.DEFEND_Barrier_1_1;
	MapRoutes.DEFEND_Key_1 = MapRoutes.DEFEND_Barrier_1_1;
	MapRoutes.DEFEND_Key_2 = MapRoutes.DEFEND_Barrier_1_1;
	MapRoutes.DEFEND_Key_3 = MapRoutes.DEFEND_Barrier_1_1;
	MapRoutes.DEFEND_Barrier_2_2 = MapRoutes.DEFEND_Barrier_2_1;
	MapRoutes.DEFEND_Barrier_2_3 = MapRoutes.DEFEND_Barrier_2_1;
	MapRoutes.DEFEND_Barrier_2_4 = MapRoutes.DEFEND_Barrier_2_1;
	MapRoutes.DEFEND_Barrier_2_5 = MapRoutes.DEFEND_Barrier_2_1;
	MapRoutes.DEFEND_Barrier_2_6 = MapRoutes.DEFEND_Barrier_2_1;
	MapRoutes.DEFEND_Barrier_2_7 = MapRoutes.DEFEND_Barrier_2_1;
	MapRoutes.DEFEND_Truck_2 = MapRoutes.DEFEND_Truck_1;
	MapRoutes.DEFEND_Truck_3 = MapRoutes.DEFEND_Truck_1;
	MapRoutes.DEFEND_Truck_4 = MapRoutes.DEFEND_Truck_1;
	MapRoutes.ATTACK_Key_1 = MapRoutes.DEFEND_Truck_1;
	MapRoutes.ATTACK_Key_2 = MapRoutes.DEFEND_Truck_1;
	MapRoutes.ATTACK_Key_3 = MapRoutes.DEFEND_Truck_1;
	MapRoutes.ATTACK_Key_4 = MapRoutes.DEFEND_Truck_1;
	MapRoutes.ATTACK_Key_5 = MapRoutes.DEFEND_Truck_1;
	MapRoutes.ATTACK_Key_6 = MapRoutes.DEFEND_Truck_1;
	MapRoutes.DEFEND_End_2 = MapRoutes.DEFEND_End_1;
	MapRoutes.DEFEND_End_3 = MapRoutes.DEFEND_End_1;
	MapRoutes.DEFEND_End_4 = MapRoutes.DEFEND_End_1;
	MapRoutes.DEFEND_End_5 = MapRoutes.DEFEND_End_1;
	MapRoutes.DEFEND_End_6 = MapRoutes.DEFEND_End_1;
	MapRoutes.DEFEND_End_7 = MapRoutes.DEFEND_End_1;
	MapRoutes.SWITCH_Train_Doors = MapRoutes.DEFEND_Truck_1;
	MapRoutes.SWITCH_Radar_Door = MapRoutes.DEFEND_Truck_1;

	Util.Routes(MapRoutes);

	Util.FixMoverPos("truck", Vec3(-1643.000, -3546.500, -54.500), Vec3(-1642.000, -3692.000, -111.000));

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