//==========================================================================================
//
//	caha_tavern_b1.gm
//
//	Who	When		What
//------------------------------------------------------------------------------------------
//	MickyP	10 January 2011	Initial Script
//
//==========================================================================================
//

global Map =
{

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

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

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

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

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

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

	PLANT_1st_Floor_ladder_Destroyed = function( trigger )
	{
		Util.MapDebugPrint( "1st_Floor_ladder_Destroyed" );
	},

	PLANT_3rd_Floor_ladder_Destroyed = function( trigger )
	{
		Util.MapDebugPrint( "3rd_Floor_ladder_Destroyed" );
	},

	PLANT_4th_Floor_ladder_Destroyed = function( trigger )
	{
		Util.MapDebugPrint( "4th_Floor_ladder_Destroyed" );
	},

	Cellar_Wall_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_Fake.*" );
		Util.MapDebugPrint( "Cellar_Wall_Destroyed" );
	},

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	Security_Power_disabled = function( trigger )
	{
		sleep(6);
		Wp.SetWaypointFlag( "LockDoor", "closed", false );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Cellar_Wall" );

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

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "Axis team has built the ^31st. ^7Floor ladder!", Map.BUILD_1st_Floor_ladder_Built );
	OnTrigger( "Axis team has built the ^x3rd. ^7Floor ladder!", Map.BUILD_3rd_Floor_ladder_Built );
	OnTrigger( "Axis team has built the ^14th. ^7Floor ladder!", Map.BUILD_4th_Floor_ladder_Built );
	OnTrigger( "Allied team has built the ^xStairs Wall^7!", Map.Stairs_Wall_Built );
	OnTrigger( "MISSING_STRING", Map.Stairs_Wall_1_Built );
	OnTrigger( "Allied team has built the ladder ^xFence^7!", Map.ladder_Fence_Built );
	OnTrigger( "Allied team has destroyed the ^31st. ^7Floor ladder!", Map.PLANT_1st_Floor_ladder_Destroyed );
	OnTrigger( "Allied team has destroyed the ^x3rd. ^7Floor ladder!", Map.PLANT_3rd_Floor_ladder_Destroyed );
	OnTrigger( "Allied team has destroyed the ^14th. ^7Floor ladder!", Map.PLANT_4th_Floor_ladder_Destroyed );
	OnTrigger( "^1Objective Info: ^7Axis have breached the Cellar Wall!", Map.Cellar_Wall_Destroyed );
	OnTrigger( "^1Objective Info: ^7Axis have destroyed the Power Generator A!", Map.Security_Power_Generator_Destroyed );
	OnTrigger( "^1Objective info: ^7Axis has blown up the Power Generator B!", Map.Security_Power_Generator_B_Destroyed );
	OnTrigger( "Axis team has destroyed the ^xStairs Wall^7!", Map.Stairs_Wall_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Stairs_Wall_1_Destroyed );
	OnTrigger( "Axis team has destroyed the ladder ^xFence^7!", Map.ladder_Fence_Destroyed );
	OnTrigger( "MISSING_STRING", Map.Spy_Lists_Taken );
	OnTrigger( "MISSING_STRING", Map.Spy_Lists_Returned );
	OnTrigger( "Axis team has escaped with the Spy Lists!", Map.Spy_Lists_Secured );
	OnTrigger( "Axis capture the ^31st ^7Floor Spawn!", Map.floor1_Axis_Captured );
	OnTrigger( "Allies reclaim the ^31st ^7Floor Spawn!", Map.floor1_Allies_Captured );
	//Axis now own the ^31st. ^7Floor spawn!
	OnTrigger( "Axis capture the ^a2nd ^7Floor Spawn!", Map.floor2_Axis_Captured );
	OnTrigger( "Allies reclaim the ^a2nd ^7Floor Spawn!", Map.floor2_Allies_Captured );
	//Axis now own the ^a2nd. ^7Floor spawn!
	OnTrigger( "Axis capture the ^x3rd ^7Floor Spawn!", Map.floor3_Axis_Captured );
	OnTrigger( "Allies reclaim the ^x3rd ^7Floor Spawn!", Map.floor3_Allies_Captured );
	//Axis now own the ^x3rd. ^7Floor spawn!
	OnTrigger( "Axis capture the ^14th ^7Floor Spawn!", Map.floor4_Axis_Captured );
	OnTrigger( "Allies reclaim the ^14th ^7Floor Spawn!", Map.floor4_Allies_Captured );
	//Axis now own the ^14th. ^7Floor spawn!

	OnTrigger( "Allied spawntime changed to 20 seconds.", Map.Security_Power_disabled );
	//~Util.DisableGoal( ".*", true ); // all but routes
	//~SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_.*" );
	//~SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_.*" );

	Wp.SetWaypointFlag( "LockDoor", "closed", true );
	SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Cellar_Wall" );

	SetGoalPriority( "CAPPOINT_Fake", 0.8, TEAM.AXIS);

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

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


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