// ============================================================================
// Map: Fueldump
// Last update : 16/06/03 Sock
// ============================================================================
// rain - Tue Sep 23 20:24:55 EDT 2003 - fixed setautospawns
// reyalp - Tue Jun  6 15:15:17 PST 2006 - reduce end-round wait (per mortis)
game_manager
{
	spawn
	{
		// Game rules
		wm_axis_respawntime	30
		wm_allied_respawntime	20
		wm_number_of_objectives 7
		wm_set_round_timelimit	30

		wm_set_main_objective 2	0
		wm_set_main_objective 1	1

		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

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

		// Accumulator to check win conditions
		accum 1 set 0

		// Setup the auto spawn points for the map
		wait 500
		setautospawn "Allied Entrance Spawn" 1
		setautospawn "Tunnel Store Room" 0

		// Garage Doors
		globalaccum 4 set 0		// Flexible Door 1 status. (0=stationary, 1=moving)
		globalaccum 5 set 0		// Flexible Door 2 status. (0=stationary, 1=moving)

		// CP speakers
		disablespeaker axishq_sound
		disablespeaker alliedhq_sound

		wait 2000

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "fueldump_axis_bridge_stop"

		wm_addteamvoiceannounce 1 "fueldump_allies_bridge_construct"

		wm_teamvoiceannounce 0 "fueldump_axis_bridge_stop"
		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 1 "fueldump_allies_bridge_construct"
		// *---------------------------------------------------------------------------------*
	}


	//-----------------------------------------------------------------------
	// Constructing a Bridge over the frozen river
	//-----------------------------------------------------------------------
	trigger objective1
	{
		wm_announce "Allied team has constructed the bridge!"
	}

	//-----------------------------------------------------------------------
	// Destroying the Tunnel Doors.
	//-----------------------------------------------------------------------
	trigger objective2
	{
		wm_announce	"Allied team has breached the Tunnel Doors!"
		setstate tunneldoor_toi invisible

		// rain - fixed axis spawn point
		setautospawn "Tunnel Store Room" 1
		setautospawn "Axis Fuel Dump" 0
		alertentity t108	// Switch the tunnel spawns around

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "fueldump_axis_gates_stop"
		wm_addteamvoiceannounce 0 "fueldump_axis_depotdef_construct"

		wm_teamvoiceannounce 0 "fueldump_axis_tunnel_destroyed"
		wm_teamvoiceannounce 0 "fueldump_axis_depotdef_construct"

		wm_teamvoiceannounce 1 "fueldump_allies_tank_depot"
		wm_teamvoiceannounce 1 "allies_hq_compost_construct"

		wm_removeteamvoiceannounce 0 "fueldump_axis_tunnel_stop"
		// *---------------------------------------------------------------------------------*

		wm_set_main_objective	2	0
		wm_set_main_objective	2	1
	}

	//-----------------------------------------------------------------------
	// Destroying the Axis Depot Gates.
	//-----------------------------------------------------------------------
	trigger objective3
	{
		wm_announce	"Allied team has breached the Depot Gates!"
		setstate depotgate_toi invisible

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "fueldump_axis_gates_destroyed"
		wm_addteamvoiceannounce 0 "fueldump_axis_fueldump_defend"

		wm_addteamvoiceannounce 1 "fueldump_allies_fueldump_destroy"

		wm_teamvoiceannounce 0 "fueldump_axis_gates_destroyed"
		wm_teamvoiceannounce 0 "fueldump_axis_fueldump_defend"

		wm_teamvoiceannounce 1 "fueldump_allies_tank_reardepot"
		wm_teamvoiceannounce 1 "fueldump_allies_fueldump_destroy"

		wm_removeteamvoiceannounce 0 "fueldump_axis_gates_stop"
		wm_removeteamvoiceannounce 0 "fueldump_axis_depotdef_construct"

		wm_removeteamvoiceannounce 1 "fueldump_allies_tank_depot"
		// *---------------------------------------------------------------------------------*
	}

	//-----------------------------------------------------------------------
	// Destroying the Axis Fueldump.
	//-----------------------------------------------------------------------
	trigger objective4
	{
		// Change the variable within the script so that we can check if someone wins the round
		accum 1 set 1

		// Big bang sequence of fueldump here
		alertentity fueldump_explo1
		alertentity fueldump_explo2
		alertentity fueldump_explo3
		setstate fueldump_ladder invisible
		alertentity fueldump_rubble1
		alertentity fueldump_rubble2
		alertentity fueldump_rubble3

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has destroyed the Axis Fuel Dump!"

		wm_objective_status 4 1 1
		wm_objective_status 4 0 2

//		reyalp - was 3000
		wait 100

		// Call function to check if the round has been won
		trigger game_manager checkgame
	}

	//-----------------------------------------------------------------------
	// Escort the Tank to destroy the Side Wall to the rear of the Depot.
	//-----------------------------------------------------------------------
	trigger objective5
	{
		wm_announce	"Allied team has breached the Depot Side Wall!"
		setstate depotsidewall_toi invisible

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "fueldump_axis_fueldump_defend"

		wm_teamvoiceannounce 1 "fueldump_allies_wall_destroyed"
		wm_teamvoiceannounce 1 "fueldump_allies_fueldump_destroy"

		wm_removeteamvoiceannounce 1 "fueldump_allies_tank_reardepot"
		// *---------------------------------------------------------------------------------*
	}

	trigger checkgame
	{
		accum 1 abort_if_not_equal 1
		wm_setwinner 1
		wait 1000
		wm_endround
	}
}

// ============================================================================
// LMS stuff to remove from obj mode
// ============================================================================
thebridge_lms
{
	spawn
	{
		wait 100
		setstate thebridge_lms invisible

		setstate lms_hacabinet_cm_marker invisible
		setstate lms_hacabinet_toi invisible

		setstate lms_healthcabinet invisible
		setstate lms_ammocabinet invisible
		setstate lms_healthtrigger invisible
		setstate lms_ammotrigger invisible
		setstate lms_healthcabinet_clip invisible
		setstate lms_ammocabinet_clip invisible

		setstate lms_alliedstaircase invisible
	}
}

// ============================================================================
// AXIS HQ bits and pieces
// ============================================================================
axis_radio_destroyed
{
	spawn
	{
		wait 200
		setstate axis_radio_destroyed invisible
		setstate axis_radio_destroyed_model invisible
	}
	trigger hide
	{
		setstate axis_radio_destroyed invisible
		setstate axis_radio_destroyed_model invisible
	}
	trigger show
	{
		setstate axis_radio_destroyed default
		setstate axis_radio_destroyed_model default
		setstate axishqstuff invisible // Arial tower outside of building
	}
}

axis_radio_closed
{
	spawn
	{
		wait 200
		setstate axis_radio_closed default
		setstate axis_radio_closed_model default
	}
	trigger hide
	{
		setstate axis_radio_closed invisible
		setstate axis_radio_closed_model invisible
	}
	trigger show
	{
		setstate axis_radio_closed default
		setstate axis_radio_closed_model default
	}
}

axis_radio_built
{
	spawn
	{
		wait 400

		constructible_class 2

		trigger self setup
		setstate axishqstuff invisible

	}

	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
	{
		trigger axis_radio_built_model trans
		trigger axis_radio_destroyed hide
		trigger axis_radio_closed hide
		setstate axishqstuff underconstruction
	}

	decayed final
	{
		trigger axis_radio_built_model hide
		trigger axis_radio_closed show
		setstate axishqstuff invisible
	}

	built final
	{
		trigger axis_radio_built_model show
		trigger axis_radio_closed hide
		trigger axis_radio_destroyed hide

		trigger axis_radio_built_model enable_axis_features
		enablespeaker axishq_sound
		
		setstate axishqstuff default
	}

	death
	{
		trigger axis_radio_built_model hide
		trigger axis_radio_destroyed show

		trigger axis_radio_built_model disable_axis_features
		disablespeaker axishq_sound
	}
}

axis_radio_built_model
{
	spawn
	{
		wait 400
		setstate axis_radio_built_model invisible

		accum 0 bitreset 0	// set if radio is built
		accum 0 bitreset 1	// set if goal should be ignored
	}

	trigger show
	{
		setstate axis_radio_built_model default
	}

	trigger hide
	{
		setstate axis_radio_built_model invisible
	}

	trigger trans
	{
		setstate axis_radio_built_model underconstruction
	}

	trigger enable_axis_features
	{
		//-----------------------------------------------------------------------
		// Increase Axis charge times
		//-----------------------------------------------------------------------
		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

		// *----------------------------------- 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 6 0 1
		wm_objective_status 6 1 2
		wm_announce	"Axis Command Post constructed. Charge speed increased!"

		accum 0 bitset 0
	}

	trigger disable_axis_features
	{
		//-----------------------------------------------------------------------
		// Decrease Axis charge times
		//-----------------------------------------------------------------------
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_damaged"
		// *---------------------------------------------------------------------------------*

		wm_announce	"Allied team has destroyed the Axis Command Post!"

		wm_objective_status 6 0 0
		wm_objective_status 6 1 0

		accum 0 bitreset 0
	}
}

// ============================================================================
// Allied HQ bits and pieces
// ============================================================================
alliedhqradio_toi
{
	//-----------------------------------------------------------------------
	// Enable health/ammo cabinets, allied radio has been built
	//-----------------------------------------------------------------------
	trigger enable_hacabs
	{
		setstate tankbay_healthcabinet default
		setstate tankbay_ammocabinet default

		setstate tankbay_healthtrigger default
		setstate tankbay_ammotrigger default

		setstate tankbay_healthcabinet_dmg invisible
		setstate tankbay_ammocabinet_dmg invisible

		setstate tankbay_hacabinet_cm_marker default
		setstate tankbay_hacabinet_toi default
	}

	//-----------------------------------------------------------------------
	// Disable health/ammo cabinets, allied radio has been destroyed
	//-----------------------------------------------------------------------
	trigger disable_hacabs
	{
		setstate tankbay_healthcabinet invisible
		setstate tankbay_ammocabinet invisible

		setstate tankbay_healthtrigger invisible
		setstate tankbay_ammotrigger invisible

		setstate tankbay_healthcabinet_dmg default
		setstate tankbay_ammocabinet_dmg default

		setstate tankbay_hacabinet_cm_marker invisible
		setstate tankbay_hacabinet_toi invisible
	}

}

allied_radio_destroyed
{
	spawn
	{
		wait 200
		setstate allied_radio_destroyed invisible
		setstate allied_radio_destroyed_model invisible
	}
	trigger hide
	{
		setstate allied_radio_destroyed invisible
		setstate allied_radio_destroyed_model invisible
	}
	trigger show
	{
		setstate allied_radio_destroyed default
		setstate allied_radio_destroyed_model default
	}
}

allied_radio_closed
{
	spawn
	{
		wait 200
		setstate allied_radio_closed default
		setstate allied_radio_closed_model default
	}
	trigger hide
	{
		setstate allied_radio_closed invisible
		setstate allied_radio_closed_model invisible
	}
	trigger show
	{
		setstate allied_radio_closed default
		setstate allied_radio_closed_model default
	}
}

allied_radio_built
{
	spawn
	{
		wait 400
		constructible_class 2
		trigger allied_radio_built setup
	}

	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
		trigger alliedhqradio_toi disable_hacabs
	}

	buildstart final
	{
		trigger allied_radio_built_model trans
		trigger allied_radio_destroyed hide
		trigger allied_radio_closed hide
	}

	decayed final
	{
		trigger allied_radio_built_model hide
		trigger allied_radio_closed show
	}

	built final
	{
		trigger allied_radio_built_model show
		trigger allied_radio_closed hide
		trigger allied_radio_destroyed hide

		trigger allied_radio_built_model enable_allied_features
		enablespeaker alliedhq_sound
	}

	death
	{
		trigger allied_radio_built_model hide
		trigger allied_radio_destroyed show

		trigger allied_radio_built_model disable_allied_features
		disablespeaker alliedhq_sound
	}
}

