game_manager
{
  spawn
  {
  wm_axis_respawntime 20
  wm_allied_respawntime 10
  wm_number_of_objectives 7
  wm_set_round_timelimit 20
  
    // Objectives
    // Mainbunkergate
    //1: Mainbunkergate
    //2: Mobiles Emitterparts
    //3: Main Antenna
    //4: Forwardbunker
    //5: Sidewall
    //6: Command Post
    
    
    
    
    
    
    // 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
    wm_objective_status 4 1 0
    wm_objective_status 4 0 0
    wm_objective_status 5 1 0
    wm_objective_status 5 0 0
    wm_objective_status 6 1 0
    wm_objective_status 6 0 0
    wm_objective_status 7 1 0
    wm_objective_status 7 0 0
    
    //Main Objectives
    wm_set_main_objective		1	0
	wm_set_main_objective		1	1
  	
    
    // 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 500
	setautospawn	"Forward Bunker"	0
	setautospawn	"Forrest Hut"		1
	
	
		
	// wait for everything to settle
	wait 500
	
	// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "wr_axis_entrances_defend"
		wm_addteamvoiceannounce 0 "wr_axis_bunker_stop"
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "wr_allies_entrances_destroy"
		wm_addteamvoiceannounce 1 "wr_allies_bunker_capture"
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "wr_axis_entrances_defend"
		wm_teamvoiceannounce 0 "wr_axis_bunker_stop"
		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 1 "wr_allies_entrances_destroy"
		wm_teamvoiceannounce 1 "wr_allies_bunker_capture"
		// *---------------------------------------------------------------------------------*
   
   // 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 0
     	
  }
  
  trigger stolen_circuit
	{
		accum 1 inc 1						// One circuit board home
		trigger game_manager checkgame		// Check for end of game
		
	}
  
	
	trigger mainbunker_gate_destroyed
	{
		wm_objective_status 1 1 1
		wm_objective_status 1 0 2

		wm_set_main_objective		2	0
		wm_set_main_objective		2	1

		
		//alertentity forwardbunker_wobj		// Tank Depot team_WOLF_objective
		
		setautospawn "Lower Bunker" 0
		setautospawn "Forward Bunker" 1
		

		trigger forwardbunker_flag kill // Switch forward spawn to Allied ONLY
		wm_announce	"^1Allies have breached the Main Entrance and secured the Forward Bunker!"

		// *----------------------------------- vo ------------------------------------------*
		
		wm_teamvoiceannounce 0 "wr_axis_entrance1_destroyed"
		wm_teamvoiceannounce 0 "wr_axis_radars_defend"

		wm_teamvoiceannounce 1 "wr_allies_entrance1_destroyed"
		wm_teamvoiceannounce 1 "wr_allies_radars_steal"

		wm_removeteamvoiceannounce 0 "wr_axis_entrances_defend"
		wm_removeteamvoiceannounce 0 "wr_axis_entrance1_defend"
		wm_removeteamvoiceannounce 0 "wr_axis_bunker_stop"

		wm_removeteamvoiceannounce 1 "wr_allies_entrances_destroy"
		wm_removeteamvoiceannounce 1 "wr_allies_entrance1_destroy"
		wm_removeteamvoiceannounce 1 "wr_allies_bunker_capture"
		
		// *---------------------------------------------------------------------------------*
		
		enablespeaker depotalarm1
		
		wait 1000

		
	}
  
  
  trigger checkgame
	{
		accum 1 abort_if_not_equal 3
		wait 1500
		wm_announce "Allies successfully stolen the Emitters and destroy the Main Radio Mast!"
		
		wm_setwinner 1
		
		wm_endround
	} 
}

