
// Map: Lighthouse2 - by mrfin 2007


game_manager
{
	spawn
	{
		// Game rules
		wm_axis_respawntime	20
		wm_allied_respawntime	30
		wm_number_of_objectives 8
		wm_set_round_timelimit	30

		// Objectives

		// Primary:
		// 1: Destroy Light / Defend 
		// 2: Destroy Gun Emplacement / defend
		// 3: Destroy Command Bunker / defend
		// Secondary:
		// 4: Construct Beach Assault Ropes / Prevent Beach Assault Ropes
		// 5: Destroy Main Entrance Door / Defend
		// 6: Destroy Lighthouse Wall / Defend
		// 7: Destroy Lighthouse Gate / defend
		// 8: Build / Dsstroy lighthouse ropes
		
		

		wm_objective_status 1 1 0 // <objective team status>
		wm_objective_status 1 0 0 // status: 0 = default
		wm_objective_status 2 1 0 //		 1 = succeeded
		wm_objective_status 2 0 0 //		 2 = failed
		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
		wm_objective_status 8 1 0
		wm_objective_status 8 0 0
		

		wm_set_main_objective		1	1
		wm_set_main_objective		1	0

		wait 50
		setautospawn	"Compound"			1
		setautospawn	"Beach"			0

		//// speakers//////

		setstate cp_speaker_allies invisible
		setstate cp_speaker_axis invisible
		setstate comms_speaker1 default
		setstate comms_speaker2 default
		setstate lh_speaker default
		setstate forcast invisible

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

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

		wait 450


	}

	trigger obj_counter
	{
		accum 5 inc 1				// Increase game counter
		accum 5 abort_if_not_equal 3		// All objs destroyed ?
	
		wm_announce	"AXIS HAVE DESTROYED THE CHANNEL LIGHTHOUSE COMMAND CENTRE!"
	
		wait 8000
	
		accum 1 set 1				// All obs destroyed
			
		// 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 0

		// End the round
		wm_endround
		
	}
}



// ================================================
// =========== FORWARD SPAWN POINT  ===============
// ================================================


forwardspawn
{
	spawn
	{
		accum 0 set 1	// Who has the flag: 0-Axis, 1-Allied
	}

	trigger axis_capture	// Flag has been touched by an Axis player
	{
		accum 0 abort_if_equal 0 // do Axis own flag?

		accum 0 set 0 // Axis own the pole
		wm_announce	"Axis capture forward bunker - ammo bunker door open!"


		//wm_objective_status 		8 0 1
		//wm_objective_status 		8 1 2

		alertentity forward_wobj
		trigger team_door gone
		trigger open_team_door open
		/////
		setstate forwardspawns default
		setautospawn	"Forward Bunker"			0
		
	}

	trigger allied_capture	// Flag has been touched by an allied player
	{
		accum 0 abort_if_equal 1 // do Allies own flag?

		accum 0 set 1 // Allied own the flag
		wm_announce	"Allies capture forward bunker - ammo bunker door closed!"



		//wm_objective_status 		8 0 2
		//wm_objective_status 		8 1 1

		alertentity forward_wobj
		trigger team_door closed
		trigger open_team_door gone
		
	}

	trigger axis_owned
	{
		accum 0 abort_if_equal 0 // do Axis own flag?

		accum 0 set 0 // Axis own the pole
		wm_announce	"Axis gained spawn positions at the forward bunker!"


		
		//wm_objective_status 		8 0 1
		//wm_objective_status 		8 1 2

		alertentity forward_wobj						// Toggle CM flag from allies to axis
		alertentity axis_forwardspawns					// Toggle spawnpoints from allies to axis
	
	}

	trigger allied_owned
	{
		accum 0 abort_if_equal 1 // do Allies own flag?

		accum 0 set 1 // Allied own the flag
		wm_announce	"Allies gained spawn positions at the forward bunker!"

		
		
		//wm_objective_status 		8 0 2
		//wm_objective_status 		8 1 1

		alertentity forward_wobj						// Toggle CM flag from axis to allies
		alertentity allied_forwardspawns					// Toggle spawnpoints from axis to allies
		
		
	}
}



