Engine
Class Spectator

source: e:\games\UnrealTournament\Engine\Classes\Spectator.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--Engine.PlayerPawn
            |
            +--Engine.Spectator
Direct Known Subclasses:CHSpectator, MessagingSpectator, UnrealSpectator

class Spectator
extends Engine.PlayerPawn

//============================================================================= // Spectator. //=============================================================================
Variables
 bool bChaseCam


Function Summary
 void AltFire(optional float)
     
// The player wants to alternate-fire.
 void BehindView(Bool B)
 void CallForHelp()
 void ChangeTeam(int N)
 void ClientReStart()
 void Fire(optional float)
 void Fly()
 void Grab()
 void InitPlayerReplicationInfo()
 void NextItem()
 void PlayerTimeOut()
 void Possess()
     
// This pawn was possessed by a player.
 void PostBeginPlay()
 void PrevItem()
 void RestartLevel()
     
//=============================================================================
// functions.
 void Say(string Msg)
     
// Send a message to all players.
 void ServerChangeSkin(string SkinName, string FaceName, byte TeamNum)
 void Suicide()
 void SwitchWeapon(byte F)
     
// The player wants to switch to weapon group numer I.
 void TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
     
//=================================================================================
 void Taunt(name Sequence)
 void ThrowWeapon()
 void Walk()



Source Code


00001	//=============================================================================
00002	// Spectator.
00003	//=============================================================================
00004	class Spectator extends PlayerPawn;
00005	
00006	var bool bChaseCam;
00007	
00008	function InitPlayerReplicationInfo()
00009	{
00010		Super.InitPlayerReplicationInfo();
00011		PlayerReplicationInfo.bIsSpectator = true;
00012	}
00013	
00014	event FootZoneChange(ZoneInfo newFootZone)
00015	{
00016	}
00017		
00018	event HeadZoneChange(ZoneInfo newHeadZone)
00019	{
00020	}
00021	
00022	event PainTimer()
00023	{
00024	}
00025	
00026	exec function Walk()
00027	{	
00028	}
00029	
00030	exec function BehindView( Bool B )
00031	{
00032		bBehindView = B;
00033		bChaseCam = bBehindView;
00034		if ( ViewTarget == None )
00035			bBehindView = false;
00036	}
00037	
00038	function ChangeTeam( int N )
00039	{
00040		Level.Game.ChangeTeam(self, N);
00041	}
00042	
00043	exec function Taunt( name Sequence )
00044	{
00045	}
00046	
00047	exec function CallForHelp()
00048	{
00049	}
00050	
00051	exec function ThrowWeapon()
00052	{
00053	}
00054	
00055	exec function Suicide()
00056	{
00057	}
00058	
00059	exec function Fly()
00060	{
00061		UnderWaterTime = -1;	
00062		SetCollision(false, false, false);
00063		bCollideWorld = true;
00064		GotoState('CheatFlying');
00065	
00066		ClientRestart();
00067	}
00068	
00069	function ServerChangeSkin( coerce string SkinName, coerce string FaceName, byte TeamNum )
00070	{
00071	}
00072	
00073	function ClientReStart()
00074	{
00075		//log("client restart");
00076		Velocity = vect(0,0,0);
00077		Acceleration = vect(0,0,0);
00078		BaseEyeHeight = Default.BaseEyeHeight;
00079		EyeHeight = BaseEyeHeight;
00080		
00081		GotoState('CheatFlying');
00082	}
00083	
00084	function PlayerTimeOut()
00085	{
00086		if (Health > 0)
00087			Died(None, 'dropped', Location);
00088	}
00089	
00090	exec function Grab()
00091	{
00092	}
00093	
00094	// Send a message to all players.
00095	exec function Say( string Msg )
00096	{
00097		local Pawn P;
00098	
00099		if ( bAdmin && (left(Msg,1) == "#") )
00100		{
00101			Msg = right(Msg,len(Msg)-1);
00102			for( P=Level.PawnList; P!=None; P=P.nextPawn )
00103				if( P.IsA('PlayerPawn') )
00104				{
00105					PlayerPawn(P).SetProgressTime(6);
00106					PlayerPawn(P).SetProgressMessage(Msg,0);
00107				}
00108			return;
00109		}
00110		if ( Len(Msg) > 63 )
00111			Msg = Left(Msg,63);
00112		if ( !Level.Game.bMuteSpectators )
00113			BroadcastMessage( PlayerReplicationInfo.PlayerName$":"$Msg, true );
00114	}
00115	
00116	//=============================================================================
00117	// functions.
00118	
00119	exec function RestartLevel()
00120	{
00121	}
00122	
00123	// This pawn was possessed by a player.
00124	function Possess()
00125	{
00126		bIsPlayer = true;
00127		DodgeClickTime = FMin(0.3, DodgeClickTime);
00128		EyeHeight = BaseEyeHeight;
00129		NetPriority = 2;
00130		Weapon = None;
00131		Inventory = None;
00132		Fly();
00133	}
00134	
00135	function PostBeginPlay()
00136	{
00137		if (Level.LevelEnterText != "" )
00138			ClientMessage(Level.LevelEnterText);
00139		bIsPlayer = true;
00140		FlashScale = vect(1,1,1);
00141		if ( Level.NetMode != NM_Client )
00142			ScoringType = Level.Game.ScoreboardType;
00143	}
00144	
00145	//=============================================================================
00146	// Inventory-related input notifications.
00147	
00148	// The player wants to switch to weapon group numer I.
00149	exec function SwitchWeapon (byte F )
00150	{
00151	}
00152	
00153	exec function NextItem()
00154	{
00155	}
00156	
00157	exec function PrevItem()
00158	{
00159	}
00160	
00161	exec function Fire( optional float F )
00162	{
00163		ViewPlayerNum(-1);
00164		bBehindView = bChaseCam;
00165		if ( ViewTarget == None )
00166			bBehindView = false;
00167	}
00168	
00169	// The player wants to alternate-fire.
00170	exec function AltFire( optional float F )
00171	{
00172		bBehindView = false;
00173		Viewtarget = None;
00174		ClientMessage(ViewingFrom@OwnCamera, 'Event', true);
00175	}
00176	
00177	//=================================================================================
00178	
00179	function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, 
00180							Vector momentum, name damageType)
00181	{
00182	}
00183	
00184	defaultproperties
00185	{
00186	     bChaseCam=True
00187	     AirSpeed=400.000000
00188	     Visibility=0
00189	     AttitudeToPlayer=ATTITUDE_Friendly
00190	     MenuName="Spectator"
00191	     bHidden=True
00192	     bCollideActors=False
00193	     bCollideWorld=False
00194	     bBlockActors=False
00195	     bBlockPlayers=False
00196	     bProjTarget=False
00197	}

End Source Code