//
//Brush Scripting
//Map: pha_chateau
//Last edited by: Brandon/RiFFLeR
//

game_manager
{
	spawn
	{
		// Set scenario information

		//wm_mapdescription			"The Axis have taken over a Chateau and are using it as a base of operations. Deep within the library of the Chateau are secret documents. The Allies need to steal those documents and transmit them as soon as possible!\n\nET Version By : \nRiFFLeR\SCORPION\n\nWWW.PHACLAN.COM"
		wm_axis_respawntime		20
		wm_allied_respawntime		15
		wm_set_round_timelimit	20

		wm_number_of_objectives		5

		// Set objective #1 properties

		// Nazi's control objective #1 at the start:  0 == AXIS, 1 == ALLIED

		wm_objective_status		1	0 	0  // The door and cellar
		wm_objective_status		1	1 	0  // The door and cellar

		//wm_objective_axis_desc		1	"Primary Objective:**Defend the Chateau."
		//wm_objective_allied_desc	1	"Primary Objective:**Break into the Chateau."

		wm_objective_status		2	0 	0// The Documents
		wm_objective_status		2	1	0 // The Documents

//		wm_objective_axis_desc		2	"Primary Objective:**Prevent Allies from stealing top secret war documents."
//		wm_objective_allied_desc	2	"Primary Objective:**Steal the top secret Axis war documents."

		wm_objective_status		3	0	0 // The transmitter trigger
		wm_objective_status		3	0	0 // The transmitter trigger

//		wm_objective_axis_desc		3	"Primary Objective:**Do not let the Allies transmit the Top Secret Documents!"
//		wm_objective_allied_desc	3	"Primary Objective:**Transmit the Top Secret Documents!"

		wm_objective_status		4	0     0 // Respawn Flag
		wm_objective_status		4	1     0

//		wm_objective_axis_desc		4 	"Secondary Objective:**Do not let the Allies capture the Grand Staircase."
//		wm_objective_allied_desc	4	"Secondary Objective:**Capture the Grand Staircase for Forward Deployment!"

		wm_objective_status		5	0     0 // Respawn Flag
		wm_objective_status		5	1     0


//		wm_objective_short_axis_desc	1	"Defend the Chateau"
//		wm_objective_short_axis_desc	2	"Defend the Top Secret Documents"
//		wm_objective_short_axis_desc	3	"Stop the Allies from transmitting"
//		wm_objective_short_axis_desc	4	"Hold the Grand Staircase"

//		wm_objective_short_allied_desc	1	"Break into the Chateau"
//		wm_objective_short_allied_desc	2	"Steal the Top Secret Documents"
//		wm_objective_short_allied_desc	3	"Transmit the Top Secret Documents"
//		wm_objective_short_allied_desc	4	"Capture the Grand Staircase"

		// Videos and Shots

		//wm_objective_image			1	"gfx/2d/mp_objectives/ice_obj_1.tga"
		//wm_objective_image			2	"gfx/2d/mp_objectives/ice_obj_2.tga"
		//wm_objective_image			3	"gfx/2d/mp_objectives/ice_obj_3.tga"
		//wm_objective_image			4	"gfx/2d/mp_objectives/checkpoint_obj.tga"

		//wm_overview_image			"levelshots/mp_ice.tga"

		wait 200
		setautospawn  "Axis East Spawns" 0
		//setstate chateauspawn invisible

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

		// Accum #1 will be the state of objective number one
		// Accum #2 will be the state of objective number two
		accum 1 set 0

		wait 1000

		wm_addteamvoiceannounce 0 "radar_axis_entrances_defend"
		wm_teamvoiceannounce 0 "radar_axis_entrances_defend"

		wm_addteamvoiceannounce 1 "radar_allies_entrances_destroy"
		wm_teamvoiceannounce 1 "radar_allies_entrances_destroy"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"
		wm_teamvoiceannounce 1 "allies_hq_compost_construct"

		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"
		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

	}

	trigger objective1
	{
		// Change the objective state internally, so UI can update, etc.
		// Allied takes control of objective #1
		wm_objective_status		1	0	2
		wm_objective_status		1	1	1

		// Some kind of UI pop-up to alert players
		wm_announce	"Allies have gained entry into the Chateau."
		wm_teamvoiceannounce 0 "radar_axis_entrance1_destroyed"
		wm_teamvoiceannounce 1 "radar_allies_entrance1_destroyed"

	}

	trigger objective2
	{
		// Change the objective state internally, so UI can update, etc.
		// Allied takes control of objective #3
		wm_objective_status		3	1	1
		wm_objective_status		3	0	2

		// Change the variable within the script so that we can check if someone wins the round
		accum 1 set 1

		// Some kind of UI pop-up to alert players
		wm_announce	"Allies have transmitted the Top Secret Documents!"
		wm_teamvoiceannounce 1 "allies_hq_objective_captured"
		wm_teamvoiceannounce 0 "axis_hq_objective_lost"
		// Call function to check if the round has been won
		trigger game_manager checkgame
	}

	trigger checkgame
	{
		accum 1 abort_if_not_equal 1

		// Set the round winner:  0 == AXIS, 1 == ALLIED
		wm_setwinner 1

		// End the round
		wm_endround
	}

	trigger axis_object_stolen
	{
		// Change the objective state internally, so UI can update, etc.
		// Allied have stolen the SoD (0 == AXIS, 1 == ALLIED)
		wm_objective_status		2	1	1
		wm_objective_status		2	0	2
	}

	trigger axis_object_returned
	{
		// Change the objective state internally, so UI can update, etc.
		// Axis have returned the SoD (0 == AXIS, 1 == ALLIED)
		wm_objective_status		2	0	1
		wm_objective_status		2	1	0

		wm_teamvoiceannounce 1 "allies_hq_objective_lost"
	}

	// Respawn Flag Info

	trigger chateau_flagblue
	{
		// Change the objective state internally, so UI can update, etc.
		// Allied takes control of checkpoint #1
		wm_objective_status		4	1	1
		wm_objective_status		4	0	2

		// Some kind of UI pop-up to alert players
		wm_announce	"Allies capture the Grand Staircase!"
		//setstate chateauspawn default
		wait 100
		alertentity stairs_reinforce
		setautospawn "Downstairs" 1
		setautospawn "Axis West Spawns" 0
		

	}

	trigger chateau_flagred
	{
		// Change the objective state internally, so UI can update, etc.
		// Axis takes control of checkpoint #1
		wm_objective_status		4	0	1
		wm_objective_status		4	1	2

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis reclaims the Grand Staircase!"
		wait 100
		setautospawn "Axis East Spawns" 0
		setautospawn "Allied Court Spawn" 1
		//setstate chateauspawn invisible
	}
}

