game_manager
{
	spawn
	{

		remapshaderflush
		wm_axis_respawntime	8
		wm_allied_respawntime	8
		wm_set_round_timelimit	10

		wm_number_of_objectives 2

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

		// Winner on expiration of round timer (0=Axis, 1=Allies)
		wm_setwinner	0

		globalaccum 1 set 0 // casket is closed
		accum 1 set 0 // number of secured boxes

		wait 2000

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "ml_chapel_axis_gold_defend"

		wm_teamvoiceannounce 1 "ml_chapel_allies_gold_get"
		// *----------------------------------- vo ------------------------------------------*
	}

	trigger casket_open
	{
		wm_announce "The allies have opened the casket!"
	}

	trigger allied_win
	{
		accum 1 inc 1
		accum 1 abort_if_less_than 2

		wm_announce	"The allies have escaped with the gold!"
		wm_setwinner	1 // allies have won

		wait 1000

		wm_endround
	}

}

gold_destination
{
	death
	{
	}
}

casket_lid
{
	spawn
	{
		accum 3 set 0 		// acc 3 holds position of lid. 0 = closed all the way, 10 = open
		accum 4 set 0		// is currently moving?

		faceangles 0 0 0 3000  // reset to initial position
		gotomarker lid_01 100

		wait 100
	}

	trigger allied_push
	{
		accum 4 abort_if_equal 1	// lid is moving, do nothing
		trigger casket_lid allied_checkmove
	}

	trigger allied_checkmove
	{
		accum 4 set 1

		accum 3 trigger_if_equal 0 casket_lid position1
		accum 3 trigger_if_equal 1 casket_lid position2
		accum 3 trigger_if_equal 2 casket_lid position3
		accum 3 trigger_if_equal 3 casket_lid position4
		accum 3 trigger_if_equal 4 casket_lid position5
		accum 3 trigger_if_equal 5 casket_lid position6
		accum 3 trigger_if_equal 6 casket_lid position7
		accum 3 trigger_if_equal 7 casket_lid position8
		accum 3 trigger_if_equal 8 casket_lid position9
		accum 3 trigger_if_equal 9 casket_lid position10
	}

	trigger position1
	{
		alertentity casket_sound	// play push sound
		faceangles 0 -9 0 3000
		accum 3 set 1
		accum 4 set 0
	}

	trigger position2
	{
		alertentity casket_sound	// play push sound
		faceangles 0 -18 0 3000
		accum 3 set 2
		accum 4 set 0
	}

	trigger position3
	{
		alertentity casket_sound	// play push sound
		faceangles 0 -27 0 3000
		accum 3 set 3
		accum 4 set 0
	}

	trigger position4
	{
		alertentity casket_sound	// play push sound
		faceangles 0 -36 0 3000
		accum 3 set 4
		accum 4 set 0
	}

	trigger position5
	{
		alertentity casket_sound	// play push sound
		faceangles 0 -45 0 3000
		accum 3 set 5
		accum 4 set 0
	}

	trigger position6
	{
		alertentity casket_sound	// play push sound
		faceangles 0 -54 0 3000
		accum 3 set 6
		accum 4 set 0
	}

	trigger position7
	{
		alertentity casket_sound	// play push sound
		faceangles 0 -63 0 3000
		accum 3 set 7
		accum 4 set 0
	}

	trigger position8
	{
		alertentity casket_sound	// play push sound
		faceangles 0 -72 0 3000
		accum 3 set 8
		accum 4 set 0
	}

	trigger position9
	{
		alertentity casket_sound	// play push sound
		faceangles 0 -81 0 3000
		accum 3 set 9
		accum 4 set 0
	}

	trigger position10
	{
		alertentity casket_sound	// play push sound
		gotomarker lid_02 5 wait
		accum 3 set 10		// we're in position 10 now
		globalaccum 1 set 1 // casket is open!
		accum 4 set 0
		trigger game_manager casket_open
	}

}

goldbox_altar
{
	spawn
	{
		accum 0 set 0 // gold counter
	}

	trigger stolen
	{
		accum 0 inc 1
		accum 0 trigger_if_equal 1 goldbox_altar stolen1
		accum 0 trigger_if_equal 2 goldbox_altar stolen2
	}

	trigger captured
	{
		accum 0 trigger_if_equal 1 goldbox_altar secured1
		accum 0 trigger_if_equal 2 goldbox_altar secured2
	}

	trigger returned
	{
		accum 0 inc -1
		accum 0 trigger_if_equal 0 goldbox_altar returned1
		accum 0 trigger_if_equal 1 goldbox_altar returned2
	}

	trigger dropped
	{
		accum 0 trigger_if_equal 1 goldbox_altar dropped1
		accum 0 trigger_if_equal 2 goldbox_altar dropped2
	}

	trigger dropped1
	{
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "ml_chapel_axis_gold1_lost"

		wm_teamvoiceannounce 1 "ml_chapel_allies_gold1_lost"
		// *----------------------------------- vo ------------------------------------------*
	}

	trigger dropped2
	{
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "ml_chapel_axis_gold2_lost"

		wm_teamvoiceannounce 1 "ml_chapel_allies_gold2_lost"
		// *----------------------------------- vo ------------------------------------------*
	}

	trigger stolen1
	{
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "ml_chapel_axis_gold1_taken"

		wm_teamvoiceannounce 1 "ml_chapel_allies_gold1_taken"
		// *----------------------------------- vo ------------------------------------------*
	}

	trigger stolen2
	{
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "ml_chapel_axis_gold2_taken"

		wm_teamvoiceannounce 1 "ml_chapel_allies_gold2_taken"
		// *----------------------------------- vo ------------------------------------------*
	}

	trigger secured1
	{
		wm_announce "Allied team has secured the first Gold Crate!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "ml_chapel_axis_gold1_secured"

		wm_teamvoiceannounce 1 "ml_chapel_allies_gold1_secured"
		// *---------------------------------------------------------------------------------*

		trigger game_manager allied_win
	}

	trigger secured2
	{
		wm_announce "Allied team has secured the second Gold Crate!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "ml_chapel_axis_gold2_secured"

		wm_teamvoiceannounce 1 "ml_chapel_allies_gold2_secured"

		wm_removeteamvoiceannounce 0 "ml_chapel_axis_gold_defend"

		wm_removeteamvoiceannounce 1 "ml_chapel_allies_gold_defend"
		// *---------------------------------------------------------------------------------*

		trigger game_manager allied_win
	}

	trigger returned1
	{
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "ml_chapel_axis_gold1_returned"

		wm_teamvoiceannounce 1 "ml_chapel_allies_gold1_returned"
		// *----------------------------------- vo ------------------------------------------*
	}

	trigger returned2
	{
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "ml_chapel_axis_gold2_returned"

		wm_teamvoiceannounce 1 "ml_chapel_allies_gold2_returned"
		// *----------------------------------- vo ------------------------------------------*
	}
}
