//
//Brush Scripting
//Map: game_manager
//Last edited by: Marko  http://markoweb.free.fr
//

game_manager
{
	spawn
	{
		accum 1 set 0		
		accum 2 set 0	
		accum 3 set 2	

		// Game rules
		wm_axis_respawntime	15
		wm_allied_respawntime	13
		wm_number_of_objectives 3
		wm_set_round_timelimit	16

		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_set_main_objective		3	0
		wm_set_main_objective		3	1

		// Objective overview status indicators
		//wm_objective_status <objective> <team (0=Axis, 1=Allies)> <status (0=neutral 1=complete 2=failed)>
		wm_objective_status 1 1 0
		wm_objective_status 1 0 0
		wm_objective_status 2 1 0
		wm_objective_status 2 0 0
		wm_objective_status 3 1 0
		wm_objective_status 3 0 0

		
		
		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	0

		// If the round timer expires, the Axis have won, so set the current winning team
		// Set the round winner:  0 == AXIS, 1 == ALLIED
		wm_setwinner -1


	}


	trigger objective1
	{
		wm_objective_status 		1 0 1
		wm_announce	"Axis have destroyed the bridge"
		accum 2 set 1
		trigger game_manager checkgame2
	}

	
	trigger objective2
	{
		wm_objective_status 		3 1 1
		wm_announce	"Allies have destroyed the gas tank"
		accum 1 set 1
		trigger game_manager checkgame
	}


	trigger checkgame
	{
		accum 1 abort_if_not_equal 1
		wm_setwinner 1
		wait 1500
		wm_endround
	}

	trigger checkgame2
	{
		accum 2 abort_if_not_equal 1
		wm_setwinner 0
		wait 1500
		wm_endround
	}

	trigger al
	{
		accum 3 abort_if_not_equal 2
		alertentity axisspawn
		accum 3 set 0
	}

	trigger ax
	{
		accum 3 abort_if_not_equal 2
		alertentity alliedspawn
		accum 3 set 1
	}


	trigger beach_flagblue
	{
		trigger game_manager al

		wm_objective_status 		2 1 1
		wm_objective_status 		2 0 0
		
		accum 3 abort_if_not_equal 0

		alertentity alliedspawn
		alertentity axisspawn
		wm_announce	"Allies capture the forward spawn!"
		accum 3 set 1
	}
	
	trigger beach_flagred
	{
		trigger game_manager ax

		wm_objective_status 		2 0 1
		wm_objective_status 		2 1 0

		accum 3 abort_if_not_equal 1

		wm_announce	"Axis capture the forward spawn!"
		alertentity alliedspawn
		alertentity axisspawn
		accum 3 set 0
	}


}

bridge
{
	spawn
	{
		wait 200

		constructible_class 3
	}

	death
	{
		
		trigger game_manager objective1
	}
}

wagon
{
	spawn
	{
		wait 200

		constructible_class 3
	}

	death
	{
		trigger game_manager objective2
	}
}

gate1
{
	spawn
	{
		wait 200

		constructible_class 3
	}

	death
	{
		wm_announce	"Allies have breached the trainyard buildings gate!"

	}
}

gate2
{
	spawn
	{
		wait 200

		constructible_class 3
	}

	death
	{
		wm_announce	"Axis have breached the river buildings gate!"

	}
}



oldcityflag
{
	trigger axis_capture
	{
		trigger game_manager beach_flagred
	}

	trigger allied_capture
	{
		trigger game_manager beach_flagblue
	}
}
