// Ascend by [TFA]Violator

game_manager
{
  spawn
  {
  wm_axis_respawntime	 15
  wm_allied_respawntime 10

  wm_number_of_objectives 3

  // Objectives
  // 1: Get gold
  // 2: Get back to safe
  // 3: Command post

  wm_set_main_objective		1	0
  wm_set_main_objective		1	1

  wm_objective_status 1 0 0
  wm_objective_status 1 1 0
  wm_objective_status 2 0 0
  wm_objective_status 2 1 0
  wm_objective_status 3 0 0
  wm_objective_status 3 1 0

  // 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
 
  wait 2000

  wm_addteamvoiceannounce 1 vio1024run_allies_get_gourd
  wm_teamvoiceannounce 1 vio1024run_allies_get_gourd
  wm_addteamvoiceannounce 1 allies_hq_compost_construct
  wm_teamvoiceannounce 1 allies_hq_compost_construct

  wm_addteamvoiceannounce 0 vio1024run_axis_stair_destroy
  wm_teamvoiceannounce 0 vio1024run_axis_stair_destroy
  wm_addteamvoiceannounce 0 vio1024run_axis_defend_gourd
  wm_teamvoiceannounce 0 vio1024run_axis_defend_gourd
  wm_teamvoiceannounce 0 axis_hq_compost_construct
  wm_addteamvoiceannounce 0 axis_hq_compost_construct
  }

  trigger allies_win
  {
  wm_setwinner	1
  wm_announce "Allied team secured the Gourd!"
  wm_teamvoiceannounce 1 allies_hq_objective_secure
  wm_teamvoiceannounce 0 axis_hq_objective_lost

  wm_objective_status 2 0 2
  wm_objective_status 2 1 1

  wait 1500
  wm_endround
  }
}

// kill the LMS stuff
stair1_lms
{
  spawn
  {
    setstate stair1_lms invisible
  }
}

// lower staircase - Axis must destroy, allies must build to progress

stair1
{
	spawn 
	{
	wait 400
	trigger stair1 setup

        constructible_class 3
	}

	trigger setup
	{
   	setstate stair1_materials invisible
	setstate stair1_materials_clip invisible
	setstate stair1_flag invisible
	}

	buildstart final
	{
	setstate stair1_materials default
	setstate stair1_materials_clip default
	setstate stair1_flag default
	}

	built final
	{
   	setstate stair1_materials invisible
	setstate stair1_materials_clip invisible
	setstate stair1_flag invisible

	wm_announce "The lower staircase has been repaired"

	wm_teamvoiceannounce 1 "allies_hq_const_completed"
	wm_teamvoiceannounce 0 "axis_hq_const_completed"
	wm_removeteamvoiceannounce 1 vio1024run_allies_stair_build
	wm_addteamvoiceannounce 0 vio1024run_axis_stair_destroy
	// *----------------------------------- vo ------------------------------------------*
	// *---------------------------------------------------------------------------------*
	}

	decayed final
	{
   	setstate stair1_materials default
	setstate stair1_materials_clip default
	setstate stair1_flag default
	}

	death
	{
   	setstate stair1_materials default
	setstate stair1_materials_clip default
	setstate stair1_flag default

	wm_announce "The lower staircase has been destroyed!"

	wm_teamvoiceannounce 1 "allies_hq_const_destroyed"
	wm_teamvoiceannounce 0 "axis_hq_const_destroyed"
	wm_addteamvoiceannounce 1 vio1024run_allies_stair_build
	wm_removeteamvoiceannounce 0 vio1024run_axis_stair_destroy

	// *----------------------------------- vo ------------------------------------------*
	// *---------------------------------------------------------------------------------*
	}

	trigger remove
	{
		setstate stair1_toi invisible
		setstate stair1_materials invisible
		setstate stair_materials_clip invisible
		setstate stair1_flag invisible

		remove
	}
}

stair1_toi
{
}

// 'give me your gold...'

gourd_holder
{
  death
  {
  trigger game_manager allies_win
  }
}

  //////////////////
 // Command post //
//////////////////