//************************************************************************************************
//			FORWARD BUNKER FLAG
//************************************************************************************************
forwardbunker_flag
{
	spawn
	{
		accum 0 set 0	// 0-Axis, 1-Allied
	}

	trigger axis_capture	// Flag has been claimed by an axis player
	{
		accum 0 abort_if_equal 0 // Do Axis already own the flag?

		accum 0 set 0 // Axis own the flag
		wm_announce	"Axis reclaim the Forward Bunker!"


		wm_objective_status 4 1 2
		wm_objective_status 4 0 1

		
		setautospawn "Forrest Hut" 1
		setautospawn "Forward Bunker" 0

		alertentity forwardbunker_wobj
		alertentity forwardbunker_spawn
		
		
		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "wr_axis_bunker_stop"

		wm_addteamvoiceannounce 1 "wr_allies_bunker_capture"

		wm_teamvoiceannounce 0 "wr_axis_bunker_reclaimed"

		wm_teamvoiceannounce 1 "wr_allies_bunker_reclaimed"

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

	trigger allied_capture	// Flag has been claimed by an allied player
	{
		accum 0 abort_if_equal 1 // Do Allies already own flag?

		accum 0 set 1 // Allied own the flag
		

		wm_objective_status 4 1 1
		wm_objective_status 4 0 2

		
		setautospawn "Forward Bunker" 	1
		setautospawn "Lower Bunker" 	0

		alertentity forwardbunker_wobj
		alertentity forwardbunker_spawn
		
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "wr_axis_bunker_captured"

		wm_teamvoiceannounce 1 "wr_allies_bunker_captured"

		wm_removeteamvoiceannounce 0 "wr_axis_bunker_stop"

		wm_removeteamvoiceannounce 1 "wr_allies_bunker_capture"
			
		// *---------------------------------------------------------------------------------*
	}

	trigger kill
	{
		trigger forwardbunker_flag force_allied
		remove
	}

	trigger force_allied
	{
		accum 0 abort_if_equal 1 // Do Allies already own flag?

		wm_objective_status 4 1 1
		wm_objective_status 4 0 2

		setautospawn "Forward Bunker" 1
		setautospawn "Lower Bunker" 0

		alertentity forwardbunker_wobj
		alertentity forwardbunker_spawn
	}

}
// END FORWARD FLAG








//Forwardbunkerdoor
forwardbunkerdoor	
{
  spawn
  {
  wait 200
  constructible_class 3
  }
  
  death
  {
  wm_announce "^1The Allies breach the Forwardbunkerdoor!"
  
  }
  
  
}


//Mainbunkergate
mainbunker_gate
{
  spawn
  {
  
  wait 200
  constructible_class 3
  
  }
  
  death
  {
  trigger game_manager mainbunker_gate_destroyed	  
  }
  
  
}

//Radiomast
radio_mast
{
  spawn
  {
  
  wait 200
  constructible_class 3
  }
  
  death
  {
  wm_announce	"^1Allies have destroyed the Main Radio Mast!"
  // *----------------------------------- vo ------------------------------------------*
	wm_teamvoiceannounce 0 "wr_axis_obj_destroyed"
  	wm_teamvoiceannounce 1 "wr_allies_obj_destroyed"
  		
  // *---------------------------------------------------------------------------------*
  wm_objective_status 3 1 1
  wm_objective_status 3 0 2
  trigger game_manager stolen_circuit //check if Emitters also stolen
  
  }
}


//Sidewall
sidewall
{
  spawn
  {
  	  
  wait 200
  constructible_class 3
  }
  
  death
  {
  wm_announce "^1The Allies have breached the Sidewall!"
  enablespeaker alarmspeaker	// Base Alarm
  wm_set_main_objective		2	0
  wm_set_main_objective		2	1
  
  wm_objective_status 		5 1 1
  wm_objective_status 		5 0 2
  // *----------------------------------- vo ------------------------------------------*
	
	
  	wm_teamvoiceannounce 0 "wr_axis_wall_destroyed"
  	wm_teamvoiceannounce 1 "wr_allies_wall_destroyed"
  		
  // *---------------------------------------------------------------------------------*
  
  }
  
  
}

//Bunker Sidewall
bunkersidewall
{
  spawn
  {
  	  
  wait 200
  constructible_class 3
  }
  
  death
  {
  wm_announce "^1The Allies have breached the Bunkersidewall!"
  wm_objective_status 		6 1 1
  wm_objective_status 		6 0 2
  // *----------------------------------- vo ------------------------------------------*
	
	
  	wm_teamvoiceannounce 0 "wr_axis_wall_destroyed"
  	wm_teamvoiceannounce 1 "wr_allies_wall_destroyed"
  		
  // *---------------------------------------------------------------------------------*
  
  }
  
  
}



//*****************************************************************
// Steal the mobile Emitters
//*****************************************************************
radarbox1
{
	spawn
	{
		wait 50
		setstate radarbox1 invisible
		accum 1 set 0
	}

	trigger visible
	{
		setstate radarbox1 default
		accum 1 abort_if_not_equal 0
		wm_announce	"^1Allies have secured the First Radar Parts!"
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "wr_axis_obj_lost"
	  	wm_teamvoiceannounce 1 "wr_allies_obj_cap"
	  		  		
	  // *---------------------------------------------------------------------------------*
		accum 1 set 1
	}

	trigger invisible
	{
		setstate radarbox1 invisible
	}
}

radarbox2
{
	spawn
	{
		wait 50
		setstate radarbox2 invisible
		accum 1 set 0
	}

	trigger visible
	{
		setstate radarbox2 default
		accum 1 abort_if_not_equal 0
		wm_announce	"^1Allies have secured the Second Radar Parts!"
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "wr_axis_obj_lost"
	  	wm_teamvoiceannounce 1 "wr_allies_obj_cap"
	  		
	  // *---------------------------------------------------------------------------------*

		accum 1 set 1
	}

	trigger invisible
	{
		setstate radarbox2 invisible
	}
}


radarbox_tr1
{
	trigger visible
	{
		setstate radarbox_tr1 default
	}

	trigger invisible
	{
		setstate radarbox_tr1 invisible
	}
}

radarbox_tr2
{
	trigger visible
	{
		setstate radarbox_tr2 default
	}

	trigger invisible
	{
		setstate radarbox_tr2 invisible
	}
}

truck_exitpoint // Exit point of map
{
	death
	{
		
		trigger game_manager stolen_circuit
	}
}


// ================================================
// ============== RADAR DISH MISC =================
// ================================================

emitterbox1
{
	spawn
	{
	}

	trigger stolen
	{
		//setstate emitterbox1 invisible
		trigger radar1 down
		wait 1000

		
	}

	trigger returned
	{
		// *----------------------------------- vo ------------------------------------------*
		
		// *---------------------------------------------------------------------------------*

		//setstate emitterbox1 default
		trigger radar1 up 
	}

	trigger captured
	{
		trigger radarbox1 visible
		trigger radarbox_tr1 invisible
	}
}


//*************************************************************************************************

radar1
{
	spawn
	{
		accum 1 set 0	// 0:Down 1:Up
		accum 2 set 0	// 0:Stationary 1:Moving
		accum 3 set 0	// requested direction
		wait 50
		trigger radar1 up
		
	}

	trigger up
	{
		accum 3 set 1

		accum 1 abort_if_equal 1		// Abort if UP already
		accum 2 abort_if_equal 1		// Abort if moving already

		stopsound
		playsound sound/vehicles/misc/radar_start.wav volume 64	// radar start sound
		

		accum 2 set 1				// Moving, DND
		startanimation 0 35 15 nolerp norandom noloop
		wait 2500
		startanimation 34 1 15 norandom noloop	// Client PVS issue
		setrotation 0 30 0
		accum 2 set 0				// Finished
		accum 1 set 1				// Now in UP status

		
		
		
		accum 3 abort_if_equal 1

		trigger self down
	}

	trigger down
	{
		accum 3 set 0

		accum 1 abort_if_equal 0		// Abort if DOWN already
		accum 2 abort_if_equal 1		// Abort if moving already

		
		
		playsound sound/vehicles/misc/radar_end.wav volume 64	// radar stop sound
		
		
		accum 2 set 1				// Moving, DND
		stoprotation
		startanimation 34 29 15 nolerp norandom noloop
		wait 2500
		startanimation 0 1 15 norandom noloop	// Client PVS issue
		accum 2 set 0				// Finished
		accum 1 set 0				// Now in DOWN status

		accum 3 abort_if_equal 0

		trigger self up
	}
} 

emitterbox2
{
	spawn
	{
	}

	trigger stolen
	{
		//setstate emitterbox2 invisible
		trigger radar2 down

		wait 1000

		
	}

	trigger returned
	{
		//setstate emitterbox2 default
		trigger radar2 up 
	}

	trigger captured
	{
		trigger radarbox2 visible
		trigger radarbox_tr2 invisible
	}
}

radar2
{
	
	spawn
	{
		accum 1 set 0	// 0:Down 1:Up
		accum 2 set 0	// 0:Stationary 1:Moving
		accum 3 set 0	// requested direction
		wait 150
		trigger radar2 up
		
	}

	trigger up
	{
		accum 3 set 1

		accum 1 abort_if_equal 1		// Abort if UP already
		accum 2 abort_if_equal 1		// Abort if moving already

		stopsound
		playsound sound/vehicles/misc/radar_start.wav volume 64	// radar start sound
		
		
		accum 2 set 1				// Moving, DND
		startanimation 0 35 15 nolerp norandom noloop
		wait 2500
		startanimation 34 1 15 norandom noloop	// Client PVS issue
		setrotation 0 30 0
		accum 2 set 0				// Finished
		accum 1 set 1				// Now in UP status

		
				
		accum 3 abort_if_equal 1

		trigger self down
	}

	trigger down
	{
		accum 3 set 0

		accum 1 abort_if_equal 0		// Abort if DOWN already
		accum 2 abort_if_equal 1		// Abort if moving already

		playsound sound/vehicles/misc/radar_end.wav volume 64	// radar stop sound
		
		
		accum 2 set 1				// Moving, DND
		stoprotation
		startanimation 34 29 15 nolerp norandom noloop
		wait 3500
		startanimation 0 1 15 norandom noloop	// Client PVS issue
		accum 2 set 0				// Finished
		accum 1 set 0				// Now in DOWN status

		accum 3 abort_if_equal 0

		trigger self up
	}
} 

//***************************************RADARPARTS END*********************************************






// ================================================
// ============ Constructable stuff ==============
// ================================================

//woodenbarrier construction
woodenbarrier
{
  spawn
  {
  wait 200
  trigger self setup
  
  constructible_class 2
  }

  trigger setup
  {
  setstate woodenbarrier invisible
  setstate mat_woodenbarrier default
  }

  buildstart final
  {
  setstate woodenbarrier underconstruction
  setstate mat_woodenbarrier default
  
  
  }

  built final
  {
  setstate woodenbarrier default
  setstate mat_woodenbarrier invisible
  wm_announce "^1The Woodenbarrier has been constructed."
  // *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "wr_allies_woodbarrier_const"
		wm_teamvoiceannounce 1 "wr_allies_woodbarrier_const"
  // *---------------------------------------------------------------------------------*
  }

  decayed final
  {
  setstate woodenbarrier invisible
  setstate mat_woodenbarrier default
  }
  
  death
  {
  setstate woodenbarrier invisible
  setstate mat_woodenbarrier default
  wm_announce "^1The Allies have destroyed the Woodenbarrier!"
  // *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "wr_axis_woodbarrier_dest"
		wm_teamvoiceannounce 0 "wr_axis_woodbarrier_dest2"
		wm_teamvoiceannounce 1 "wr_allies_woodbarrier_dest"
		
 // *---------------------------------------------------------------------------------*
  }
}


//defense construction
defense
{
  spawn
  {
  wait 200
  trigger self setup
  
  constructible_class 2
  }

  trigger setup
  {
  setstate defense invisible
  setstate mat_defense default
  }

  buildstart final
  {
  setstate defense underconstruction
  setstate mat_defense default
  
  
  }

  built final
  {
  setstate defense default
  setstate mat_defense invisible
  wm_announce "^1The Antenna Defense has been constructed."
  // *----------------------------------- vo ------------------------------------------*
	wm_teamvoiceannounce 0 "wr_axis_depot_constr"
	wm_teamvoiceannounce 1 "wr_allies_depot_dyn"	
		
 // *---------------------------------------------------------------------------------*
  }

  decayed final
  {
  setstate defense invisible
  setstate mat_defense default
  }
  
  death
  {
  setstate defense invisible
  setstate mat_defense default
  wm_announce "^1The Allies have destroyed the  Antenna defense!"
  // *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "wr_axis_depot_destr"
		wm_teamvoiceannounce 0 "wr_axis_depot_con"
		wm_teamvoiceannounce 1 "wr_allies_depot_destr"
 // *---------------------------------------------------------------------------------*
  
  }
  

}

// ================================================
// ============ 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"
// *---------------------------------------------------------------------------------*

wm_objective_status 7 0 2
wm_objective_status 7 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 7 0 0
wm_objective_status 7 1 0
}
}

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 7 0 1
wm_objective_status 7 1 2
}

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 7 0 0
wm_objective_status 7 1 0
}
}

// ================================
// ======= REMOVE LMS STUFF =======
// ================================

// LMS Command Post
neutral_compost_toi_lms
{
spawn
{
wait 50
setstate neutral_compost_toi_lms invisible
}
}

neutral_compost_clip_lms
{
spawn
{
wait 400
remove
}
}

neutral_compost_closed_clip_lms
{
spawn
{
wait 400
remove
}
}

neutral_compost_closed_model_lms
{
spawn
{
wait 400
remove
}
}

allied_compost_built_lms
{
spawn
{
wait 400
remove
}
}

allied_compost_built_model_lms
{
spawn
{
wait 400
remove
}
}

axis_compost_built_lms
{
spawn
{
wait 400
remove
}
}

axis_compost_built_model_lms
{
spawn
{
wait 400
remove
}
}  