//==========================================================================================
//
//	trainyard_te_b3.gm
//
//	Who                  	When		What
//------------------------------------------------------------------------------------------
//	maker@bigsighstudios.com	18 May 2018	Initial Script
//	palota	4 August 2025
//==========================================================================================
//

global Map =
{
	Depot_door_Destroyed = function()
	{
		sleep(0.1);
		Wp.CheckBlockable();
		SetAvailableMapGoals(TEAM.ALLIES, 1, "FLAG_axis_gold_crate");
		Util.MapDebugPrint("Depot_door_Destroyed");
	},

	axis_gold_crate_Taken = function()
	{
		Util.MapDebugPrint("axis_gold_crate_Taken");
	},
	axis_gold_crate_Returned = function()
	{
		Util.MapDebugPrint("axis_gold_crate_Returned");
	},
	axis_gold_crate_1_Secured = function()
	{
		Util.MapDebugPrint("axis_gold_crate_1_Secured");
	},
	axis_gold_crate_2_Secured = function()
	{
		Util.MapDebugPrint("axis_gold_crate_2_Secured");
	},
	axis_gold_crate_3_Secured = function()
	{
		Util.MapDebugPrint("axis_gold_crate_3_Secured");
	},

};

global OnMapLoad = function()
{
	OnTrigger("^0T^7he Depot door is destroyed^0!", Map.Depot_door_Destroyed);

	OnTrigger("Allies have stolen the axis gold!", Map.axis_gold_crate_Taken);
	OnTrigger("Axis have returned the axis gold!", Map.axis_gold_crate_Returned);

	OnTrigger("^0A^7llied team has secured the first Gold Crate^0!", Map.axis_gold_crate_1_Secured);
	OnTrigger("^0A^7llied team has secured the second Gold Crate^0!", Map.axis_gold_crate_2_Secured);
	OnTrigger("^0A^7llied team has secured the last Gold Crate^0!", Map.axis_gold_crate_3_Secured);

	Util.DisableGoal(".*", true);

	SetAvailableMapGoals(TEAM.ALLIES, 1, {
		"ATTACK.*",
		"PLANT_Depot_door",
		"CAPPOINT.*",
		"MOBILEMG42_203",
	});

	SetAvailableMapGoals(TEAM.AXIS, 1, {
		"DEFEND.*",
		".*ARTILLERY.*",
	});

	Util.SetMaxUsers(1, "PLANT.*");
	
	SetMapGoalProperties({"ATTACK.*", "DEFEND.*"}, {MinCampTime=30, MaxCampTime=60});

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


global InitializeRoutes = function()
{
	MapRoutes =
	{
		FLAG_axis_gold_crate =
		{
			ROUTE_AlSp =
			{
				ROUTE_door1 = {Weight=2},
				ROUTE_door2 = {},
			},
		},
		CAPPOINT_Gold =
		{
			ROUTE_Gold =
			{
				ROUTE_door1 = { Weight=2, ROUTE_South = {} },
				ROUTE_door2 = { ROUTE_North = {} },
			},
		},
	};
	Util.Routes(MapRoutes);
};
