Engine
Class PlayerReplicationInfo

source: C:\XIII\Engine\Classes\PlayerReplicationInfo.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Info
         |
         +--Engine.ReplicationInfo
            |
            +--Engine.PlayerReplicationInfo
Direct Known Subclasses:XIIIPlayerReplicationInfo

class PlayerReplicationInfo
extends Engine.ReplicationInfo

//============================================================================= // PlayerReplicationInfo. //=============================================================================
Variables
 float Deaths
           Number of player's deaths.
 Decoration HasFlag
           Number of player's deaths.
 int NumLives
           Number of player's deaths.
 float OldScore
           Player's Old score (to handle event ScoreUpdated)
 int Ping
           Number of player's deaths.
 int PlayerID
           Unique id number.
 Volume PlayerLocation
           Number of player's deaths.
 string PlayerName
           Player name, or blank if none.
 OldName, PreviousName
           Temporary value.
 float Score
           Player's current score.
 OldSkinCodeName, SkinCodeName
           Temporary value.
 int StartTime
           Player position in team.
 Texture TalkTexture
           Player position in team.
 TeamInfo Team
           Player Team
 int TeamID
           Player position in team.
 int TimeAcc
           Player position in team.
 class VoiceType
           Player position in team.
 bool bBot
           Player position in team.
 bool bFeigningDeath
           Player position in team.
 bool bIsFemale
           Player position in team.
 bool bIsSpectator
           Player position in team.
 bool bOutOfLives
           Player position in team.
 bool bReadyToPlay
           Player position in team.
 bool bWaitingPlayer
           Player position in team.


Function Summary
 
simulated
DisplayDebug(Canvas Canvas, out float, out float)
     
/* DisplayDebug()
list important controller attributes on canvas
*/
 
simulated
DumpContent(float TimeStamp, int tabulation)
 string GetHumanReadableName()
 string GetLocationName()
 void PostBeginPlay()
 void Reset()
     
/* Reset()
reset actor to initial state - used when restarting level without reloading.
*/
 void SetPlayerName(string S)
 void SetWaitingPlayer(bool B)
 void Timer()
 void UpdatePlayerLocation()



Source Code


