Engine
Class TeamInfo

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

class TeamInfo
extends Engine.ReplicationInfo

//============================================================================= // TeamInfo. //=============================================================================
Variables
 TeamColor, AltTeamColor
           number of players on this team in the level
 string DefaultPlayerClassName
           key objective associated with this team
 Actor Flag
           key objective associated with this team
 float Score
           number of players on this team in the level
 int Size
           number of players on this team in the level
 Texture TeamIcon
           number of players on this team in the level
 int TeamIndex
           number of players on this team in the level
 string TeamName


Function Summary
 bool AddToTeam(Controller Other)
 string GetHumanReadableName()
 void RemoveFromTeam(Controller Other)



Source Code


00001	//=============================================================================
00002	// TeamInfo.
00003	//=============================================================================
00004	class TeamInfo extends ReplicationInfo
00005		native
00006		nativereplication;
00007	
00008	var string TeamName;
00009	var int Size; //number of players on this team in the level
00010	var float Score;
00011	var int TeamIndex;
00012	var color TeamColor, AltTeamColor;
00013	var texture TeamIcon;
00014	var Actor Flag;			// key objective associated with this team
00015	var string DefaultPlayerClassName;
00016	
00017	replication
00018	{
00019		// Variables the server should send to the client.
00020		reliable if( bNetDirty && (Role==ROLE_Authority) )
00021			Score, Flag;
00022		reliable if ( bNetInitial && (Role==ROLE_Authority) )
00023			TeamName, TeamColor, AltTeamColor, TeamIcon, TeamIndex;
00024	}
00025	
00026	function bool BelongsOnTeam(class<Pawn> PawnClass)
00027	{
00028		return true;
00029	}
00030	
00031	simulated function string GetHumanReadableName()
00032	{
00033		return TeamName;
00034	}
00035	
00036	function bool AddToTeam( Controller Other )
00037	{
00038		local Controller P;
00039		local bool bSuccess;
00040	
00041		// make sure loadout works for this team
00042		if ( Other == None )
00043		{
00044			log("Added none to team!!!");
00045			return false;
00046		}
00047	
00048		Size++;
00049		Other.PlayerReplicationInfo.Team = self;
00050		if (Level.Game.StatLog != None)
00051			Level.Game.StatLog.LogTeamChange(Other);
00052		bSuccess = false;
00053		if ( Other.IsA('PlayerController') )
00054			Other.PlayerReplicationInfo.TeamID = 0;
00055		else
00056			Other.PlayerReplicationInfo.TeamID = 1;
00057	
00058		while ( !bSuccess )
00059		{
00060			bSuccess = true;
00061			for ( P=Level.ControllerList; P!=None; P=P.nextController )
00062	            if ( P.bIsPlayer && (P != Other) 
00063					&& (P.PlayerReplicationInfo.Team == Other.PlayerReplicationInfo.Team) 
00064					&& (P.PlayerReplicationInfo.TeamId == Other.PlayerReplicationInfo.TeamId) )
00065					bSuccess = false;
00066			if ( !bSuccess )
00067				Other.PlayerReplicationInfo.TeamID = Other.PlayerReplicationInfo.TeamID + 1;
00068		}
00069		return true;
00070	}
00071	
00072	function RemoveFromTeam(Controller Other)
00073	{
00074		Size--;
00075	}
00076	
00077	defaultproperties
00078	{
00079	     TeamColor=(R=255,A=255)
00080	     AltTeamColor=(R=200,A=255)
00081	     TeamIcon=Texture'Engine.S_Actor'
00082	}

End Source Code