// ================================================
// ========== CONSTRUCTIBLE STUFF =================
// ================================================


construction_ropes

{
   spawn
   {
      wait 200
      constructible_class 3
      trigger self startup­
   }

   buildstart final
   {
   }

   built final
   {
      setstate construction_ropes default
      setstate construction_materials invisible

      // Some kind of UI pop-up to alert players
      wm_announce   "Axis team has built the cliff assault ropes!"
	wm_teamvoiceannounce 0 "axis_hq_const_completed"

	wm_objective_status 4 0 1
	wm_objective_status 4 1 2
   }

   decayed final
   {
      trigger self startup
   }

   death
   {
      trigger self startup
      // Some kind of UI pop-up to alert players
      wm_announce   "Allied team has destroyed the assault ropes!"
	wm_teamvoiceannounce 0 "axis_hq_const_destroyed"
	wm_objective_status 4 0 2
	wm_objective_status 4 1 1
   }

   trigger startup
   {
      setstate construction_ropes invisible
      setstate construction_materials default
      
   }
} 


///////////////////////////// construction2_ ropes ///////////////////////
/////////////////////////////////////////////////////////////////////////


construction2_ropes

{
   spawn
   {
      wait 200
      constructible_class 3
      trigger self startup­
   }

   buildstart final
   {
   }

   built final
   {
      setstate construction2_ropes default
      setstate construction2_materials invisible

      // Some kind of UI pop-up to alert players
      wm_announce   "Axis team has built the 2nd cliff assault ropes!"
	wm_teamvoiceannounce 0 "axis_hq_const_completed"

	wm_objective_status 4 0 1
	wm_objective_status 4 1 2
   }

   decayed final
   {
      trigger self startup
   }

   death
   {
      trigger self startup
      // Some kind of UI pop-up to alert players
      wm_announce   "Allied team has destroyed the 2nd assault ropes!"
	wm_teamvoiceannounce 0 "axis_hq_const_destroyed"
	wm_objective_status 4 0 2
	wm_objective_status 4 1 1
   }

   trigger startup
   {
      setstate construction2_ropes invisible
      setstate construction2_materials default
      
   }
} 

construction_lhropes

{
   spawn
   {
      wait 200
      constructible_class 2
      trigger self startup­
   }

   buildstart final
   {
   }

   built final
   {
      setstate construction_lhropes default
      setstate construction_lhropes_materials invisible

      // Some kind of UI pop-up to alert players
      wm_announce   "Axis team has built the lighthouse tower assault ropes!"
	wm_teamvoiceannounce 0 "axis_hq_const_completed"

	wm_objective_status 8 0 1
	wm_objective_status 8 1 2
   }

   decayed final
   {
      trigger self startup
   }

   death
   {
      trigger self startup
      // Some kind of UI pop-up to alert players
      wm_announce   "Allied team has destroyed the lighthouse tower assault ropes!"
	wm_teamvoiceannounce 0 "axis_hq_const_destroyed"
	wm_objective_status 8 0 2
	wm_objective_status 8 1 1
   }

   trigger startup
   {
      setstate construction_lhropes invisible
      setstate construction_lhropes_materials default
      
   }
} 





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

		setstate cp_speaker_allies default
	}

	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

		setstate cp_speaker_allies invisible
	}
}

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!"
		
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"
		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

		
	}

	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!"

		
	}
}

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

		setstate cp_speaker_axis default
	}

	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

		setstate cp_speaker_axis invisible
	}
}

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!"
		
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

		
	}

	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!"

		
	}
}

//==================================================================
//================    Destructibles      ===========================
//==================================================================

////////////////// Lighthouse compound wall  ///////////////////////

compound_wall