allied_radio_built_model
{
	spawn
	{
		wait 400
		setstate allied_radio_built_model invisible

		accum 0 bitreset 0	// set if radio is built
		accum 0 bitreset 1	// set if goal should be ignored
	}

	trigger show
	{
		setstate allied_radio_built_model default
	}

	trigger hide
	{
		setstate allied_radio_built_model invisible
	}

	trigger trans
	{
		setstate allied_radio_built_model underconstruction
	}

	trigger enable_allied_features
	{
		trigger alliedhqradio_toi enable_hacabs
		//-----------------------------------------------------------------------
		// Increase Allies charge times
		//-----------------------------------------------------------------------
		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

		// *----------------------------------- 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 1 1
		wm_objective_status 7 0 2
		wm_announce	"Allied Command Post constructed. Charge speed increased!"

		accum 0 bitset 0
	}

	trigger disable_allied_features
	{
		trigger alliedhqradio_toi disable_hacabs
		//-----------------------------------------------------------------------
		// Decrease Allies charge times
		//-----------------------------------------------------------------------
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "allies_hq_compost_damaged"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		wm_announce	"Axis team has destroyed the Allied Command Post!"
		wm_objective_status 7 0 0
		wm_objective_status 7 1 0

		accum 0 bitreset 0
	}
}

// ============================================================================
// The Bridge
// ============================================================================
thebridge
{
	spawn
	{
		accum 7 set 0	// Bridge stage construction and tank status
		wait 200

		constructible_class 3
		setstate bridgematerials_stage1 default
		setstate bridgematerials_stage2 default

		accum 7 bitset 1	// Tank NOT over bridge yet
	}

	//-----------------------------------------------------------------------
	// Stage 1 is BUILT
	//-----------------------------------------------------------------------
	built stage1
	{
		setstate bridgematerials_stage1 invisible	// Remove stage 1 construction items
		trigger game_manager objective1

		accum 7 abort_if_not_bitset 1	// Tank over bridge?

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "fueldump_axis_bridge_destroy"

		wm_addteamvoiceannounce 1 "fueldump_allies_bridge_reinforce"

		wm_teamvoiceannounce 0 "fueldump_axis_bridge_destroy"

		wm_teamvoiceannounce 1 "fueldump_allies_bridge_reinforce"

		wm_removeteamvoiceannounce 0 "fueldump_axis_bridge_stop"

		wm_removeteamvoiceannounce 1 "fueldump_allies_bridge_construct"
		// *---------------------------------------------------------------------------------*
	}

	//-----------------------------------------------------------------------
	// Stage 1 is DESTROYED
	//-----------------------------------------------------------------------
	death
	{
		setstate bridgematerials_stage1 default		// Restore stage 1 construction items
		togglespeaker bridge_expl			// Explosion

		trigger tank clearBridge

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis team has destroyed the Bridge!"

		accum 7 abort_if_not_bitset 1	// Tank over bridge?

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "fueldump_axis_bridge_stop"

		wm_addteamvoiceannounce 1 "fueldump_allies_bridge_construct"

		wm_teamvoiceannounce 0 "fueldump_axis_bridge_destroyed"

		wm_teamvoiceannounce 1 "fueldump_allies_bridge_construct"

		wm_removeteamvoiceannounce 0 "fueldump_axis_bridge_destroy"

		wm_removeteamvoiceannounce 1 "fueldump_allies_bridge_reinforce"
		// *---------------------------------------------------------------------------------*
	}

	//-----------------------------------------------------------------------
	// Stage 2 is BUILT
	//-----------------------------------------------------------------------
	built final
	{
		setstate bridgematerials_stage2 invisible
		trigger tank setBridge

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has reinforced the Bridge!"

		accum 7 abort_if_not_bitset 1	// Tank over bridge?

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "fueldump_axis_bridge_destroy"

		wm_addteamvoiceannounce 1 "fueldump_allies_tank_bridge"

		wm_teamvoiceannounce 0 "fueldump_axis_bridge_reinforced"

		wm_teamvoiceannounce 1 "fueldump_allies_bridge_reinforced"
		wm_teamvoiceannounce 1 "fueldump_allies_tank_bridge"

		wm_removeteamvoiceannounce 0 "fueldump_axis_bridge_stop"

		wm_removeteamvoiceannounce 1 "fueldump_allies_bridge_reinforce"
		// *---------------------------------------------------------------------------------*

		wm_set_main_objective		1	0	// Completed an objective
	}

	//-----------------------------------------------------------------------
	// Stage 2 is DESTROYED, go back to stage 1
	//-----------------------------------------------------------------------
	destroyed final
	{
		setstate bridgematerials_stage2 default
		togglespeaker bridge_expl

		trigger tank clearBridge

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis team has damaged the Bridge!"

		accum 7 abort_if_not_bitset 1	// Tank over bridge?

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "fueldump_axis_bridge_destroy"
		wm_addteamvoiceannounce 1 "fueldump_allies_bridge_reinforce"

		wm_teamvoiceannounce 0 "fueldump_axis_bridge_damaged"

		wm_teamvoiceannounce 1 "fueldump_allies_bridge_damaged"

		wm_removeteamvoiceannounce 1 "fueldump_allies_tank_bridge"
		// *---------------------------------------------------------------------------------*
	}

	//-----------------------------------------------------------------------
	// Tank has made it over the bridge and on route to the cave doors
	// remove all VO reference to the bridge construct/destruct
	//-----------------------------------------------------------------------
	trigger tank_passed
	{
		accum 7 bitreset 1	// Tank over bridge, no more announcements

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "fueldump_axis_tunnel_stop"
		wm_addteamvoiceannounce 1 "fueldump_allies_tank_depot"

		wm_teamvoiceannounce 0 "fueldump_axis_tunnel_stop"

		wm_removeteamvoiceannounce 0 "fueldump_axis_bridge_destroy"
		wm_removeteamvoiceannounce 0 "fueldump_axis_bridge_stop"

		wm_removeteamvoiceannounce 1 "fueldump_allies_bridge_construct"
		wm_removeteamvoiceannounce 1 "fueldump_allies_bridge_reinforce"
		wm_removeteamvoiceannounce 1 "fueldump_allies_tank_bridge"
		// *---------------------------------------------------------------------------------*
	}

}

// ============================================================================
// The Fuel Dump
// ============================================================================
axisfueldump
{
	spawn
	{
		wait 200
		constructible_class 3

		setstate fueldump_solid default
		setstate fueldump_damaged invisible
		setstate fueldump_smoke1 invisible
		setstate fueldump_smoke2 invisible
		setstate fueldump_smoke3 invisible
	}

	death
	{
		trigger game_manager objective4

		setstate fueldump_smoke1 default
		setstate fueldump_smoke2 default
		setstate fueldump_smoke3 default

		trigger hurt_fueldumpblast boom
		setstate fueldump_solid invisible
		setstate fueldump_damaged default
	}
}

hurt_fueldumpblast
{
	spawn
	{
		wait 200
		setstate hurt_fueldumpblast invisible
	}

	trigger boom
	{
		setstate hurt_fueldumpblast default
		wait 100
		remove
	}
}

// ============================================================================
// Fuel Dump Barricades
// ============================================================================
frontdump
{
	spawn
	{
		wait 200
		constructible_class 2
		setstate frontdumpmaterials_stage1 default
		setstate frontdumpmaterials_stage2 default
		setstate frontdump1_trighurt invisible
		setstate frontdump2_trighurt invisible
	}

	//-----------------------------------------------------------------------
	// Stage 1 is BUILT
	//-----------------------------------------------------------------------
	built stage1
	{
		setstate frontdumpmaterials_stage1 invisible
		setstate frontdump1_trighurt default
	}

	//-----------------------------------------------------------------------
	// Stage 1 is DESTROYED
	//-----------------------------------------------------------------------
	death
	{
		setstate frontdumpmaterials_stage1 default
		setstate frontdump1_trighurt invisible

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has destroyed the East Axis Base Fortification!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "fueldump_axis_depotdef_destroyed"
		// *---------------------------------------------------------------------------------*
	}

	//-----------------------------------------------------------------------
	// Stage 2 is BUILT
	//-----------------------------------------------------------------------
	built final
	{
		setstate frontdumpmaterials_stage2 invisible
		setstate frontdump2_trighurt default

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis team has constructed the East Axis Base Fortification!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 1 "fueldump_allies_depotdef_destroy"

		wm_teamvoiceannounce 0 "fueldump_axis_depotdef_constructed"

		wm_teamvoiceannounce 1 "fueldump_allies_depotdef_destroy"

		wm_removeteamvoiceannounce 0 "fueldump_axis_depotdef_construct"
		// *---------------------------------------------------------------------------------*
	}

	//-----------------------------------------------------------------------
	// Stage 2 is DESTROYED, go back to stage 1
	//-----------------------------------------------------------------------
	destroyed final
	{
		setstate frontdumpmaterials_stage2 default
		setstate frontdump2_trighurt invisible

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has damaged the East Axis Base Fortification!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "fueldump_axis_depotdef_construct"

		wm_teamvoiceannounce 0 "fueldump_axis_depotdef_breached"

		wm_teamvoiceannounce 1 "fueldump_allies_depotdef_destroyed"

		wm_removeteamvoiceannounce 1 "fueldump_allies_depotdef_destroy"
		// *---------------------------------------------------------------------------------*
	}
}

reardump
{
	spawn
	{
		wait 200
		constructible_class 2
		setstate reardumpmaterials_stage1 default
		setstate reardumpmaterials_stage2 default
		setstate backdump1_trighurt invisible
		setstate backdump2_trighurt invisible
	}

	//-----------------------------------------------------------------------
	// Stage 1 is BUILT
	//-----------------------------------------------------------------------
	built stage1
	{
		setstate reardumpmaterials_stage1 invisible
		setstate backdump1_trighurt default
	}

	//-----------------------------------------------------------------------
	// Stage 1 is DESTROYED
	//-----------------------------------------------------------------------
	death
	{
		setstate reardumpmaterials_stage1 default
		setstate backdump1_trighurt invisible

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has destroyed the West Axis Base Fortification!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "fueldump_axis_depotdef_destroyed"
		// *---------------------------------------------------------------------------------*
	}

	//-----------------------------------------------------------------------
	// Stage 2 is BUILT
	//-----------------------------------------------------------------------
	built final
	{
		setstate reardumpmaterials_stage2 invisible
		setstate backdump2_trighurt default

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis team has constructed the West Axis Base Fortification!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 1 "fueldump_allies_depotdef_destroy"

		wm_teamvoiceannounce 0 "fueldump_axis_depotdef_constructed"

		wm_teamvoiceannounce 1 "fueldump_allies_depotdef_destroy"

		wm_removeteamvoiceannounce 0 "fueldump_axis_depotdef_construct"
		// *---------------------------------------------------------------------------------*
	}

	//-----------------------------------------------------------------------
	// Stage 2 is DESTROYED, go back to stage 1
	//-----------------------------------------------------------------------
	destroyed final
	{
		setstate reardumpmaterials_stage2 default
		setstate backdump2_trighurt invisible

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has damaged the West Axis Base Fortification!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "fueldump_axis_depotdef_construct"

		wm_teamvoiceannounce 0 "fueldump_axis_depotdef_breached"

		wm_teamvoiceannounce 1 "fueldump_allies_depotdef_destroyed"

		wm_removeteamvoiceannounce 1 "fueldump_allies_depotdef_destroy"
		// *---------------------------------------------------------------------------------*
	}
}

// ============================================================================
// Footbridge on Allied side of the map
// ============================================================================
footbridge
{
	spawn
	{
		wait 200
		constructible_class 2
		setstate footbridge invisible
		setstate footbridgematerials default
		setstate lms_footbridge invisible
	}

	buildstart final
	{
		setstate footbridge underconstruction
	}

	built final
	{
		setstate footbridge default
		setstate footbridgematerials invisible

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has constructed the Foot Bridge!"
	}

	decayed final
	{
		setstate footbridge invisible
		setstate footbridgematerials default
	}

	death
	{
		setstate footbridge invisible
		setstate footbridgematerials default

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis team has destroyed the Foot Bridge!"
	}
}

// ============================================================================
// Allied MG42 Nest - on Allied side of the map
// ============================================================================
alliedbarnmg42nest
{
	spawn
	{
		wait 200

		constructible_class 2

		setstate alliedbarnmg42 invisible
		setstate alliedbarnmg42materials default
	}

	buildstart final
	{
		setstate alliedbarnmg42 underconstruction
	}

	built final
	{
		setstate alliedbarnmg42 default
		setstate alliedbarnmg42materials invisible

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has constructed the Road MG Nest!"
	}

	decayed final
	{
		setstate alliedbarnmg42 invisible
		setstate alliedbarnmg42materials default
	}

	death
	{
		setstate alliedbarnmg42 invisible
		setstate alliedbarnmg42materials default
		repairmg42 alliedbarnmg42

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis team has destroyed the Road MG Nest!"
	}
}

