//==========================================================================================
//
//	ctbfinal.gm
//
//	Who                  	When		What
//------------------------------------------------------------------------------------------
//	maker@bigsighstudios.com	28 June 2018	waypoints
//	palota	9 June 2025		script
//==========================================================================================
//

global Map =
{
	allied_flag_Taken = function()
	{
		SetAvailableMapGoals(TEAM.AXIS, false, "FLAG_allied.*");
		Util.MapDebugPrint("allied_flag_Taken");
	},

	axis_flag_Taken = function()
	{
		SetAvailableMapGoals(TEAM.ALLIES, false, "FLAG_axis.*");
		Util.MapDebugPrint("axis_flag_Taken");
	},

	allied_flag_Returned = function()
	{
		SetAvailableMapGoals(TEAM.AXIS, true, "FLAG_allied.*");
		Util.MapDebugPrint("allied_flag_Returned");
	},

	axis_flag_Returned = function()
	{
		SetAvailableMapGoals(TEAM.ALLIES, true, "FLAG_axis.*");
		Util.MapDebugPrint("axis_flag_Returned");
	},

	allied_flag_Secured = function()
	{
		SetAvailableMapGoals(TEAM.AXIS, true, "FLAG_allied.*");
		Util.MapDebugPrint("allied_flag_Secured");
	},

	axis_flag_Secured = function()
	{
		SetAvailableMapGoals(TEAM.ALLIES, true, "FLAG_axis.*");
		Util.MapDebugPrint("axis_flag_Secured");
	},

};

global OnMapLoad = function()
{
	OnTrigger("Axis have stolen ^1The Axis Parts!", Map.allied_flag_Taken);
	OnTrigger("Allies have stolen ^4The Allied Parts!", Map.axis_flag_Taken);
	OnTrigger("Flag returned allied_flag!", Map.allied_flag_Returned);
	OnTrigger("Flag returned axis_flag!", Map.axis_flag_Returned);
	OnTrigger("The ^1AXIS ^7have Captured a Parts Box!", Map.allied_flag_Secured);
	OnTrigger("The ^4ALLIES ^7have Captured a Parts Box!", Map.axis_flag_Secured);

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

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

	foreach(weap and b in WeaponTable.GetPrimaryWeapons(bot.GetTeam(), bot.GetClass()))
	{
		bot.GetWeapon(weap).PrimaryFire.SetTargetBias(CLASS.BREAKABLE, 1.2);
	}

	bot.GetWeapon(WEAPON.KNIFE).PrimaryFire.SetDesirabilityRange(0, 48, 0.6);
};

global InitializeRoutes = function()
{
	MapRoutes =
	{
		CAPPOINT_Allies =
		{
			ROUTE_flag =
			{
				ROUTE_se =
				{
				},
				ROUTE_sw =
				{
				},
			},
		},
		CAPPOINT_Axis =
		{
			ROUTE_flag =
			{
				ROUTE_ne =
				{
				},
				ROUTE_nw =
				{
				},
			},
		},
		FLAG_allied_flag =
		{
			ROUTE_axis_spawn =
			{
				ROUTE_axis_w =
				{
				},
				ROUTE_axis_e =
				{
				},
			},
		},
		FLAG_axis_flag =
		{
			ROUTE_allied_spawn =
			{
				ROUTE_allies_e =
				{
				},
				ROUTE_allies_w =
				{
				},
			},
		},
	};
	Util.Routes(MapRoutes);
};
