//==========================================================================================
//
//	katamari.gm
//
//	Who	When		What
//------------------------------------------------------------------------------------------
//	palota	16 April 2012	Initial Script
//
//==========================================================================================
//

global Map =
{
	Debug = 0,

	Roles =
	{
		ALLIES =
		{
			DEFENDER1 =
			{
				numbots = 5,
			},
			DEFENDER2 =
			{
				numbots = 2,
				spawnpt = 4,
			},
		}
	},

	SetFlags = function (b)
	{
		goals = Util.GoalTable("FLAG.*");
		foreach(g in goals)
		{
			pos = g.GetPosition();
			y = 1000;
			if(pos.x > 2700){ y = 333; }
			if(pos.y > y){
				g.SetAvailable(TEAM.AXIS, b);
			}
		}
	},

	PartTwo = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_u.*" );
		SetGoalRole( "DEFEND_l.*", ROLE.DEFENDER1 );
		Map.SetFlags(true);
		Util.MapDebugPrint( "PartTwo" );
	},
};

global OnMapLoad = function()
{
	OnTrigger( "Asoko kara Susumeru mitai dazo.", Map.PartTwo );

	SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND.*" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "DEFEND_u.*" );
	Map.SetFlags(false);

	ClearGoalRole( "DEFEND_l.*", ROLE.DEFENDER1 );

	Util.SetMaxUsers( 1, ".*" );

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