flag_respawn_obj
{
	trigger axis_capture
	{
		trigger game_manager chateau_flagred
	}

	trigger allied_capture
	{
		
		setstate chateauspawn default
		wait 100
		alertentity stairs_reinforce
		setautospawn "Downstairs" 1
		trigger game_manager chateau_flagblue
	}
}

allied_trigger01
{
	spawn
	{
	}

	death
	{
		trigger game_manager objective2
	}
}

Main_Door //The Chateau Doors
{
	spawn
	{
	wait 200
	constructible_class 3
	}

	death
	{
		trigger game_manager objective1
	}
}

Cellar_Door //The Chateau Doors
{
	spawn
	{
	wait 200
	constructible_class 3
	}

	death
	{
		trigger game_manager objective1
	}
}

secret_bookcase // Hidden Bookcase
{
	spawn
	{
		trigger secret_bookcase setup
	}

	trigger setup
	{
		faceangles 0 -60 0 1000
	}

	death
	{
	}
}

// OBJ to REMOVE

checkpoint01
{
	spawn
	{
		remove
	}
}

checkpoint02
{
	spawn
	{
		remove
	}
}

checkpoint03
{
	spawn
	{
		remove
	}
}

checkpoint01_base
{
	spawn
	{
		remove
	}
}

checkpoint02_base
{
	spawn
	{
		remove
	}
}

checkpoint03_base
{
	spawn
	{
		remove
	}
}


// ================================================
// ============ NEUTRAL COMMAND POST ==============
// ================================================

allied_compost_built
{
	spawn
	{
		wait 400
		trigger allied_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0
	}

	buildstart final
	{
		setstate allied_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate allied_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger allied_compost_built_model enable_allied_features

		enablespeaker allies_compost_sound
	}

	decayed final
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger allied_compost_built_model disable_allied_features

		disablespeaker allies_compost_sound
	}
}

allied_compost_built_model
{
	spawn
	{
		wait 400
		setstate allied_compost_built_model invisible
	}

	trigger enable_allied_features
	{
		setchargetimefactor 1 soldier 0.75
		setchargetimefactor 1 lieutenant 0.75
		setchargetimefactor 1 medic 0.75
		setchargetimefactor 1 engineer 0.75
		setchargetimefactor 1 covertops 0.75
		sethqstatus 1 1

		wm_announce	"Allied Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

		wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*
		//setstate alliedspawn2 default
		//setautospawn 	"At the Pyramide Entrance" 	1
		//wm_allied_respawntime 16
		//wm_axis_respawntime 18
		wm_objective_status 5 0 2
		wm_objective_status 5 1 1
	}

	trigger disable_allied_features
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0

		wm_announce	"Axis team has destroyed the Allied Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 5 0 0
		wm_objective_status 5 1 0

		//setstate alliedspawn2 invisible
		//setautospawn 	"At the Ruin" 	1

		//wm_allied_respawntime 20
		//wm_axis_respawntime 20


	}
}

axis_compost_built
{
	spawn
	{
		wait 400
		trigger axis_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0
	}

	buildstart final
	{
		setstate axis_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate axis_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger axis_compost_built_model enable_axis_features

		enablespeaker axis_compost_sound
	}

	decayed final
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger axis_compost_built_model disable_axis_features

		disablespeaker axis_compost_sound
	}
}

axis_compost_built_model
{
	spawn
	{
		wait 400
		setstate axis_compost_built_model invisible
	}

	trigger enable_axis_features
	{
		setchargetimefactor 0 soldier 0.75
		setchargetimefactor 0 lieutenant 0.75
		setchargetimefactor 0 medic 0.75
		setchargetimefactor 0 engineer 0.75
		setchargetimefactor 0 covertops 0.75
		sethqstatus 0 1

		wm_announce	"Axis Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

		wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 5 0 1
		wm_objective_status 5 1 2

		//wm_allied_respawntime 20
		//wm_axis_respawntime 18

	}

	trigger disable_axis_features
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0

		wm_announce	"Allied team has destroyed the Axis Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_damaged"

		wm_teamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 5 0 0
		wm_objective_status 5 1 0
		//wm_allied_respawntime 20
		//wm_axis_respawntime 20
	}
}