neutral_cp_toi
{
	spawn
	{
		wait 50
		accum 0 set 0	// 0=Neutral Closed, 1=Allied Damaged, 2=Axis Damaged

		trigger self show_previous_cabinet		// Setup teamdoors and correct cabinet
	}

	trigger set_alliedcabinet
	{
		accum 0 set 1			// Allied has been cabinet built
	}

	trigger set_axiscabinet
	{
		accum 0 set 2			// Axis has been cabinet built
	}

	trigger show_previous_cabinet			// Show correct CP state
	{
		accum 0 trigger_if_equal 0 neutral_cp_toi show_neutral_cabinet
		accum 0 trigger_if_equal 1 neutral_cp_toi show_allied_cabinet
		accum 0 trigger_if_equal 2 neutral_cp_toi show_axis_cabinet
	}

	trigger show_neutral_cabinet			// Neutral Closed CP
	{
		setstate neutral_cp_closed default
		setstate neutral_cp_closed_model default
	}

	trigger show_allied_cabinet			// Allied damaged CP
	{
		setstate allied_cp_damaged default
		setstate allied_cp_damaged_model default
	}

	trigger show_axis_cabinet			// Axis damaged CP
	{
		setstate axis_cp_damaged default
		setstate axis_cp_damaged_model default
	}

	trigger hide_all_cabinet			// Hide all previous CP states
	{
		setstate neutral_cp_closed invisible
		setstate neutral_cp_closed_model invisible
		setstate allied_cp_damaged invisible
		setstate allied_cp_damaged_model invisible
		setstate axis_cp_damaged invisible
		setstate axis_cp_damaged_model invisible
	}
}

// ================================================
allied_cp_open
{
	spawn
	{
		wait 100
		constructible_class 2			// Dyno+Satchel

		setstate allied_cp_damaged invisible	// Hide damaged CP model+clip
		setstate allied_cp_damaged_model invisible
		trigger self disable_cp_features		// Default charge bar times
	}

	trigger disable_cp_features
	{
		setstate allied_cp_open_model invisible	// Hide Open CP model

		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1

		sethqstatus 1 0			// Landmines team warning message
		disablespeaker allied_cp_sound		// Disable morse code sound
	}

	trigger enable_cp_features
	{
		setstate allied_cp_open_model default	// Show open CP model

		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			// Landmines team warning message
		enablespeaker allied_cp_sound		// Enable morse code sound
	}

	buildstart final
	{
		trigger neutral_cp_toi hide_all_cabinet	// Hide all previous cabinet states
	}

	built final
	{
		trigger neutral_cp_toi set_alliedcabinet	// Allied cabinet has been built
		trigger self enable_cp_features		// Increase charge bar times

		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"
		// *----------------------------------- vo ------------------------------------------*
	}

	decayed final
	{
		setstate allied_cp_open_model invisible	// Hide Open CP model
		trigger neutral_cp_toi show_previous_cabinet	// Show previous cabinet state
	}

	death
	{
		trigger neutral_cp_toi show_previous_cabinet	// Show damaged cabinet state
		trigger self disable_cp_features		// Default charge bar times

		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"
		// *----------------------------------- vo ------------------------------------------*
	}
}

// ================================================
axis_cp_open
{
	spawn
	{
		wait 100
		constructible_class 2			// Dyno+Satchel

		setstate axis_cp_damaged invisible	// Hide damaged CP model+clip
		setstate axis_cp_damaged_model invisible
		trigger self disable_cp_features		// Default charge bar times
	}

	trigger disable_cp_features
	{
		setstate axis_cp_open_model invisible	// Hide Open CP model

		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1

		sethqstatus 0 0			// Landmines team warning message
		disablespeaker axis_cp_sound		// Disable morse code sound
	}

	trigger enable_cp_features
	{
		setstate axis_cp_open_model default	// Show open CP model

		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			// Landmines team warning message
		enablespeaker axis_cp_sound		// Enable morse code sound
	}

	buildstart final
	{
		trigger neutral_cp_toi hide_all_cabinet	// Hide all previous cabinet states
	}

	built final
	{
		trigger neutral_cp_toi set_axiscabinet	// Allied cabinet built
		trigger self enable_cp_features		// Increase charge bar times

		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"
		// *----------------------------------- vo ------------------------------------------*
	}

	decayed final
	{
		setstate axis_cp_open_model invisible	// Hide Open CP model
		trigger neutral_cp_toi show_previous_cabinet	// Show previous cabinet state
	}

	death
	{
		trigger neutral_cp_toi show_previous_cabinet	// Show damaged cabinet state
		trigger self disable_cp_features		// Default charge bar times

		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"
		// *----------------------------------- vo ------------------------------------------*
	}
}