// ============================================================================
// AXIS GUARD TOWER - on Allied side of the map
// ============================================================================
axistunneltower
{
	spawn
	{
		wait 200
		constructible_class 2
		setstate axistunneltower invisible
		setstate axistunneltowermg42 invisible
		setstate tunneltowermaterials default
	}

	buildstart final
	{
		setstate axistunneltower underconstruction
		setstate axistunneltowermg42 underconstruction
	}

	built final
	{
		setstate axistunneltower default
		setstate axistunneltowermg42 default
		setstate tunneltowermaterials invisible

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis team has constructed the Tunnel MG!"
	}

	decayed final
	{
		setstate axistunneltower invisible
		setstate axistunneltowermg42 invisible
		setstate tunneltowermaterials default
	}

	death
	{
		trigger axistunneltowerblast boom

		setstate axistunneltower invisible
		setstate axistunneltowermg42 invisible
		repairmg42 axistunneltowermg42

		setstate tunneltowermaterials default

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has destroyed the Tunnel MG!"
	}
}

// Trigger hurt brush around the tower to catch all people
//  in the tower when it is destroyed.
axistunneltowerblast
{
	spawn
	{
		wait 200
		setstate axistunneltowerblast invisible
	}

	trigger boom
	{
		setstate axistunneltowerblast default
		wait 500
		setstate axistunneltowerblast invisible
	}
}

// ============================================================================
// ALLIED MG42 NEST next to the tank bay
// - on Axis side of the map
// ============================================================================
alliedsidemg42
{
	spawn
	{
		wait 200
		constructible_class 2
		setstate alliedsidemg42_sandbags invisible
		setstate alliedsidemg42_gun invisible
	}

	buildstart final
	{
		setstate alliedsidemg42_sandbags underconstruction
		setstate alliedsidemg42_gun underconstruction
	}

	built final
	{
		setstate alliedsidemg42_sandbags default
		setstate alliedsidemg42_gun default
		setstate sidetowermaterials invisible

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has constructed the Side MG Nest!"
	}

	decayed final
	{
		setstate alliedsidemg42_sandbags invisible
		setstate alliedsidemg42_gun invisible
	}

	death
	{
		setstate alliedsidemg42_sandbags invisible
		setstate alliedsidemg42_gun invisible
		repairmg42 alliedsidemg42_gun

		setstate sidetowermaterials default

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis team has destroyed the Side MG Nest!"
	}
}

// ============================================================================
// AXIS GUARD TOWER next to the tank bay
// - on Axis side of the map
// ============================================================================
axissidetower
{
	spawn
	{
		wait 200
		constructible_class 2
		setstate axissidetower invisible
		setstate axissidetowermg42 invisible
		setstate sidetowermaterials default
	}

	buildstart final
	{
		setstate axissidetower underconstruction
		setstate axissidetowermg42 underconstruction
	}

	built final
	{
		setstate axissidetower default
		setstate axissidetowermg42 default
		setstate sidetowermaterials invisible

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis team has constructed the Side MG Nest!"
	}

	decayed final
	{
		setstate axissidetower invisible
		setstate axissidetowermg42 invisible
	}

	death
	{
		trigger axissidetowerblast boom

		setstate axissidetower invisible
		setstate axissidetowermg42 invisible
		repairmg42 axissidetowermg42

		setstate sidetowermaterials default

		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has destroyed the Side MG Nest!"
	}
}

// Trigger hurt brush around the tower to catch all people
//  in the tower when it is destroyed.
axissidetowerblast
{
	spawn
	{
		wait 200
		setstate axissidetowerblast invisible
	}

	trigger boom
	{
		setstate axissidetowerblast default
		wait 500
		setstate axissidetowerblast invisible
	}
}

// ============================================================================
// Tank stuff starts here
// ============================================================================
tank_sound
{
	trigger start
	{
		trigger tank sound_start
		wait 3400
		trigger tank sound_move
	}

	trigger stop
	{
		trigger tank sound_stop
		wait 1400
		trigger tank sound_idle
	}

	trigger rebirth
	{
		trigger tank sound_rebirth
		wait 1400
		trigger tank sound_idle
	}
}

// digibob: converting truck script from goldrush over...
// ============================================================================
// accum 0, dynamite count
// accum 1
//  - bit 0: bridge state		( 0 = not built,	1 = built		)
//  - bit 1: blank 				(									)
//  - bit 2: spline status 		( 0 = not moving, 	1 = moving 		)
//  - bit 3: stuck check flag 	( 0 = not stuck, 	1 = stuck 		)
//  - bit 4: blank 				(									)
//  - bit 5: track state		( 0 = stopped,		1 = forward		)
//  - bit 6: temp register 		(XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)
//  - bit 7: death status 		( 0 = alive, 		1 = dead		)
//  - bit 8: player check 		( 0 = players, 		1 = no players	)
//  - bit 9: visible state		( 0 = alive, 		1 = dead		)
// accum 2, blank
// accum 3, current movement loop position
// accum 4, stop counter
// accum 5, lockout ref counter
// accum 6, blank
// accum 7, blank
// ===========================================================================================
// spline points are spln0 -> spln65 tunnel1 -> tunnel12 spln66 -> spln86 spln2_0 -> spln2_39
// ===========================================================================================
// track events:
//  - tracks_forward
//  - tracks_stop
//  - tracks_turningleft
//  - tracks_turningright