{
	spawn
	{
	wait 200
	constructible_class 3
	}
	death
	{
	wm_announce "Axis team has breached the compound wall"
	wm_teamvoiceannounce 0 "axis_hq_objective_destroyed"
	wm_objective_status	6 1 2
	wm_objective_status	6 0 1
	}
}

/////////////// Lighthouse Compound Gate   ///////////////////////////

compound_gate

{
	spawn
	{
	wait 200
	constructible_class 3
	}
	death
	{
	wm_announce "Axis team has breached the compound gate"
	wm_teamvoiceannounce 0 "axis_hq_objective_destroyed"
	setstate td_compound_gate_right invisible
	setstate td_compound_gate_left invisible
	wm_objective_status	7 1 2
	wm_objective_status	7 0 1
	}
}

///////////// Main Entrance  /////////////////////////////////////

main_entrance

{
	spawn
	{
	wait 200
	constructible_class 3
	}
	death
	{
	wm_announce "Axis team has breached the main entrance"
	wm_teamvoiceannounce 0 "axis_hq_objective_destroyed"
	wm_objective_status	5 1 2
	wm_objective_status	5 0 1
	}
}

//==================================================================
//======================= Anti ship gun=============================
//==================================================================


the_gun
{
	spawn
	{
		wait 200

		constructible_class 3

		trigger the_gun setup
	}

	trigger setup
	{
		setstate gun_smoke invisible
		setstate broken_gun_model invisible
		setstate broken_gun invisible

		setstate gun_model default
	}

	death
	{
		setstate gun_smoke default
		setstate broken_gun_model default
		setstate broken_gun default

		setstate gun_model invisible

		//togglespeaker pak75_expl_1

		wm_announce "Axis have destroyed MAIN OBJECTIVE 2 the Anti-Ship Gun!"
		wm_teamvoiceannounce 0 "axis_hq_objective_destroyed"


		wm_objective_status 		2 0 1
		wm_objective_status 		2 1 2

		trigger game_manager obj_counter

		//wm_set_main_objective	2 0
		//wm_set_main_objective	2 1

		// Update game manager counter for objectives
			
	}
}

//==================================================================
//======================= The comms bunker =============================
//==================================================================


comms_bunker
{
	spawn
	{
		wait 200

		constructible_class 3

		trigger comms_bunker setup
	}

	trigger setup
	{

	}

	death
	{
	
		setstate comms_speaker1 invisible
		setstate comms_speaker2 invisible
				
		wm_announce "Axis have destroyed MAIN OBJECTIVE 3 the Command Bunker!"
		wm_teamvoiceannounce 0 "axis_hq_objective_destroyed"



		wm_objective_status 		3 0 1
		wm_objective_status 		3 1 2

		trigger game_manager obj_counter

		
	}
}

//==================================================================
//======================= The Light =============================
//==================================================================


light_house
{
	spawn
	{
		wait 200

		constructible_class 3

		trigger light_house setup
	}

	trigger setup
	{
		setstate light_house_smoke invisible
		setstate rotating_light default
	
		
	}

	death
	{
		setstate light_house_smoke default
		kill rotating_light
		setstate lh_speaker invisible		
	
		wm_announce "Axis have destroyed MAIN OBJECTIVE 1 the Light!"
		wm_teamvoiceannounce 0 "axis_hq_objective_destroyed"



		wm_objective_status 		1 0 1
		wm_objective_status 		1 1 2

		trigger game_manager obj_counter
			
	}
}
////////////////////////////////////////team door///////////////////////////////////////////
team_door
{
	
	spawn
	{	
		wait 150
		setstate team_door default
	}
	trigger gone
	{	
		setstate team_door invisible
		//setstate open_team_door default
	}
	trigger closed
	{	
		setstate team_door default
	}

}
open_team_door
{
	
	spawn
	{	
		wait 150
		setstate open_team_door invisible
	}
	trigger open
	{	
		setstate open_team_door default
	}
	trigger gone
	{
		setstate open_team_door invisible
	}
}












