game_manager
{
   spawn 
    {		
    
		  wm_axis_respawntime	18
		  wm_allied_respawntime	20
		  wm_number_of_objectives 5
		  wm_set_round_timelimit	30
		  
		  wm_setwinner 1

      // Current main objectives for each team (0=Axis, 1=Allies)
		  wm_set_main_objective		1 0
		  wm_set_main_objective		1	1
		  
      // wm_objective_status <objective> <team> <status (0=neutral 1=complete 2=failed)		  
      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
      wm_objective_status 4 0 0
      wm_objective_status 4 1 0
      wm_objective_status 5 0 0
      wm_objective_status 5 1 0
      
      
      // Stopwatch mode defending team (0=Axis, 1=Allies)
		  wm_set_defending_team	1
      
      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_construct"

      wait 100
      setstate BigFlak_1 invisible
      setstate BigFlak_2 invisible
      setstate BigFlak_3 invisible
      setstate BigFlak_4 invisible
      setstate digit_1 invisible
      setstate digit_2 invisible
      setstate digit_3 invisible
      setstate digit_4 invisible
    }
}


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

////////////////////////////////////////////////
// Axis: Build the ladder construction to Bunker
////////////////////////////////////////////////

ladder 
{ 
    spawn 
  {
    wait 200   
    trigger self setup 
    constructible_class 3 
  } 
  trigger setup 
  { 
    setstate ladder invisible 
    setstate baumaterial default 
  } 
  buildstart final 
  {  
    setstate ladder underconstruction 
    setstate baumaterial default 
  } 
  built final 
  { 
    setstate ladder default 
    setstate baumaterial invisible 
    wm_objective_status 1 0 1 
    wm_objective_status 1 1 2
    wm_announce "The ladder to Bunker has been constructed!" 
    wm_teamvoiceannounce 0 "axis_hq_const_completed"
  } 
  decayed final 
  { 
    setstate ladder invisible 
    setstate baumaterial default 
  } 
  death 
  { 
    wait 50
    setstate ladder invisible 
    setstate baumaterial default
    
    wm_objective_status 1 0 2 
    wm_objective_status 1 1 1 
    wm_announce "Allied team has destroyed the ladder to Bunker!"
 	  wm_teamvoiceannounce 0 "axis_hq_const_destroyed" 
  } 
  
}

///////////////////////////////////////////////////////
// Allies: Build Guard Walls (on roof) for Main Bunker
///////////////////////////////////////////////////////

gate 
{ 
    spawn 
  {
    wait 200   
    trigger self setup 
    constructible_class 2 
    constructible_constructxpbonus 7
    constructible_destructxpbonus 7
  } 
  trigger setup 
  { 
    setstate gate invisible 
    setstate baumaterial_2 default 
  } 
  buildstart final 
  {  
    setstate gate underconstruction 
    setstate baumaterial_2 default 
  } 
  built final 
  { 
    setstate gate default 
    setstate baumaterial_2 invisible 
    wm_objective_status 2 1 1 
    wm_objective_status 2 0 0
    wm_announce "The Guard Fences to Bunker has been constructed!" 
    wm_teamvoiceannounce 1 "allies_hq_const_completed"
  } 
  decayed final 
  { 
    setstate gate invisible 
    setstate baumaterial_2 default 
  } 
  death 
  { 
    wait 50
    setstate gate invisible 
    setstate baumaterial_2 default
    
    wm_objective_status 2 1 0 
    wm_objective_status 2 0 1 
    wm_announce "Axis team has destroyed the alternate Entry to Bunker!" 
 	  wm_teamvoiceannounce 0 "axis_hq_const_destroyed"
  } 
  
}

//////////////////////////////////////////////////
// Allies: Build Guard Fence behind observatorium
//////////////////////////////////////////////////

fence 
{ 
    spawn 
  {
    wait 200   
    trigger self setup 
    constructible_class 2 
    constructible_constructxpbonus 5
    constructible_destructxpbonus 5
  } 
  trigger setup 
  { 
    setstate fence invisible 
    setstate baumaterial_3 default 
  } 
  buildstart final 
  {  
    setstate fence underconstruction 
    setstate baumaterial_3 default 
  } 
  built final 
  { 
    setstate fence default 
    setstate baumaterial_3 invisible 
    wm_objective_status 3 1 1 
    wm_objective_status 3 0 0
    wm_announce "The Guard Fence to main Bunker has been constructed!"
    wm_teamvoiceannounce 1 "allies_hq_const_completed" 
  } 
  decayed final 
  { 
    setstate fence invisible 
    setstate baumaterial_3 default 
  } 
  death 
  { 
    wait 50
    setstate fence invisible 
    setstate baumaterial_3 default
    
    wm_objective_status 3 1 0 
    wm_objective_status 3 0 1 
    wm_announce "Axis Team has destroyed the Guard Fence near Observatorium!"
    wm_teamvoiceannounce 0 "axis_hq_const_destroyed" 
  } 
  
}



