//==========================================================================================
//
//	generator_b3.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	Wolf Enstein	10 August 2018	Initial Script
//	palota	30 June 2025
//==========================================================================================
//

global Map =
{
	Allied_Command_Post_Built = function()
	{
		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

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

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

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

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

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

	Door_1_Destroyed = function()
	{
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Flag.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"BUILD_Axis_Team_Door",
			"BUILD_Axis_Command_Post",
			"SNIPE_Tower",
			"MOBILEMG42_Main_Base",
			"DEFEND_Base.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"SWITCH_Tram.*",
			"SNIPE_Trambay.*",
			"DEFEND_Tram.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ARTILLERY_S_Axis_Wall",
			"CALLARTILLERY_bank",
			"PLANT_Door_2",
		});
		
		//selfkill for change spawnpoint
		ETUtil.SuicideSpawn( TEAM.ALLIES, 0 );

		Util.MapDebugPrint( "Door_1_Destroyed" );
	},

	Door_2_Destroyed = function()
	{

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"BUILD_Allied_Command_Post",
			"PLANT_Bunker_Door",
			"DEFEND_Approach.*",
			"PLANT_Axis_Team_Door",
		});

		Util.MapDebugPrint( "Door_2_Destroyed" );
	},

	You_are_near_Axis_Wall_Destroyed = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_Wall_2" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Axis_Wall_1" );

		Util.MapDebugPrint( "You_are_near_Axis_Wall_Destroyed" );
	},

	You_are_near_Axis_Wall_2_Destroyed = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Axis_Wall_2" );

		Util.MapDebugPrint( "You_are_near_Axis_Wall_2_Destroyed" );
	},

	You_are_near_Bunker_Door_Destroyed = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"PLANT_Generator",
			"PLANT_Axis_Wall_1",
			"SNIPE_cp.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ARTILLERY_S_Axis_Wall",
			"CALLARTILLERY_bank",
			"PLANT_Bunker_Door",
			"DEFEND_Approach.*",
			"PLANT_Axis_Team_Door",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Base.*",
			"BUILD_Axis_Team_Door",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Generator.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"DEFEND_Plant.*",
			"DEFEND_Generator_[23]",
		});

		Util.MapDebugPrint( "You_are_near_Bunker_Door_Destroyed" );
	},

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

	forwardspawn1_flag_Axis_Captured = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Tram_Area.*");

		Util.MapDebugPrint( "forwardspawn1_flag_Axis_Captured" );
	},

	forwardspawn1_flag_Allies_Captured = function()
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_Tram_Area.*");

		Util.MapDebugPrint( "forwardspawn1_flag_Allies_Captured" );
	},
};

global OnMapLoad = function()
{
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "^kAxis Team have built a team door!!", Map.Axis_Team_Door_Built );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "Allies have destroyed the Axis team door!!", Map.Axis_Team_Door_Destroyed );
	OnTrigger( "^1 Door One Destroyed!", Map.Door_1_Destroyed );
	OnTrigger( "^1 Door Two Destroyed!", Map.Door_2_Destroyed );
	OnTrigger( "^2The alliens team has destroyed the Wall1!", Map.You_are_near_Axis_Wall_Destroyed );
	OnTrigger( "^1The alliens team has destroyed the Wall2!", Map.You_are_near_Axis_Wall_2_Destroyed );
	OnTrigger( "^1 The alliens team has destroyed the Bunker Door!", Map.You_are_near_Bunker_Door_Destroyed );
	OnTrigger( "^1Axis reclaim the Forward Spawn!", Map.forwardspawn1_flag_Axis_Captured );
	OnTrigger( "^3Allies capture the Forward Spawn!", Map.forwardspawn1_flag_Allies_Captured );

	Util.DisableGoal( ".*", true );
	Util.EnableGoal({
		"AMMOCAB.*",
		"HEALTHCAB.*",
		"CHECKPOINT_forwardspawn1_flag",
	});
	SetAvailableMapGoals(TEAM.AXIS, true, {
		"BUILD_Axis_Command_Post",
		"DEFEND_Flag.*",
	});
	SetAvailableMapGoals(TEAM.ALLIES, true, {
		"DEFEND_Tram.*",
		"PLANT_Door_1",
		"SNIPE_Trambay.*",
		"SWITCH_Tram.*",
	});

	SetGoalPriority("PLANT_Axis_Wall_1", 0.9);
	SetGoalPriority("PLANT_Bunker_Door", 0.9);
	SetGoalPriority("PLANT_Generator", 0.9);
	SetGoalPriority("PLANT_Axis_Wall_2", 0.9);

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

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

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