tank
{
	spawn
	{
		wait 50
		faceangles 0 180 0 50
		trigger self sound_idle

		accum 1 bitset 5
		trigger self tracks_stop

		// Reset the tank+turret into correct position
		followspline 0 spln0 10000 wait length -64
		followspline 1 spln0 10000 wait length -64

		// Instant test teleporter
		// accum 3 set 90
	}

// ===========================================================================================
	trigger startfire
	{
		startanimation 67 8 10 nolerp norandom
	}

	trigger stopfire
	{
		startanimation 0 1 15 nolerp norandom
	}
// ===========================================================================================
	trigger sound_idle
	{
		stopsound
		playsound sound/vehicles/tank/tank_idle.wav looping volume 512
	}

	trigger sound_start
	{
		stopsound
		playsound sound/vehicles/tank/tank_revup.wav volume 196
	}

	trigger sound_move
	{
		stopsound
		playsound sound/vehicles/tank/tank_move.wav looping volume 512
	}

	trigger sound_stop
	{
		stopsound
		playsound sound/vehicles/tank/tank_revdown.wav volume 196
	}

	trigger sound_death
	{
		stopsound
		playsound sound/vehicles/tank/tank_stop.wav volume 256
	}

	trigger sound_rebirth
	{
		stopsound
		playsound sound/vehicles/tank/tank_start.wav volume 196
	}
// ===========================================================================================
	trigger tracks_forward
	{
		accum 1 abort_if_bitset 5
		accum 1 bitset 5

		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_forward
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_forward
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_forward
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_forward
		remapshaderflush
	}

	trigger tracks_turningleft
	{
		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_forward
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_forward
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_backward
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_backward
		remapshaderflush
	}

	trigger tracks_turningright
	{
		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_backward
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_backward
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_forward
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_forward
		remapshaderflush
	}

	trigger tracks_stop
	{
		accum 1 abort_if_not_bitset 5
		accum 1 bitreset 5

		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_r
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_r
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_l
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_l
		remapshaderflush
	}
// ===========================================================================================
// ===========================================================================================
	trigger run_incpos
	{
		accum 3 inc 1
	}

	trigger run_continue
	{
		trigger self run_incpos
		trigger self deathcheck
		trigger self stopcheck
		trigger self move
	}
// ===========================================================================================
// ===========================================================================================
// movement
	trigger move_check
	{
		trigger self stuck_check
		accum 1 abort_if_bitset 3

		trigger self dispatch
	}

	trigger move
	{
		trigger self move_check

		wait 500

		trigger self move
	}

	trigger dispatch
	{
		accum 3 trigger_if_equal 0 tank run_0
		accum 3 trigger_if_equal 1 tank run_1
		accum 3 trigger_if_equal 2 tank run_2
		accum 3 trigger_if_equal 3 tank run_3
		accum 3 trigger_if_equal 4 tank run_4
		accum 3 trigger_if_equal 5 tank run_5
		accum 3 trigger_if_equal 6 tank run_6
		accum 3 trigger_if_equal 7 tank run_7
		accum 3 trigger_if_equal 8 tank run_8
		accum 3 trigger_if_equal 9 tank run_9
		accum 3 trigger_if_equal 10 tank run_10
		accum 3 trigger_if_equal 11 tank run_11
		accum 3 trigger_if_equal 12 tank run_12
		accum 3 trigger_if_equal 13 tank run_13

		//-----------------------------------------
		// First corner by the road MG nest
		//-----------------------------------------
		// accum 3 trigger_if_equal 14 tank run_14

		accum 3 trigger_if_equal 15 tank run_15
		accum 3 trigger_if_equal 16 tank run_16
		accum 3 trigger_if_equal 17 tank run_17
		accum 3 trigger_if_equal 18 tank run_18
		accum 3 trigger_if_equal 19 tank run_19
		accum 3 trigger_if_equal 20 tank run_20
		accum 3 trigger_if_equal 21 tank run_21
		accum 3 trigger_if_equal 22 tank run_22
		accum 3 trigger_if_equal 23 tank run_23
		accum 3 trigger_if_equal 24 tank run_24
		accum 3 trigger_if_equal 25 tank run_25
		accum 3 trigger_if_equal 26 tank run_26
		accum 3 trigger_if_equal 27 tank run_27
		accum 3 trigger_if_equal 28 tank run_28
		accum 3 trigger_if_equal 29 tank run_29
		accum 3 trigger_if_equal 30 tank run_30
		accum 3 trigger_if_equal 31 tank run_31
		accum 3 trigger_if_equal 32 tank run_32
		accum 3 trigger_if_equal 33 tank run_33
		accum 3 trigger_if_equal 34 tank run_34
		accum 3 trigger_if_equal 35 tank run_35
		accum 3 trigger_if_equal 36 tank run_36
		accum 3 trigger_if_equal 37 tank run_37
		accum 3 trigger_if_equal 38 tank run_38
		accum 3 trigger_if_equal 39 tank run_39
		accum 3 trigger_if_equal 40 tank run_40
		accum 3 trigger_if_equal 41 tank run_41
		accum 3 trigger_if_equal 42 tank run_42

		//-----------------------------------------
		// Turning outside of cave front doors
		//-----------------------------------------
		// accum 3 trigger_if_equal 43 tank run_43

		accum 3 trigger_if_equal 44 tank run_44
		accum 3 trigger_if_equal 45 tank run_45
		accum 3 trigger_if_equal 46 tank run_46
		accum 3 trigger_if_equal 47 tank run_47
		accum 3 trigger_if_equal 48 tank run_48
		accum 3 trigger_if_equal 49 tank run_49
		accum 3 trigger_if_equal 50 tank run_50
		accum 3 trigger_if_equal 51 tank run_51
		accum 3 trigger_if_equal 52 tank run_52
		accum 3 trigger_if_equal 53 tank run_53
		accum 3 trigger_if_equal 54 tank run_54
		accum 3 trigger_if_equal 55 tank run_55
		accum 3 trigger_if_equal 56 tank run_56
		accum 3 trigger_if_equal 57 tank run_57
		accum 3 trigger_if_equal 58 tank run_58
		accum 3 trigger_if_equal 59 tank run_59
		accum 3 trigger_if_equal 60 tank run_60

		//-----------------------------------------
		// First corner of cave route
		// accum 3 trigger_if_equal 61 tank run_61

		accum 3 trigger_if_equal 62 tank run_62
		// accum 3 trigger_if_equal 63 tank run_63
		accum 3 trigger_if_equal 64 tank run_64

		accum 3 trigger_if_equal 65 tank run_65
		accum 3 trigger_if_equal 66 tank run_66
		accum 3 trigger_if_equal 67 tank run_67
		accum 3 trigger_if_equal 68 tank run_68
		accum 3 trigger_if_equal 69 tank run_69
		accum 3 trigger_if_equal 70 tank run_70
		accum 3 trigger_if_equal 71 tank run_71
		accum 3 trigger_if_equal 72 tank run_72

		//-----------------------------------------
		// Last corner of cave route
		// accum 3 trigger_if_equal 73 tank run_73

		accum 3 trigger_if_equal 74 tank run_74
		accum 3 trigger_if_equal 75 tank run_75
		accum 3 trigger_if_equal 76 tank run_76
		accum 3 trigger_if_equal 77 tank run_77
		accum 3 trigger_if_equal 78 tank run_78
		accum 3 trigger_if_equal 79 tank run_79
		accum 3 trigger_if_equal 80 tank run_80
		accum 3 trigger_if_equal 81 tank run_81
		accum 3 trigger_if_equal 82 tank run_82
		accum 3 trigger_if_equal 83 tank run_83
		accum 3 trigger_if_equal 84 tank run_84
		accum 3 trigger_if_equal 85 tank run_85
		accum 3 trigger_if_equal 86 tank run_86
		accum 3 trigger_if_equal 87 tank run_87
		accum 3 trigger_if_equal 88 tank run_88
		accum 3 trigger_if_equal 89 tank run_89
		accum 3 trigger_if_equal 90 tank run_90
		accum 3 trigger_if_equal 91 tank run_91
		accum 3 trigger_if_equal 92 tank run_92
		accum 3 trigger_if_equal 93 tank run_93
		accum 3 trigger_if_equal 94 tank run_94
		accum 3 trigger_if_equal 95 tank run_95
		accum 3 trigger_if_equal 96 tank run_96
		accum 3 trigger_if_equal 97 tank run_97
		accum 3 trigger_if_equal 98 tank run_98
		accum 3 trigger_if_equal 99 tank run_99
		accum 3 trigger_if_equal 100 tank run_100
		accum 3 trigger_if_equal 101 tank run_101
		accum 3 trigger_if_equal 102 tank run_102
		accum 3 trigger_if_equal 103 tank run_103
		accum 3 trigger_if_equal 104 tank run_104
		accum 3 trigger_if_equal 105 tank run_105
		accum 3 trigger_if_equal 106 tank run_106
		accum 3 trigger_if_equal 107 tank run_107
		accum 3 trigger_if_equal 108 tank run_108
		accum 3 trigger_if_equal 109 tank run_109
		accum 3 trigger_if_equal 110 tank run_110
		accum 3 trigger_if_equal 111 tank run_111
		accum 3 trigger_if_equal 112 tank run_112
		accum 3 trigger_if_equal 113 tank run_113
		accum 3 trigger_if_equal 114 tank run_114
		accum 3 trigger_if_equal 115 tank run_115
		accum 3 trigger_if_equal 116 tank run_116
		accum 3 trigger_if_equal 117 tank run_117
		accum 3 trigger_if_equal 118 tank run_118
		accum 3 trigger_if_equal 119 tank run_119
		accum 3 trigger_if_equal 120 tank run_120
		accum 3 trigger_if_equal 121 tank run_121
		accum 3 trigger_if_equal 122 tank run_122
		accum 3 trigger_if_equal 123 tank run_123
		accum 3 trigger_if_equal 124 tank run_124
		accum 3 trigger_if_equal 125 tank run_125
		accum 3 trigger_if_equal 126 tank run_126
		accum 3 trigger_if_equal 127 tank run_127
		accum 3 trigger_if_equal 128 tank run_128
		accum 3 trigger_if_equal 129 tank run_129
		accum 3 trigger_if_equal 130 tank run_130
		accum 3 trigger_if_equal 131 tank run_131
		accum 3 trigger_if_equal 132 tank run_132
		accum 3 trigger_if_equal 133 tank run_133
	}

// ===========================================================================================
// ===========================================================================================
	trigger run_0
	{
		accum 1 bitset 2
		trigger tank_turret2 run_0
		followspline 0 spln0 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_1
	{
		accum 1 bitset 2
		trigger tank_turret2 run_1
		followspline 0 spln1 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_2
	{
		accum 1 bitset 2
		trigger tank_turret2 run_2
		followspline 0 spln2 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Jig next to spawn hut
	//-----------------------------------------------------------------------
	trigger run_3
	{
		accum 1 bitset 2
		trigger tank_turret2 run_3

		// Start tracks turning in opp directions
		trigger self 		tracks_turningright

		followspline 0 spln3 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_4
	{
		accum 1 bitset 2
		trigger tank_turret2 run_4
		followspline 0 spln4 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Jig next to spawn hut
	//-----------------------------------------------------------------------
	trigger run_5
	{
		accum 1 bitset 2
		trigger tank_turret2 run_5

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		followspline 0 spln5 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_6
	{
		accum 1 bitset 2
		trigger tank_turret2 run_6
		followspline 0 spln6 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_7
	{
		accum 1 bitset 2
		trigger tank_turret2 run_7
		followspline 0 spln7 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_8
	{
		accum 1 bitset 2
		trigger tank_turret2 run_8
		followspline 0 spln8 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Jig next to fence
	//-----------------------------------------------------------------------
	trigger run_9
	{
		accum 1 bitset 2
		trigger tank_turret2 run_9

		// Start tracks turning in opp directions
		trigger self 		tracks_turningright

		followspline 0 spln9 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Jig next to fence
	//-----------------------------------------------------------------------
	trigger run_10
	{
		accum 1 bitset 2
		trigger tank_turret2 run_10

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		followspline 0 spln10 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_11
	{
		accum 1 bitset 2
		trigger tank_turret2 run_11
		followspline 0 spln11 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_12
	{
		accum 1 bitset 2
		trigger tank_turret2 run_12
		followspline 0 spln12 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// First corner past road MG nest
	//-----------------------------------------------------------------------
	trigger run_13
	{
		accum 1 bitset 2
		trigger tank_turret2 run_13

		// Start tracks turning in opp directions
		trigger self 		tracks_turningright

		followspline 0 spln13 80 wait length -64
		followspline 0 spln14 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_incpos
		trigger self run_continue
	}

	trigger run_15
	{
		accum 1 bitset 2
		trigger tank_turret2 run_15
		followspline 0 spln15 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_16
	{
		accum 1 bitset 2
		trigger tank_turret2 run_16
		followspline 0 spln16 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_17
	{
		accum 1 bitset 2
		trigger tank_turret2 run_17
		followspline 0 spln17 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Small track skip opp MG nest
	//-----------------------------------------------------------------------
	trigger run_18
	{
		accum 1 bitset 2
		trigger tank_turret2 run_18

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		followspline 0 spln18 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_19
	{
		accum 1 bitset 2
		trigger tank_turret2 run_19
		followspline 0 spln19 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_20
	{
		accum 1 bitset 2
		trigger tank_turret2 run_20
		followspline 0 spln20 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_21
	{
		accum 1 bitset 2
		trigger tank_turret2 run_21
		followspline 0 spln21 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_22
	{
		accum 1 bitset 2
		trigger tank_turret2 run_22
		followspline 0 spln22 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_23
	{
		accum 1 bitset 2
		trigger tank_turret2 run_23
		followspline 0 spln23 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Small track skip near signpost
	//-----------------------------------------------------------------------
	trigger run_24
	{
		accum 1 bitset 2
		trigger tank_turret2 run_24

		// Start tracks turning in opp directions
		trigger self 		tracks_turningright

		followspline 0 spln24 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_25
	{
		accum 1 bitset 2
		trigger tank_turret2 run_25
		followspline 0 spln25 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Small track skip near signpost
	//-----------------------------------------------------------------------
	trigger run_26
	{
		accum 1 bitset 2
		trigger tank_turret2 run_26

		// Start tracks turning in opp directions
		trigger self 		tracks_turningright

		followspline 0 spln26 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_27
	{
		accum 1 bitset 2
		trigger tank_turret2 run_27
		followspline 0 spln27 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Small track skip near signpost
	//-----------------------------------------------------------------------
	trigger run_28
	{
		accum 1 bitset 2
		trigger tank_turret2 run_28

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		followspline 0 spln28 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_29
	{
		accum 1 bitset 2
		trigger tank_turret2 run_29
		followspline 0 spln29 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_30
	{
		accum 1 bitset 2
		trigger tank_turret2 run_30
		followspline 0 spln30 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Second corner before river bridge
	//-----------------------------------------------------------------------
	trigger run_31
	{
		accum 1 bitset 2
		trigger tank_turret2 run_31

		// Start tracks turning in opp directions
		trigger self 		tracks_turningright

		followspline 0 spln31 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Destroy frozen river grate
	//-----------------------------------------------------------------------
	trigger run_32
	{
		accum 1 bitset 2
		trigger tank_turret2 run_32
		followspline 0 spln32 80 wait length -64
		accum 1 bitreset 2

		trigger self		script_lockout

		trigger self 		tracks_stop
		trigger tank_sound 	stop

		startanimation 45 	10 	15 nolerp norandom
		wait 666
		startanimation 0 	1 	15 nolerp norandom
		wait 900

		trigger self run_incpos

		trigger tank_turret turn4 // will break the lockout
	}

	trigger run_33
	{
		accum 1 bitset 2
		trigger tank_turret2 run_33
		followspline 0 spln33 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_34
	{
		accum 1 bitset 2
		trigger tank_turret2 run_34
		followspline 0 spln34 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// River bridge
	//-----------------------------------------------------------------------
	trigger run_35
	{
		accum 1 bitset 2
		trigger tank_turret2 run_35
		followspline 0 spln35 80 wait length -64
		followspline 0 spln36 80 wait length -64
		followspline 0 spln37 80 wait length -64
		followspline 0 spln38 80 wait length -64
		followspline 0 spln39 80 wait length -64
		followspline 0 spln40 80 wait length -64
		accum 1 bitreset 2

		// setup sounds
		trigger thebridge tank_passed	// Remove all bridge ref VO

		trigger self run_continue
	}

	trigger run_36
	{
		accum 1 bitset 2
		trigger tank_turret2 run_36
		followspline 0 spln41 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_37
	{
		accum 1 bitset 2
		trigger tank_turret2 run_37
		followspline 0 spln42 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_38
	{
		accum 1 bitset 2
		trigger tank_turret2 run_38
		followspline 0 spln43 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_39
	{
		accum 1 bitset 2
		trigger tank_turret2 run_39
		followspline 0 spln44 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_40
	{
		accum 1 bitset 2
		trigger tank_turret2 run_40
		followspline 0 spln45 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Destroy cave front door
	//-----------------------------------------------------------------------
	trigger run_41
	{
		accum 1 bitset 2
		trigger tank_turret2 run_41
		followspline 0 spln46 80 wait length -64
		accum 1 bitreset 2

		trigger self		script_lockout

		trigger self 		tracks_stop
		trigger tank_sound 	stop

		startanimation 45 	10 	15 nolerp norandom
		wait 666
		startanimation 0 	1 	15 nolerp norandom
		wait 900

		trigger self run_incpos
		trigger tank_turret turn
	}

	trigger run_42
	{
		accum 1 bitset 2
		trigger tank_turret2 run_42

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		followspline 0 spln47 80 wait length -64
		followspline 0 spln48 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_incpos
		trigger self run_continue
	}

	trigger run_44
	{
		accum 1 bitset 2
		trigger tank_turret2 run_44
		followspline 0 spln49 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_45
	{
		accum 1 bitset 2
		trigger tank_turret2 run_45
		followspline 0 spln50 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_46
	{
		accum 1 bitset 2
		trigger tank_turret2 run_46
		followspline 0 spln51 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_47
	{
		accum 1 bitset 2
		trigger tank_turret2 run_47
		followspline 0 spln52 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_48
	{
		accum 1 bitset 2
		trigger tank_turret2 run_48
		followspline 0 spln53 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_49
	{
		accum 1 bitset 2
		trigger tank_turret2 run_49
		followspline 0 spln54 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_50
	{
		accum 1 bitset 2
		trigger tank_turret2 run_50
		followspline 0 spln55 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_51
	{
		accum 1 bitset 2
		trigger tank_turret2 run_51
		followspline 0 spln56 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_52
	{
		accum 1 bitset 2
		trigger tank_turret2 run_52
		followspline 0 spln57 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_53
	{
		accum 1 bitset 2
		trigger tank_turret2 run_53
		followspline 0 spln58 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_54
	{
		accum 1 bitset 2
		trigger tank_turret2 run_54
		followspline 0 spln59 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_55
	{
		accum 1 bitset 2
		trigger tank_turret2 run_55
		followspline 0 spln60 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_56
	{
		accum 1 bitset 2
		trigger tank_turret2 run_56
		followspline 0 spln61 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_57
	{
		accum 1 bitset 2
		trigger tank_turret2 run_57
		followspline 0 spln62 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_58
	{
		accum 1 bitset 2
		trigger tank_turret2 run_58
		followspline 0 spln63 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_59
	{
		accum 1 bitset 2
		trigger tank_turret2 run_59
		followspline 0 spln64 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// First section of the mountain tunnel
	//-----------------------------------------------------------------------
	trigger run_60
	{
		accum 1 bitset 2
		trigger tank_turret2 run_60

		// Start tracks turning in opp directions
		trigger self 		tracks_turningright

		followspline 0 spln65 80 wait length -64 roll 0 -1 dampout
		followspline 0 tunnel1 80 wait length -64 roll -1 5 dampin dampout

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_incpos
		trigger self run_continue
	}

	trigger run_62
	{
		accum 1 bitset 2
		trigger tank_turret2 run_62

		followspline 0 tunnel2 80 wait length -64 roll 4 1 dampout
		followspline 0 tunnel3 80 wait length -64 roll 5 -5 dampin

		accum 1 bitreset 2
		trigger self run_incpos
		trigger self run_continue
	}

	trigger run_64
	{
		accum 1 bitset 2
		trigger tank_turret2 run_64
		followspline 0 tunnel4 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}
	//-----------------------------------------------------------------------
	// Turning past cave spawn exit
	//-----------------------------------------------------------------------
	trigger run_65
	{
		accum 1 bitset 2
		trigger tank_turret2 run_65

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		followspline 0 tunnel5 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_66
	{
		accum 1 bitset 2
		trigger tank_turret2 run_66
		followspline 0 tunnel6 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_67
	{
		accum 1 bitset 2
		trigger tank_turret2 run_67
		followspline 0 tunnel7 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Turning past small cave exit on axis side
	//-----------------------------------------------------------------------
	trigger run_68
	{
		accum 1 bitset 2
		trigger tank_turret2 run_68

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		followspline 0 tunnel8 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_69
	{
		accum 1 bitset 2
		trigger tank_turret2 run_69
		followspline 0 tunnel9 80 wait length -64 roll 0 1 dampout
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_70
	{
		accum 1 bitset 2
		trigger tank_turret2 run_70
		followspline 0 tunnel10 80 wait length -64 roll 1 4 dampin
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_71
	{
		accum 1 bitset 2
		trigger tank_turret2 run_71
		followspline 0 tunnel11 80 wait length -64 roll 5 1 dampin
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Final corner in the cave system
	//-----------------------------------------------------------------------
	trigger run_72
	{
		accum 1 bitset 2
		trigger tank_turret2 run_72
		followspline 0 tunnel12 80 wait length -64 roll 6 -4 dampin

		// Start tracks turning in opp directions
		trigger self 		tracks_turningright

		followspline 0 spln66 80 wait length -64 roll 2 -2 dampin dampout

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_incpos
		trigger self run_continue
	}

	trigger run_74
	{
		accum 1 bitset 2
		trigger tank_turret2 run_74
		followspline 0 spln67 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_75
	{
		accum 1 bitset 2
		trigger tank_turret2 run_75
		followspline 0 spln68 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_76
	{
		accum 1 bitset 2
		trigger tank_turret2 run_76
		followspline 0 spln69 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_77
	{
		accum 1 bitset 2
		trigger tank_turret2 run_77
		followspline 0 spln70 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_78
	{
		accum 1 bitset 2
		trigger tank_turret2 run_78
		followspline 0 spln71 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_79
	{
		accum 1 bitset 2
		trigger tank_turret2 run_79
		followspline 0 spln72 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_80
	{
		accum 1 bitset 2
		trigger tank_turret2 run_80
		followspline 0 spln73 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_81
	{
		accum 1 bitset 2
		trigger tank_turret2 run_81
		followspline 0 spln74 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_82
	{
		accum 1 bitset 2
		trigger tank_turret2 run_82
		followspline 0 spln75 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_83
	{
		accum 1 bitset 2
		trigger tank_turret2 run_83
		followspline 0 spln76 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_84
	{
		accum 1 bitset 2
		trigger tank_turret2 run_84
		followspline 0 spln77 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_85
	{
		accum 1 bitset 2
		trigger tank_turret2 run_85
		followspline 0 spln78 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_86
	{
		accum 1 bitset 2
		trigger tank_turret2 run_86
		followspline 0 spln79 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_87
	{
		accum 1 bitset 2
		trigger tank_turret2 run_87
		followspline 0 spln80 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_88
	{
		accum 1 bitset 2
		trigger tank_turret2 run_88
		followspline 0 spln81 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_89
	{
		accum 1 bitset 2
		trigger tank_turret2 run_89
		followspline 0 spln82 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_90
	{
		accum 1 bitset 2
		trigger tank_turret2 run_90
		followspline 0 spln83 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_91
	{
		accum 1 bitset 2
		trigger tank_turret2 run_91
		followspline 0 spln84 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_92
	{
		accum 1 bitset 2
		trigger tank_turret2 run_92
		followspline 0 spln85 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Front of AXIS base
	//-----------------------------------------------------------------------
	trigger run_93
	{
		accum 1 bitset 2
		trigger tank_turret2 run_93
		followspline 0 spln86 80 wait length -64
		accum 1 bitreset 2

		trigger self		script_lockout

		trigger self 		tracks_stop
		trigger tank_sound 	stop

		startanimation 45 10 15 nolerp norandom
		wait 666
		startanimation 0 1 15 nolerp norandom
		wait 900

		trigger tank_turret turn2

		trigger self run_incpos

	}

	//-----------------------------------------------------------------------
	// Turning round for the next route
	//-----------------------------------------------------------------------
	trigger run_94
	{
		accum 1 bitset 2
		trigger tank_turret2 run_94

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		faceangles 0 105 0 8000 // pitch yaw roll time(ms)

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_95
	{
		accum 1 bitset 2
		trigger tank_turret2 run_95
		followspline 0 spln2_0 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_96
	{
		accum 1 bitset 2
		trigger tank_turret2 run_96
		followspline 0 spln2_1 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_97
	{
		accum 1 bitset 2
		trigger tank_turret2 run_97
		followspline 0 spln2_2 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Turning towards tank bay path
	//-----------------------------------------------------------------------
	trigger run_98
	{
		accum 1 bitset 2
		trigger tank_turret2 run_98

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		followspline 0 spln2_3 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_99
	{
		accum 1 bitset 2
		trigger tank_turret2 run_99
		followspline 0 spln2_4 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_100
	{
		accum 1 bitset 2
		trigger tank_turret2 run_100
		followspline 0 spln2_5 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_101
	{
		accum 1 bitset 2
		trigger tank_turret2 run_101
		followspline 0 spln2_6 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_102
	{
		accum 1 bitset 2
		trigger tank_turret2 run_102
		followspline 0 spln2_7 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_103
	{
		accum 1 bitset 2
		trigger tank_turret2 run_103
		followspline 0 spln2_8 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Turning to face the tank bay
	//-----------------------------------------------------------------------
	trigger run_104
	{
		accum 1 bitset 2
		trigger tank_turret2 run_104

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		followspline 0 spln2_9 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_105
	{
		accum 1 bitset 2
		trigger tank_turret2 run_105
		followspline 0 spln2_10 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_106
	{
		accum 1 bitset 2
		trigger tank_turret2 run_106
		followspline 0 spln2_11 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_107
	{
		accum 1 bitset 2
		trigger tank_turret2 run_107
		followspline 0 spln2_12 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Turning down the side of the tank bay
	//-----------------------------------------------------------------------
	trigger run_108
	{
		accum 1 bitset 2
		trigger tank_turret2 run_108

		// Start tracks turning in opp directions
		trigger self 		tracks_turningright

		followspline 0 spln2_13 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_109
	{
		accum 1 bitset 2
		trigger tank_turret2 run_109
		followspline 0 spln2_14 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_110
	{
		accum 1 bitset 2
		trigger tank_turret2 run_110
		followspline 0 spln2_15 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_111
	{
		accum 1 bitset 2
		trigger tank_turret2 run_111
		followspline 0 spln2_16 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_112
	{
		accum 1 bitset 2
		trigger tank_turret2 run_112
		followspline 0 spln2_17 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_113
	{
		accum 1 bitset 2
		trigger tank_turret2 run_113
		followspline 0 spln2_18 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_114
	{
		accum 1 bitset 2
		trigger tank_turret2 run_114
		followspline 0 spln2_19 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_115
	{
		accum 1 bitset 2
		trigger tank_turret2 run_115
		followspline 0 spln2_20 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_116
	{
		accum 1 bitset 2
		trigger tank_turret2 run_116
		followspline 0 spln2_21 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_117
	{
		accum 1 bitset 2
		trigger tank_turret2 run_117
		followspline 0 spln2_22 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_118
	{
		accum 1 bitset 2
		trigger tank_turret2 run_118
		followspline 0 spln2_23 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_119
	{
		accum 1 bitset 2
		trigger tank_turret2 run_119
		followspline 0 spln2_24 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_120
	{
		accum 1 bitset 2
		trigger tank_turret2 run_120
		followspline 0 spln2_25 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	//-----------------------------------------------------------------------
	// Final turn towards fueldump
	//-----------------------------------------------------------------------
	trigger run_121
	{
		accum 1 bitset 2
		trigger tank_turret2 run_121

		// Start tracks turning in opp directions
		trigger self 		tracks_turningleft

		followspline 0 spln2_26 80 wait length -64

		// Reset tracks back to forward motion
		accum 1 bitreset 5
		trigger self 		tracks_forward

		accum 1 bitreset 2
		trigger self run_continue
	}

	trigger run_122
	{
		accum 1 bitset 2
		trigger tank_turret2 run_122
		followspline 0 spln2_27 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_123
	{
		accum 1 bitset 2
		trigger tank_turret2 run_123
		followspline 0 spln2_28 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_124
	{
		accum 1 bitset 2
		trigger tank_turret2 run_124
		followspline 0 spln2_29 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_125
	{
		accum 1 bitset 2
		trigger tank_turret2 run_125
		followspline 0 spln2_30 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_126
	{
		accum 1 bitset 2
		trigger tank_turret2 run_126
		followspline 0 spln2_31 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_127
	{
		accum 1 bitset 2
		trigger tank_turret2 run_127
		followspline 0 spln2_32 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_128
	{
		accum 1 bitset 2
		trigger tank_turret2 run_128
		followspline 0 spln2_33 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_129
	{
		accum 1 bitset 2
		trigger tank_turret2 run_129
		followspline 0 spln2_35 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_130
	{
		accum 1 bitset 2
		trigger tank_turret2 run_130
		followspline 0 spln2_36 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_131
	{
		accum 1 bitset 2
		trigger tank_turret2 run_131
		followspline 0 spln2_37 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_132
	{
		accum 1 bitset 2
		trigger tank_turret2 run_132
		followspline 0 spln2_38 80 wait length -64
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_133
	{
		accum 1 bitset 2
		trigger tank_turret2 run_133
		followspline 0 spln2_39 80 wait length -64 roll 0 -1 dampin dampout
		accum 1 bitreset 2

		trigger self		script_lockout

		trigger tank_construct final_pos
		trigger self tracks_stop
		trigger self sound_death
		trigger tank_sound 	stop

		startanimation 45 	10 	15 nolerp norandom
		wait 666
		startanimation 0 	1 	15 nolerp norandom
		wait 900

		trigger tank_turret turn3
		trigger self run_incpos
	}

// ===========================================================================================
// ===========================================================================================
// stuck checking
// digibob: since we cant return variables, just use bit 3 of accum 1 as a register... mmmm assembly...
	trigger stuck_check
	{
		accum 1 bitreset 3

		trigger self stuck_check_bridge_built
		trigger self stuck_check_bridge_dyna
		trigger self stuck_check_scriptlockout
		trigger self stuck_check_finished
	}

	trigger stuck_check_finished
	{
		accum 3 abort_if_less_than 134

		accum 1 bitset 3
	}

	trigger stuck_check_scriptlockout
	{
		accum 5 abort_if_equal 0

		accum 1 bitset 3
	}

	trigger stuck_check_bridge_built
	{
		accum 3 abort_if_not_equal 35

		accum 1 abort_if_bitset 0

		accum 1 bitset 3
	}

	trigger stuck_check_bridge_dyna
	{
		accum 3 abort_if_not_equal 35

		accum 0 set_to_dynamitecount bridgetarget
		accum 0 abort_if_equal 0

		accum 1 bitset 3
	}

// ===========================================================================================
// ===========================================================================================
// stop check

	trigger stopcheck_setup
	{
		accum 1 bitset 6			// stop if we're stuck/no-one's pushing :)

		accum 1 abort_if_bitset 8		// no one in the trigger, abort

		trigger self stuck_check		// call the stop check function
		accum 1 abort_if_bitset 3		// we're stuck so break out

		accum 1 bitreset 6			// we're free to move
	}

	trigger stopcheck
	{
		trigger self stopcheck_setup
		accum 1 abort_if_not_bitset 6

		trigger self script_lockout

		// Any just stopped moving stuff goes here
		trigger tank_sound 	stop
		trigger self 		tracks_stop
		startanimation 45 	10 	15 nolerp norandom
		wait 666
		startanimation 0 	1 	15 nolerp norandom
		wait 900

		trigger self script_lockout_stop
		resetscript
	}

// ===========================================================================================
// ===========================================================================================
// script lockouts

	trigger script_lockout
	{
		accum 5 inc 1
	}

	trigger script_lockout_stop
	{
		accum 5 inc -1
	}

// ===========================================================================================
// ===========================================================================================
// enable/disable

	trigger tank_enable
	{
		trigger self stuck_check
		accum 1 abort_if_bitset 3 	// stuck check

		accum 4 set 0				// reset stop counter
		accum 1 bitreset 8			// reset stop check

		accum 1 abort_if_bitset 2 	// already following spline
		accum 5 abort_if_not_equal 0	// are we not in a script lockout?

		accum 1 abort_if_bitset 7 	// death check

		// Any just started moving stuff goes here

		trigger self script_lockout

		trigger tank_sound start

		startanimation 55 10 15 nolerp norandom
		wait 666
		startanimation 5 40 15 nolerp norandom
		wait 500
		trigger self tracks_forward

		trigger self script_lockout_stop

		trigger self move
	}

	trigger tank_disable
	{
		accum 4 inc 1				// up the stop counter
		accum 4 abort_if_less_than 4

		accum 1 bitset 8			// set stop check

		trigger self deathcheck
	}

// ===========================================================================================
// ===========================================================================================
// death / rebirth

	rebirth
	{
		accum 1 bitreset 9 // we're visibly alive
		accum 1 bitreset 7 // we're alive again

		trigger self script_lockout

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_tank_repaired_allies"

		wm_teamvoiceannounce 1 "allies_hq_tank_repaired"
		// *---------------------------------------------------------------------------------*
		wm_announce "The Tank has been repaired"

		changemodel models/mapobjects/tanks_sd/churchhill.md3

		setstate tank_smoke invisible

		trigger tank_sound rebirth
		wait 500

		trigger self script_lockout_stop
	}

	death
	{
		accum 1 bitset 7
	}

	trigger deathcheck
	{
		accum 1 abort_if_not_bitset 7	// are we dead?
		accum 1 abort_if_bitset 9		// are we not already visibly dead?
		accum 1 abort_if_bitset 2		// are we not following a spline?
		accum 5 abort_if_not_equal 0	// are we not in a script lockout?

		accum 1 bitset 9				// we're now visibly dead

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_tank_damaged"

		wm_teamvoiceannounce 1 "allies_hq_tank_damaged_axis"
		// *---------------------------------------------------------------------------------*

		wm_announce "The Tank has been damaged"

		changemodel models/mapobjects/tanks_sd/churchhill_broken.md3

		setstate tank_smoke default

		kill tank_construct

		trigger self sound_death
		trigger self tracks_stop

		trigger self script_lockout

		trigger self tracks_stop
		startanimation 45 10 15 nolerp norandom
		wait 666
		startanimation 0 1 15 nolerp norandom

		trigger self script_lockout_stop

		resetscript
	}

	trigger setBridge
	{
		wm_objective_status 1 1 1
		wm_objective_status 1 0 2

		accum 1 bitset 0
	}

	trigger clearBridge
	{
		wm_objective_status 1 1 0
		wm_objective_status 1 0 0

		accum 1 bitreset 0
	}
}

tank_disabler
{
	trigger run
	{
		trigger tank tank_disable
	}
}

tank_enabler
{
	trigger run
	{
		trigger tank tank_enable
	}
}

tank_trigger
{
     spawn
     {
          wait 100

          attachtotag tank tag_turret
     }
}

tank_build
{
     spawn
     {
          wait 100

          attachtotag tank tag_turret
     }
}

tank_construct
{
	spawn
	{
		wait 400

		constructible_class 2
		constructible_health 1200
	}

	built final
	{
		alertentity tank
	}

	trigger final_pos
	{
		constructible_constructxpbonus 3
		constructible_destructxpbonus 3
	}
}

//================================================================================
// Physical tank turret MODEL
//================================================================================
tank_turret
{
	spawn
	{
		wait 500
		attachtotag tank tag_turret
	}

	//-----------------------------------------------------------------------
	// CAVE FRONT DOOR
	//-----------------------------------------------------------------------
	trigger turn
	{
		wait 1000

		trigger tank_turret2 spin_start
		trigger tank_turret2 turn
		faceangles 0 80 0 3000
		trigger tank_turret2 spin_stop

		wait 500

		trigger tank startfire
		trigger tank_turret2 avre_fire
		trigger tank_flash run
	}

	trigger blow_door
	{
		setstate tank_flash invisible

		wait 200
		trigger tank stopfire

		trigger cavedoor_solid switch
		alertentity tunnel_wobj
		setautospawn "Tunnel Store Room" 1
		setautospawn "Axis Fuel Dump" 0
		trigger game_manager objective2

		wm_objective_status 2 1 1
		wm_objective_status 2 0 2

		wait 200

		trigger tank_turret2 spin_start
		trigger tank_turret2 turn_back
		faceangles 0 0 0 3000
		trigger tank_turret2 spin_stop

		trigger tank script_lockout_stop
	}

	//-----------------------------------------------------------------------
	// AXIS BASE FRONT GATE
	//-----------------------------------------------------------------------
	trigger turn2
	{
		wait 1000

		trigger tank_turret2 spin_start
		trigger tank_turret2 turn2
		faceangles 0 348 0 2000 //-30
		trigger tank_turret2 spin_stop

		wait 500

		trigger tank startfire
		trigger tank_turret2 avre_fire
		trigger tank_flash run2
	}


	trigger blow_door2
	{
		setstate tank_flash invisible

		wait 200
		trigger tank stopfire

		trigger basedoor_solid switch
		trigger game_manager objective3

		wm_objective_status 3 1 1
		wm_objective_status 3 0 2

		wait 200

		trigger tank_turret2 spin_start
		trigger tank_turret2 turn2_back
		faceangles 0 0 0 2000
		trigger tank_turret2 spin_stop

		trigger tank script_lockout_stop
	}

	//-----------------------------------------------------------------------
	// AXIS BASE SIDE WALL
	//-----------------------------------------------------------------------
	trigger turn3
	{
		wait 1000

		trigger tank_turret2 spin_start
		trigger tank_turret2 turn3
		faceangles 0 35 0 3000
		trigger tank_turret2 spin_stop

		wait 500

		trigger tank startfire
		trigger tank_turret2 avre_fire
		trigger tank_flash run3

		trigger tank script_lockout_stop
	}

	trigger blow_door3
	{
		setstate tank_flash invisible

		wait 200
		trigger tank stopfire

		trigger basewall_solid switch
		trigger game_manager objective5

		wm_objective_status 5 1 1
		wm_objective_status 5 0 2

		wait 200

		trigger tank_turret2 spin_start
		trigger tank_turret2 turn3_back
		faceangles 0 0 0 3000
		trigger tank_turret2 spin_stop
	}


	//-----------------------------------------------------------------------
	// FROZEN STREAM - GRATE ENTRANCE
	//-----------------------------------------------------------------------
	trigger turn4
	{
		wait 1000

		trigger tank_turret2 spin_start
		trigger tank_turret2 turn4
		faceangles 0 45 0 4000 //+20
		trigger tank_turret2 spin_stop

		wait 500

		trigger tank startfire
		trigger tank_turret2 avre_fire
		trigger tank_flash run4
	}

	trigger blow_door4
	{
		setstate tank_flash invisible

		wait 200
		trigger tank stopfire

		trigger tunnelgrate_solid switch

		wait 200

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "fueldump_axis_grate_destroyed"

		wm_teamvoiceannounce 1 "fueldump_allies_grate_destroyed"
		// *---------------------------------------------------------------------------------*

		trigger tank_turret2 spin_start
		trigger tank_turret2 turn4_back
		faceangles 0 0 0 4000
		trigger tank_turret2 spin_stop

		trigger tank script_lockout_stop
	}
}

//================================================================================
// Test brushage for the tank turret
//================================================================================
tank_turret2solid
{
	spawn
	{
		remove
	}
}

//================================================================================
// Metal CLIP brush tank turret
//================================================================================
tank_turret2
{
	spawn
	{
		wait 50
		// Reset the tank+turret into correct position
		followspline 0 spln0 10000 wait length -64
		followspline 1 spln0 10000 wait length -64
	}

	trigger avre_fire
	{
		playsound sound/vehicles/tank/tank_fire.wav volume 300
	}

	trigger spin_start
	{
		stopsound
		playsound sound/vehicles/tank/turret_spin.wav looping volume 127
	}

	trigger spin_stop
	{
		stopsound
		playsound sound/vehicles/tank/turret_end.wav volume 96
	}

	//-----------------------------------------------------------------------
	// CAVE FRONT DOOR
	//-----------------------------------------------------------------------
	trigger turn
	{
		faceangles 0 170 0 3000
	}

	trigger turn_back
	{
		faceangles 0 90 0 3000

	}

	//-----------------------------------------------------------------------
	// AXIS BASE FRONT GATE sequence
	//-----------------------------------------------------------------------
	trigger turn2
	{
		faceangles 0 255 0 3000 //225
	}

	trigger turn2_back
	{
		faceangles 0 270 0 3000

	}

	//-----------------------------------------------------------------------
	// AXIS BASE SIDE WALL
	//-----------------------------------------------------------------------
	trigger turn3
	{
		faceangles 14 305 0 3000
	}

	trigger turn3_back
	{
		faceangles 8 270 0 3000
		followspline 0 spln2_39 10000 wait length -64
	}

	//-----------------------------------------------------------------------
	// FROZEN STREAM - GRATE ENTRANCE
	//-----------------------------------------------------------------------
	trigger turn4
	{
		faceangles 0 145 0 4000 //160
	}

	trigger turn4_back
	{
		faceangles 0 100 0 4000 //115
	}

	//-----------------------------------------------------------------------
	trigger run_0
	{
		followspline 0 spln0 80 wait length -64
	}

	trigger run_1
	{
		followspline 0 spln1 80 wait length -64
	}

	trigger run_2
	{
		followspline 0 spln2 80 wait length -64
	}

	trigger run_3
	{
		followspline 0 spln3 80 wait length -64
	}

	trigger run_4
	{
		followspline 0 spln4 80 wait length -64
	}

	trigger run_5
	{
		followspline 0 spln5 80 wait length -64
	}

	trigger run_6
	{
		followspline 0 spln6 80 wait length -64
	}

	trigger run_7
	{
		followspline 0 spln7 80 wait length -64
	}

	trigger run_8
	{
		followspline 0 spln8 80 wait length -64
	}

	trigger run_9
	{
		followspline 0 spln9 80 wait length -64
	}

	trigger run_10
	{
		followspline 0 spln10 80 wait length -64
	}

	trigger run_11
	{
		followspline 0 spln11 80 wait length -64
	}

	trigger run_12
	{
		followspline 0 spln12 80 wait length -64
	}

	trigger run_13
	{
		followspline 0 spln13 80 wait length -64
		followspline 0 spln14 80 wait length -64
	}

	trigger run_15
	{
		followspline 0 spln15 80 wait length -64
	}

	trigger run_16
	{
		followspline 0 spln16 80 wait length -64
	}

	trigger run_17
	{
		followspline 0 spln17 80 wait length -64
	}

	trigger run_18
	{
		followspline 0 spln18 80 wait length -64
	}

	trigger run_19
	{
		followspline 0 spln19 80 wait length -64
	}

	trigger run_20
	{
		followspline 0 spln20 80 wait length -64
	}

	trigger run_21
	{
		followspline 0 spln21 80 wait length -64
	}

	trigger run_22
	{
		followspline 0 spln22 80 wait length -64
	}

	trigger run_23
	{
		followspline 0 spln23 80 wait length -64
	}

	trigger run_24
	{
		followspline 0 spln24 80 wait length -64
	}

	trigger run_25
	{
		followspline 0 spln25 80 wait length -64
	}

	trigger run_26
	{
		followspline 0 spln26 80 wait length -64
	}

	trigger run_27
	{
		followspline 0 spln27 80 wait length -64
	}

	trigger run_28
	{
		followspline 0 spln28 80 wait length -64
	}

	trigger run_29
	{
		followspline 0 spln29 80 wait length -64
	}

	trigger run_30
	{
		followspline 0 spln30 80 wait length -64
	}

	trigger run_31
	{
		followspline 0 spln31 80 wait length -64
	}

	trigger run_32
	{
		followspline 0 spln32 80 wait length -64
	}

	trigger run_33
	{
		followspline 0 spln33 80 wait length -64
	}

	trigger run_34
	{
		followspline 0 spln34 80 wait length -64
	}

	//-----------------------------------------------------------------------
	// River bridge
	//-----------------------------------------------------------------------
	trigger run_35
	{
		followspline 0 spln35 80 wait length -64
		followspline 0 spln36 80 wait length -64
		followspline 0 spln37 80 wait length -64
		followspline 0 spln38 80 wait length -64
		followspline 0 spln39 80 wait length -64
		followspline 0 spln40 80 wait length -64
	}

	trigger run_36
	{
		followspline 0 spln41 80 wait length -64
	}

	trigger run_37
	{
		followspline 0 spln42 80 wait length -64
	}

	trigger run_38
	{
		followspline 0 spln43 80 wait length -64
	}

	trigger run_39
	{
		followspline 0 spln44 80 wait length -64
	}

	trigger run_40
	{
		followspline 0 spln45 80 wait length -64
	}

	trigger run_41
	{
		followspline 0 spln46 80 wait length -64
	}

	trigger run_42
	{
		followspline 0 spln47 80 wait length -64
		followspline 0 spln48 80 wait length -64
	}

	trigger run_44
	{
		followspline 0 spln49 80 wait length -64
	}

	trigger run_45
	{
		followspline 0 spln50 80 wait length -64
	}

	trigger run_46
	{
		followspline 0 spln51 80 wait length -64
	}

	trigger run_47
	{
		followspline 0 spln52 80 wait length -64
	}

	trigger run_48
	{
		followspline 0 spln53 80 wait length -64
	}

	trigger run_49
	{
		followspline 0 spln54 80 wait length -64
	}

	trigger run_50
	{
		followspline 0 spln55 80 wait length -64
	}

	trigger run_51
	{
		followspline 0 spln56 80 wait length -64
	}

	trigger run_52
	{
		followspline 0 spln57 80 wait length -64
	}

	trigger run_53
	{
		followspline 0 spln58 80 wait length -64
	}

	trigger run_54
	{
		followspline 0 spln59 80 wait length -64
	}

	trigger run_55
	{
		followspline 0 spln60 80 wait length -64
	}

	trigger run_56
	{
		followspline 0 spln61 80 wait length -64
	}

	trigger run_57
	{
		followspline 0 spln62 80 wait length -64
	}

	trigger run_58
	{
		followspline 0 spln63 80 wait length -64
	}

	trigger run_59
	{
		followspline 0 spln64 80 wait length -64
	}

	trigger run_60
	{
		followspline 0 spln65 80 wait length -64 roll 0 -1 dampout
		followspline 0 tunnel1 80 wait length -64 roll -1 5 dampin dampout
	}

	trigger run_62
	{
		followspline 0 tunnel2 80 wait length -64 roll 4 1 dampout
		followspline 0 tunnel3 80 wait length -64 roll 5 -5 dampin
	}

	trigger run_64
	{
		followspline 0 tunnel4 80 wait length -64
	}

	trigger run_65
	{
		followspline 0 tunnel5 80 wait length -64
	}

	trigger run_66
	{
		followspline 0 tunnel6 80 wait length -64
	}

	trigger run_67
	{
		followspline 0 tunnel7 80 wait length -64
	}

	trigger run_68
	{
		followspline 0 tunnel8 80 wait length -64
	}

	trigger run_69
	{
		followspline 0 tunnel9 80 wait length -64 roll 0 1 dampout
	}

	trigger run_70
	{
		followspline 0 tunnel10 80 wait length -64 roll 1 4 dampin
	}

	trigger run_71
	{
		followspline 0 tunnel11 80 wait length -64 roll 5 1 dampin
	}

	trigger run_72
	{
		followspline 0 tunnel12 80 wait length -64 roll 6 -4 dampin
		followspline 0 spln66 80 wait length -64 roll -2 2 dampin dampout
	}

	trigger run_74
	{
		followspline 0 spln67 80 wait length -64
	}

	trigger run_75
	{
		followspline 0 spln68 80 wait length -64
	}

	trigger run_76
	{
		followspline 0 spln69 80 wait length -64
	}

	trigger run_77
	{
		followspline 0 spln70 80 wait length -64
	}

	trigger run_78
	{
		followspline 0 spln71 80 wait length -64
	}

	trigger run_79
	{
		followspline 0 spln72 80 wait length -64
	}

	trigger run_80
	{
		followspline 0 spln73 80 wait length -64
	}

	trigger run_81
	{
		followspline 0 spln74 80 wait length -64
	}

	trigger run_82
	{
		followspline 0 spln75 80 wait length -64
	}

	trigger run_83
	{
		followspline 0 spln76 80 wait length -64
	}

	trigger run_84
	{
		followspline 0 spln77 80 wait length -64
	}

	trigger run_85
	{
		followspline 0 spln78 80 wait length -64
	}

	trigger run_86
	{
		followspline 0 spln79 80 wait length -64
	}

	trigger run_87
	{
		followspline 0 spln80 80 wait length -64
	}

	trigger run_88
	{
		followspline 0 spln81 80 wait length -64
	}

	trigger run_89
	{
		followspline 0 spln82 80 wait length -64
	}

	trigger run_90
	{
		followspline 0 spln83 80 wait length -64
	}

	trigger run_91
	{
		followspline 0 spln84 80 wait length -64
	}

	trigger run_92
	{
		followspline 0 spln85 80 wait length -64
	}

	//-----------------------------------------------------------------------
	// Front of AXIS base
	//-----------------------------------------------------------------------
	trigger run_93
	{
		followspline 0 spln86 80 wait length -64
	}

	//-----------------------------------------------------------------------
	// Turning round for the next route
	//-----------------------------------------------------------------------
	trigger run_94
	{
		faceangles 0 105 0 8000 // pitch yaw roll time(ms)
	}

	trigger run_95
	{
		followspline 0 spln2_0 80 wait length -64
	}

	trigger run_96
	{
		followspline 0 spln2_1 80 wait length -64
	}

	trigger run_97
	{
		followspline 0 spln2_2 80 wait length -64
	}

	trigger run_98
	{
		followspline 0 spln2_3 80 wait length -64
	}

	trigger run_99
	{
		followspline 0 spln2_4 80 wait length -64
	}

	trigger run_100
	{
		followspline 0 spln2_5 80 wait length -64
	}

	trigger run_101
	{
		followspline 0 spln2_6 80 wait length -64
	}

	trigger run_102
	{
		followspline 0 spln2_7 80 wait length -64
	}

	trigger run_103
	{
		followspline 0 spln2_8 80 wait length -64
	}

	trigger run_104
	{
		followspline 0 spln2_9 80 wait length -64
	}

	trigger run_105
	{
		followspline 0 spln2_10 80 wait length -64
	}

	trigger run_106
	{
		followspline 0 spln2_11 80 wait length -64
	}

	trigger run_107
	{
		followspline 0 spln2_12 80 wait length -64
	}

	trigger run_108
	{
		followspline 0 spln2_13 80 wait length -64
	}

	trigger run_109
	{
		followspline 0 spln2_14 80 wait length -64
	}

	trigger run_110
	{
		followspline 0 spln2_15 80 wait length -64
	}

	trigger run_111
	{
		followspline 0 spln2_16 80 wait length -64
	}

	trigger run_112
	{
		followspline 0 spln2_17 80 wait length -64
	}

	trigger run_113
	{
		followspline 0 spln2_18 80 wait length -64
	}

	trigger run_114
	{
		followspline 0 spln2_19 80 wait length -64
	}

	trigger run_115
	{
		followspline 0 spln2_20 80 wait length -64
	}

	trigger run_116
	{
		followspline 0 spln2_21 80 wait length -64
	}

	trigger run_117
	{
		followspline 0 spln2_22 80 wait length -64
	}

	trigger run_118
	{
		followspline 0 spln2_23 80 wait length -64
	}

	trigger run_119
	{
		followspline 0 spln2_24 80 wait length -64
	}

	trigger run_120
	{
		followspline 0 spln2_25 80 wait length -64
	}

	trigger run_121
	{
		followspline 0 spln2_26 80 wait length -64
	}

	trigger run_122
	{
		followspline 0 spln2_27 80 wait length -64
	}

	trigger run_123
	{
		followspline 0 spln2_28 80 wait length -64
	}

	trigger run_124
	{
		followspline 0 spln2_29 80 wait length -64
	}

	trigger run_125
	{
		followspline 0 spln2_30 80 wait length -64
	}

	trigger run_126
	{
		followspline 0 spln2_31 80 wait length -64
	}

	trigger run_127
	{
		followspline 0 spln2_32 80 wait length -64
	}

	trigger run_128
	{
		followspline 0 spln2_33 80 wait length -64
	}

	trigger run_129
	{
		followspline 0 spln2_35 80 wait length -64
	}

	trigger run_130
	{
		followspline 0 spln2_36 80 wait length -64
	}

	trigger run_131
	{
		followspline 0 spln2_37 80 wait length -64
	}

	trigger run_132
	{
		followspline 0 spln2_38 80 wait length -64
	}

	trigger run_133
	{
		followspline 0 spln2_39 80 wait length -64 roll 0 -1 dampin dampout
	}
}

tank_smoke
{
	spawn
	{
		wait 300
		attachtotag tank tag_turret
		setstate tank_smoke invisible
	}
}

tank_flash
{
	spawn
	{
		setstate tank_flash invisible
	}

	trigger run
	{
		setstate tank_flash default
 		attachtotag tank_turret tag_flash
		faceangles 0 90 0 50

		wait 50

		trigger tank_turret blow_door
	}

	trigger run2
	{
		setstate tank_flash default
 		attachtotag tank_turret tag_flash
		faceangles 0 90 0 50

		wait 50

		trigger tank_turret blow_door2
	}

	trigger run3
	{
		setstate tank_flash default
 		attachtotag tank_turret tag_flash
		faceangles 0 90 0 50

		wait 50

		trigger tank_turret blow_door3
	}

	trigger run4
	{
		setstate tank_flash default
 		attachtotag tank_turret tag_flash
		faceangles 0 90 0 50

		wait 50

		trigger tank_turret blow_door4
	}
}

// ===========================================================================================
// Axis Base team door trigger
// for Allied engineers ONLY
// ===========================================================================================
axisbasedoor_trigger
{
//	activate
//	{
//		Trigger klaxon sound for 10s
//		alertentity axisbase_alert
//	}
}

// ===========================================================================================
// Garage Doors for Tank
// ===========================================================================================
tbdoor1_trigger1
{
	spawn
	{
		accum 3 set 0			// Initial state of lever. (0=down, 1=up)
	}
	trigger main
	{
		trigger tbdoor1_trigger1 up
		trigger tbdoor1_trigger1 down
	}

	trigger up
	{
		accum 3 abort_if_not_equal 0		// Lever up already ?
		globalaccum 4 abort_if_not_equal 0	// Flexible Door moving ?
		resetscript

		globalaccum 4 set 1			// Door is opening ...
		accum 3 set 1				// Lever is in up position
		trigger tbflywheel1 start			// Set flywheel moving
		trigger tbflywheel1 clockwise		// Start turning
		trigger tbflywheel1_sound wheel1_run
		trigger tbdoor1_lever1 up		// Move lever
		trigger tbdoor1-9 open		// Start moving all the door sections
	}

	trigger down
	{
		accum 3 abort_if_not_equal 1		// Lever down already ?
		globalaccum 4 abort_if_not_equal 0	// Flexible Door moving ?
		resetscript

		globalaccum 4 set 1			// Door is opening ...
		accum 3 set 0				// Lever is in up position
		trigger tbflywheel1 start			// Set flywheel moving
		trigger tbflywheel1 anticlockwise		// Start turning
		trigger tbflywheel1_sound wheel1_run
		trigger tbdoor1_lever1 down		// Move lever
		trigger tbdoor1-9 close		// Start moving all the door sections
	}
}

tbdoor1_lever1
{
	trigger down
	{
		gotomarker tbdoor1_lever1_downpos 16
		playsound sound/movers/switches/butn2.wav
	}
	trigger up
	{
		gotomarker tbdoor1_lever1_uppos 16
		playsound sound/movers/switches/switch.wav
	}
}

tbflywheel1_sound
{
	trigger wheel1_run
	{
		trigger tbflywheel1 sound_start
		wait 400
		trigger tbflywheel1 sound_run
	}
}

tbflywheel1
{
	spawn
	{
		accum 3 set 0			// Flywheel moving (0=No, 1=Yes)
	}

	trigger sound_start
	{
		stopsound
		playsound sound/movers/motors/motor_start_01.wav volume 127
	}

	trigger sound_run
	{
		playsound sound/movers/motors/motor_loop_01.wav looping volume 512
	}

	trigger sound_stop
	{
		stopsound
		playsound sound/movers/motors/motor_end_01.wav volume 127
	}

	trigger clockwise
	{
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 90 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 180 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 270 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 0 0 0 250 wait

		trigger tbflywheel1 clockwise
	}

	trigger anticlockwise
	{
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 270 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 180 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 90 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 0 0 0 250 wait

		trigger tbflywheel1 anticlockwise
	}

	trigger start
	{
		accum 3 set 1			// Start wheel moving
	}

	trigger stop
	{
		accum 3 set 0			// Stop wheel moving

		trigger self sound_stop
	}
}

tbdoor1-9
{
	spawn
	{
		wait 200
		trigger tbdoor1_trigger1 up
	}

	trigger open
	{
		stopsound			// Kill all currently playing sounds belonging to this entity only
		playsound sound/movers/misc/garage_door_start_01.wav volume 96
		wait 50
		playsound sound/movers/misc/garage_door_loop_01.wav looping volume 512
		followpath 1 tbdrspln1-3 50 wait length 16
		followpath 1 tbdrspln1-4 50 wait length 16
		trigger tbflywheel1 stop	// Turn off flywheel
		globalaccum 4 set 0		// Flexible door 1 has stopped moving
		stopsound			// Kill all currently playing sounds belonging to this entity only
		playsound sound/movers/misc/garage_door_end_01.wav volume 96
	}

	trigger close
	{
		stopsound			// Kill all currently playing sounds belonging to this entity only
		playsound sound/movers/misc/garage_door_start_01.wav volume 96
		wait 50
		playsound sound/movers/misc/garage_door_loop_01.wav looping volume 512
		followpath 0 tbdrspln1-4 50 wait length 16
		followpath 0 tbdrspln1-3 50 wait length 16
		trigger tbflywheel1 stop	// Turn off flywheel
		globalaccum 4 set 0		// Flexible door 1 has stopped moving
		stopsound			// Kill all currently playing sounds belonging to this entity only
		playsound sound/movers/misc/garage_door_end_01.wav volume 96
	}
}

tbdoor1-8
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor1-9 16
	}
}

tbdoor1-7
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor1-8 16
	}
}

tbdoor1-6
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor1-7 16
	}
}

tbdoor1-5
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor1-6 16
	}
}

tbdoor1-4
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor1-5 16
	}
}

tbdoor1-3
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor1-4 16
	}
}

tbdoor1-2
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor1-3 16
	}
}

tbdoor1-1
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor1-2 16
	}
}

// ===========================================================================================
// Garage Doors for Tank
// ===========================================================================================

tbdoor2_trigger1
{
	spawn
	{
		accum 3 set 0			// Initial state of lever. (0=down, 1=up)
	}
	trigger main
	{
		trigger tbdoor2_trigger1 up
		trigger tbdoor2_trigger1 down
	}

	trigger up
	{
		accum 3 abort_if_not_equal 0		// Lever up already ?
		globalaccum 5 abort_if_not_equal 0	// Flexible Door moving ?
		resetscript

		globalaccum 5 set 1			// Door is opening ...
		accum 3 set 1				// Lever is in up position
		trigger tbflywheel2 start			// Set flywheel moving
		trigger tbflywheel2 clockwise		// Start turning
		trigger tbflywheel2_sound wheel2_run
		trigger tbdoor2_lever1 up		// Move lever
		trigger tbdoor2-9 open			// Start moving all the door sections
	}

	trigger down
	{
		accum 3 abort_if_not_equal 1		// Lever down already ?
		globalaccum 5 abort_if_not_equal 0	// Flexible Door moving ?
		resetscript

		globalaccum 5 set 1			// Door is opening ...
		accum 3 set 0				// Lever is in up position
		trigger tbflywheel2 start		// Set flywheel moving
		trigger tbflywheel2 anticlockwise	// Start turning
		trigger tbflywheel2_sound wheel2_run
		trigger tbdoor2_lever1 down		// Move lever
		trigger tbdoor2-9 close			// Start moving all the door sections
	}
}

tbdoor2_lever1
{
	trigger down
	{
		gotomarker tbdoor2_lever1_downpos 16
		playsound sound/movers/switches/butn2.wav
	}
	trigger up
	{
		gotomarker tbdoor2_lever1_uppos 16
		playsound sound/movers/switches/switch.wav
	}
}

tbflywheel2_sound
{
	trigger wheel2_run
	{
		trigger tbflywheel2 sound_start
		wait 400
		trigger tbflywheel2 sound_run
	}
}

tbflywheel2
{
	spawn
	{
		accum 3 set 0			// Flywheel moving (0=No, 1=Yes)
	}

	trigger sound_start
	{
		stopsound
		playsound sound/movers/motors/motor_start_01.wav volume 127
	}

	trigger sound_run
	{
		playsound sound/movers/motors/motor_loop_01.wav looping volume 512
	}

	trigger sound_stop
	{
		stopsound
		playsound sound/movers/motors/motor_end_01.wav volume 127
	}

	trigger clockwise
	{
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 90 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 180 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 270 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 0 0 0 250 wait

		trigger tbflywheel2 clockwise
	}

	trigger anticlockwise
	{
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 270 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 180 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 90 0 0 250 wait
		accum 3 abort_if_not_equal 1	// Flywheel moving ?
		faceangles 0 0 0 250 wait

		trigger tbflywheel2 anticlockwise
	}

	trigger start
	{
		accum 3 set 1			// Start wheel moving
	}
	trigger stop
	{
		accum 3 set 0			// Stop wheel moving

		trigger self sound_stop
	}
}

tbdoor2-9
{
	spawn
	{
		wait 200
		trigger tbdoor2_trigger1 up
	}

	trigger open
	{
		stopsound			// Kill all currently playing sounds belonging to this entity only
		playsound sound/movers/misc/garage_door_start_01.wav volume 96
		wait 50
		playsound sound/movers/misc/garage_door_loop_01.wav looping volume 512
		followpath 1 tbdrspln2-3 50 wait length 16
		followpath 1 tbdrspln2-4 50 wait length 16
		trigger tbflywheel2 stop	// Turn off flywheel
		globalaccum 5 set 0		// Flexible door 1 has stopped moving
		stopsound			// Kill all currently playing sounds belonging to this entity only
		playsound sound/movers/misc/garage_door_end_01.wav volume 96
	}

	trigger close
	{
		stopsound			// Kill all currently playing sounds belonging to this entity only
		playsound sound/movers/misc/garage_door_start_01.wav volume 96
		wait 50
		playsound sound/movers/misc/garage_door_loop_01.wav looping volume 512
		followpath 0 tbdrspln2-4 50 wait length 16
		followpath 0 tbdrspln2-3 50 wait length 16
		trigger tbflywheel2 stop	// Turn off flywheel
		globalaccum 5 set 0		// Flexible door 1 has stopped moving
		stopsound			// Kill all currently playing sounds belonging to this entity only
		playsound sound/movers/misc/garage_door_end_01.wav volume 96
	}
}

tbdoor2-8
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor2-9 16
	}
}

tbdoor2-7
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor2-8 16
	}
}

tbdoor2-6
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor2-7 16
	}
}

tbdoor2-5
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor2-6 16
	}
}

tbdoor2-4
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor2-5 16
	}
}

tbdoor2-3
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor2-4 16
	}
}

tbdoor2-2
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor2-3 16
	}
}

tbdoor2-1
{
	spawn
	{
		wait 100
		attatchtotrain tbdoor2-2 16
	}
}

// ===========================================================================================
// Tank destruction entities
// ===========================================================================================
// ----------------------------------------------------------------------------
// Water grate entrance on Allied side of map
// ----------------------------------------------------------------------------
tunnelgrate_solid
{
	spawn
	{
		wait 200
		setstate tunnelgrate_solid default
		setstate tunnelgrate_dmg invisible
	}

	trigger switch
	{
		// Some kind of UI pop-up to alert players
		wm_announce	"Allied team has breached the Tunnel Grate!"
		alertentity tunnelgrate_explo
		trigger hurt_tunnelgrateblast boom
		setstate tunnelgrate_solid invisible
		setstate tunnelgrate_dmg default
		alertentity tunnelgrate_rubble1
	}
}

hurt_tunnelgrateblast
{
	spawn
	{
		wait 200
		setstate hurt_tunnelgrateblast invisible
	}

	trigger boom
	{
		setstate hurt_tunnelgrateblast default
		wait 100
		remove
	}
}

// ----------------------------------------------------------------------------
// Cave door on Allied side of map
// ----------------------------------------------------------------------------
cavedoor_solid
{
	spawn
	{
		wait 200
		setstate cavedoor_solid default
		setstate cavedoor_dmg invisible
	}

	trigger switch
	{
		alertentity cavedoor_explo
		trigger hurt_cavedoorblast boom
		setstate cavedoor_solid invisible
		setstate cavedoor_dmg default
		alertentity cavedoor_rubble1
	}
}

hurt_cavedoorblast
{
	spawn
	{
		wait 200
		setstate hurt_cavedoorblast invisible
	}

	trigger boom
	{
		setstate hurt_cavedoorblast default
		wait 100
		remove
	}
}

// ----------------------------------------------------------------------------
// Front gate of axis complex
// ----------------------------------------------------------------------------
basedoor_solid
{
	spawn
	{
		wait 200
		setstate basedoor_solid default
		setstate basedoor_dmg invisible
	}

	trigger switch
	{
		alertentity basedoor_explo
		trigger hurt_basedoorblast boom
		setstate basedoor_solid invisible
		setstate basedoor_dmg default
		alertentity basedoor_rubble1
	}
}

hurt_basedoorblast
{
	spawn
	{
		wait 200
		setstate hurt_basedoorblast invisible
	}

	trigger boom
	{
		setstate hurt_basedoorblast default
		wait 100
		remove
	}
}

// ----------------------------------------------------------------------------
// Side wall of axis complex
// ----------------------------------------------------------------------------
basewall_solid
{
	spawn
	{
		wait 200
		setstate basewall_solid default
		setstate basewall_trighurt default
	}

	trigger switch
	{
		alertentity basewall_explo
		trigger hurt_basewallblast boom
		setstate basewall_solid invisible
		alertentity basewall_rubble1
		setstate basewall_trighurt invisible
	}
}

hurt_basewallblast
{
	spawn
	{
		wait 200
		setstate hurt_basewallblast invisible
	}

	trigger boom
	{
		setstate hurt_basewallblast default
		wait 100
		remove
	}
}