//////////////////////////////////////////////////////////////////////////
// Axis: Escape with the secret Flak Ammos and bring it to big Flak cannon
//////////////////////////////////////////////////////////////////////////

SecretAmmo 
{  
	spawn
	{
		accum 0 set 0 // flag counter
	}
    death 
    { 
      wait 50
      wm_announce "Axis team escaped with Flak Ammo!"
      wm_teamvoiceannounce 0 "flak_shot"
      
      accum 0 inc 1
      accum 0 trigger_if_equal 1 SecretAmmo secured1
      accum 0 trigger_if_equal 2 SecretAmmo secured2  
      accum 0 trigger_if_equal 3 SecretAmmo secured3  
      accum 0 trigger_if_equal 4 SecretAmmo secured4
           
      accum 0 abort_if_not_equal 4  // wm_endround if all Flak ammo stolen     

      // wm_objective_status <objective> <team> <status (0=neutral 1=complete 2=failed)
      wm_objective_status 1 1 2
      wm_objective_status 1 0 1

      wm_setwinner 0 // 1 = Allied | 0 = Axis 

      wm_announce "Axis team has stolen ALL Flak Ammo!"
      wm_teamvoiceannounce 0 "flak_shot"
      wait 3000
      
      wm_endround 
    } 
    
    
       
  trigger secured1
  {
		wm_announce "Axis team has secured the first Flak Ammo!"
		setstate BigFlak_1 default
		setstate digit_0 invisible
		setstate digit_1 default
  }
  
  trigger secured2
  {
		wm_announce "Axis team has secured the second Flak Ammo!"
		setstate BigFlak_2 default
		setstate digit_1 invisible
		setstate digit_2 default
  }   
  
  trigger secured3
  {
		wm_announce "Axis team has secured the third Flak Ammo!"
		setstate BigFlak_3 default
		setstate digit_2 invisible
		setstate digit_3 default 
  } 
  
  trigger secured4
  {
		wm_announce "Axis team has secured the third Flak Ammo!"
		setstate BigFlak_4 default
		setstate digit_3 invisible
		setstate digit_4 default 
  } 
  
}

/////////////////////////////////////////// 
// Forward Spawn point  - Initially neutral 
/////////////////////////////////////////// 

forwardspawn1_flag 
{ 
   spawn 
   { 
      wait 200 
      accum 0 set 2                            // Who owns flag: 0-Axis, 1-Allied, 2-no flag
      setstate forwardspawn1_wobj invisible    //remove Axis flag command map marker until captured 
   } 
    
  trigger axis_capture                         // Touched by an Axis player 
   { 
      accum 0 abort_if_equal 0                 // do Axis own flag? 
      accum 0 set 0                            // Axis own the flag 
      wm_announce "Axis reclaim the Command Post Spawn!" 
      setstate forwardspawn1_wobj default                
      alertentity forwardspawn1_wobj           // Switch command map marker
      setautospawn "Command Post Spawn"   0    // Set Axis to Command Post Spawn 
   }

   trigger allied_capture                      // Touched by an allied player 
   { 
      accum 0 abort_if_equal 1                 // do Allies own flag? 
      accum 0 set 1                            // Allies own the flag 
      wm_announce "Allies capture the Command Post Spawn!" 
      setstate forwardspawn1_wobj default 
      alertentity forwardspawn1_wobj           // Switch command map marker 
      setautospawn "Command Post Spawn"   1    // Set Allies to Command Post Spawn 
   } 
    
}

///////////////////////////////////////////////////////////
// Axis: Build Overhead line to main Bunker near Funk House
///////////////////////////////////////////////////////////

overlines
{
   spawn
   {
      wait 200
      constructible_class 2
      constructible_constructxpbonus 5
      constructible_destructxpbonus 5
      trigger self startup-
   }

   buildstart final
   {
   }

   built final
   {
      setstate overlines default
      setstate baumaterial_4 invisible
      
      wm_announce   "Axis team has built the Overhead line to Main Bunker!"
	    wm_teamvoiceannounce 0 "axis_hq_const_completed"

	    wm_objective_status 5 0 1
	    wm_objective_status 5 1 2
   }

   decayed final
   {
      trigger self startup
   }

   death
   {
      trigger self startup
      wm_announce   "Allied team has destroyed the Overhead line to Main Bunker!"
	    wm_teamvoiceannounce 0 "allies_hq_const_destroyed"
	    wm_objective_status 5 0 2
	    wm_objective_status 5 1 1
   }

   trigger startup
   {
      setstate overlines invisible
      setstate baumaterial_4 default
      
   }
} 