00001	//=============================================================================
00002	// PlayerReplicationInfo.
00003	//=============================================================================
00004	class PlayerReplicationInfo extends ReplicationInfo
00005	  native nativereplication;
00006	
00007	// also replicate here player class and skins and any other seldom changed stuff
00008	var float Score;          // Player's current score.
00009	var float OldScore;       // Player's Old score (to handle event ScoreUpdated)
00010	var float Deaths;         // Number of player's deaths.
00011	var Decoration   HasFlag;
00012	var int Ping;
00013	var Volume PlayerLocation;
00014	var int NumLives;
00015	
00016	var string PlayerName;    // Player name, or blank if none.
00017	var string OldName, PreviousName;    // Temporary value.
00018	var string OldSkinCodeName, SkinCodeName;
00019	var int PlayerID;         // Unique id number.
00020	var TeamInfo Team;        // Player Team
00021	var int TeamID;           // Player position in team.
00022	var class<VoicePack> VoiceType;
00023	var bool bIsFemale;
00024	var bool bFeigningDeath;
00025	var bool bIsSpectator;
00026	var bool bWaitingPlayer;
00027	var bool bReadyToPlay;
00028	var bool bOutOfLives;
00029	var bool bBot;
00030	var Texture TalkTexture;
00031	
00032	// Time elapsed.
00033	var int StartTime;
00034	var int TimeAcc;
00035	
00036	replication
00037	{
00038	  // Things the server should send to the client.
00039	  reliable if ( bNetDirty && (Role == Role_Authority) )
00040	    Score, Deaths, HasFlag, Ping, PlayerLocation,
00041	    PlayerName, Team, TeamID, VoiceType, bIsFemale,
00042	    bFeigningDeath, bIsSpectator, bWaitingPlayer, bReadyToPlay, TalkTexture,
00043	    bOutOfLives;
00044	
00045	  reliable if ( Role == Role_Authority )
00046	    SkinCodeName;
00047	
00048	  reliable if ( bNetInitial && (Role == Role_Authority) )
00049	    StartTime, bBot;
00050	}
00051	
00052	function PostBeginPlay()
00053	{
00054	  StartTime = Level.TimeSeconds;
00055	  Timer();
00056	  SetTimer(2.0, true);
00057	}
00058	
00059	/* Reset()
00060	reset actor to initial state - used when restarting level without reloading.
00061	*/
00062	function Reset()
00063	{
00064	  Super.Reset();
00065	  Score = 0;
00066	  Deaths = 0;
00067	  HasFlag = None;
00068	  bReadyToPlay = false;
00069	  NumLives = 0;
00070	  bOutOfLives = false;
00071	}
00072	
00073	simulated function string GetLocationName()
00074	{
00075	  if ( PlayerLocation != None )
00076	    return PlayerLocation.LocationName;
00077	  else
00078	    return"";
00079	}
00080	
00081	simulated function string GetHumanReadableName()
00082	{
00083	  return PlayerName;
00084	}
00085	
00086	function UpdatePlayerLocation()
00087	{
00088	  local Volume V;
00089	
00090	  PlayerLocation = None;
00091	  ForEach TouchingActors(class'Volume',V)
00092	    if ( (V.LocationName != "")
00093	      && ((PlayerLocation == None) || (V.LocationPriority > PlayerLocation.LocationPriority))
00094	      && V.Encompasses(self) )
00095	    {
00096	      PlayerLocation = V;
00097	    }
00098	}
00099	
00100	/* DisplayDebug()
00101	list important controller attributes on canvas
00102	*/
00103	simulated function DisplayDebug(Canvas Canvas, out float YL, out float YPos)
00104	{
00105	  Canvas.DrawText("     PlayerName "$PlayerName$" Team "$Team);
00106	}
00107	
00108	function Timer()
00109	{
00110	  UpdatePlayerLocation();
00111	
00112	  if ( FRand() < 0.65 )
00113	    return;
00114	
00115	  if (PlayerController(Owner) != None)
00116	    Ping = int(Controller(Owner).ConsoleCommand("GETPING"));
00117	}
00118	
00119	function SetPlayerName(string S)
00120	{
00121	  OldName = PlayerName;
00122	  PlayerName = S;
00123	}
00124	
00125	function SetWaitingPlayer(bool B)
00126	{
00127	  bIsSpectator = B;
00128	  bWaitingPlayer = B;
00129	}
00130	
00131	
00132	debugonly simulated function DumpContent(float TimeStamp, int tabulation)
00133	{
00134	    local int j;
00135	    local string Tab;
00136	
00137	    for (j=0; j<tabulation; j++) Tab = Tab$" ";
00138	
00139	    log(Tab$"PlayerReplicationInfo's dump at "$TimeStamp$":");
00140	    //log(Tab$"  Score:"$Score$" Deaths:"$Deaths$" HasFlag:"$HasFlag$" Ping:"$Ping$" PlayerLocation:"$PlayerLocation$" NumLives:"$NumLives);
00141	        log(Tab$"  Ping:"$Ping);
00142	    //log(Tab$"  PlayerName:"$PlayerName$" OldName:"$OldName$" PreviousName:"$PreviousName$" PlayerID:"$PlayerID$" Team:"$Team$" TeamID:"$TeamID$" VoiceType:"$VoiceType);
00143	        log(Tab$"  PlayerID:"$PlayerID);
00144	    //log(Tab$"  bIsFemale:"$bIsFemale$" bFeigningDeath:"$bFeigningDeath$" bIsSpectator:"$bIsSpectator$" bWaitingPlayer:"$bWaitingPlayer$" bReadyToPlay:"$bReadyToPlay$" bOutOfLives:"$bOutOfLives);
00145	    //log(Tab$"  bBot:"$bBot$" TalkTexture:"$TalkTexture$" StartTime:"$StartTime$" TimeAcc:"$TimeAcc);
00146	    //Super.DumpContent(TimeStamp, tabulation);
00147	}
00148	
00149	simulated event ScoreUpdated(); // ELR Used to update score sorting only when receiving score replication
00150	simulated event SkinUpdated();  // ELR Used to update skin only when receiving SkinCodeName replication
00151	
00152	defaultproperties
00153	{
00154	     RemoteRole=ROLE_SimulatedProxy
00155	}

End Source Code