XIIIMP
Class XIIIMPCTFGameInfo

source: C:\XIII\XIIIMP\Classes\XIIIMPCTFGameInfo.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Info
         |
         +--Engine.GameInfo
            |
            +--XIII.XIIIGameInfo
               |
               +--XIIIMP.XIIIMPGameInfo
                  |
                  +--XIIIMP.XIIIMPTeamGameInfo
                     |
                     +--XIIIMP.XIIIMPCTFGameInfo
Direct Known Subclasses:None

class XIIIMPCTFGameInfo
extends XIIIMP.XIIIMPTeamGameInfo

//----------------------------------------------------------- // XIIICTFGameInfo || For CTF GamePlay //-----------------------------------------------------------

Function Summary
 void AddBot(int BotID)
     
//_____________________________________________________________________________
 bool CheckEndGame(PlayerReplicationInfo Winner, string Reason)
     
//_____________________________________________________________________________
 void Logout(Controller Exiting)
     
//_____________________________________________________________________________
 void PostBeginPlay()
     
//_____________________________________________________________________________
 void ScoreFlag(Controller Scorer, XIIIMPFlag theFlag)
     
//_____________________________________________________________________________
 void ScoreKill(Controller Killer, Controller Other)
     
//_____________________________________________________________________________
 void StartMatch()
     
//_____________________________________________________________________________



Source Code


00001	//-----------------------------------------------------------
00002	// XIIICTFGameInfo || For CTF GamePlay
00003	//-----------------------------------------------------------
00004	class XIIIMPCTFGameInfo extends XIIIMPTeamGameInfo;
00005	
00006	//_____________________________________________________________________________
00007	function AddBot(int BotID)
00008	{
00009	    local TeamBotController Bot;
00010	
00011	    Bot = spawn( class'CTFBotController');
00012	
00013	    if ( BotClasses[ BotID ] == none )
00014	      BotClasses[ BotID ] = class<XIIIPlayerPawn>(DynamicLoadObject(BotClassesName[ BotID ], class'class'));
00015	
00016	
00017	    Bot.PawnClass = BotClasses[ BotID ];
00018	    Bot.PlayerReplicationInfo.PlayerID = CurrentID++;
00019	    Bot.bIsBot = true;
00020	
00021	    Bot.TeamID = Level.BotTeam[BotID];
00022	    Bot.Skill = level.BotLevel[BotID];
00023	
00024	    Bot.GRI = GameReplicationInfo;
00025	    ChangeTeam(Bot,Level.BotTeam[BotID]);
00026	}
00027	
00028	//_____________________________________________________________________________
00029	function PostBeginPlay()
00030	{
00031	    local XIIIMPFlag F;
00032	
00033	    Super.PostBeginPlay();
00034	
00035	    // associate flags with teams
00036	    ForEach AllActors(Class'XIIIMPFlag',F)
00037	    {
00038	      F.Team = GameReplicationInfo.Teams[F.TeamNum];
00039	      F.Team.Flag = F;
00040	    }
00041	}
00042	
00043	//_____________________________________________________________________________
00044	function Logout(Controller Exiting)
00045	{
00046	    if ( Exiting.PlayerReplicationInfo.HasFlag != None )
00047	      XIIIMPFlag(Exiting.PlayerReplicationInfo.HasFlag).SendHome(1);
00048	    Super.Logout(Exiting);
00049	}
00050	
00051	//_____________________________________________________________________________
00052	function StartMatch()
00053	{
00054	    local XIIIMPFlag F;
00055	
00056	    ForEach AllActors(Class'XIIIMPFlag',F)
00057	    {
00058	      log("MP-] STARTMATCH, sending flag home "$F);
00059	      F.SendHome(-1);
00060	    }
00061	    Super.StartMatch();
00062	}
00063	
00064	
00065	//_____________________________________________________________________________
00066	function bool CheckEndGame(PlayerReplicationInfo Winner, string Reason)
00067	{
00068	    local XIIIMPFlag BestFlag;
00069	    local Controller P;
00070	    local PlayerController Player;
00071	    local XIIIGameReplicationInfo TGRI;
00072	
00073	    if ( (GameRulesModifiers != None) && !GameRulesModifiers.CheckEndGame(Winner, Reason) )
00074	      return false;
00075	
00076	    // check for tie
00077	    if ( Winner != none )
00078	      for ( P=Level.ControllerList; P!=None; P=P.nextController )
00079	        if ( P.bIsPlayer && (Winner.Team != P.PlayerReplicationInfo.Team) && (P.PlayerReplicationInfo.Team.Score == Winner.Team.Score) )
00080	        {
00081	          BroadcastLocalizedMessage( GameMessageClass, 0 );
00082	          return false;
00083	        }
00084	
00085	    EndTime = Level.TimeSeconds + 3.0;
00086	    TGRI = XIIIGameReplicationInfo(GameReplicationInfo);
00087	    SetGameEndMessage(TGRI, reason, winner);
00088	    log( "MP-] Game ended at "$EndTime);
00089	
00090	    GameReplicationInfo.Winner = Winner.Team;
00091	
00092	    XIIIGameReplicationInfo(GameReplicationInfo).iGameState = 3;
00093	    gotoState('MatchOver');
00094	
00095	    for ( P=Level.ControllerList; P!=None; P=P.nextController )
00096	    {
00097	      P.GotoState('GameEnded');
00098	      Player = PlayerController(P);
00099	      if ( Player != None )
00100	      {
00101	        Player.ClientSetBehindView(true);
00102	        Player.SetViewTarget(BestFlag.HomeBase);
00103	        Player.ClientGameEnded();
00104	      }
00105	    }
00106	    BestFlag.HomeBase.bHidden = false;
00107	    BestFlag.bHidden = true;
00108	
00109	    return true;
00110	}
00111	
00112	//_____________________________________________________________________________
00113	function ScoreFlag(Controller Scorer, XIIIMPFlag theFlag)
00114	{
00115	    local Controller TeamMate;
00116	
00117	    if ( Scorer.PlayerReplicationInfo.Team == theFlag.Team )
00118	    {
00119	      // scorer returned his flag
00120	      if ( PlayerController(Scorer) != none )
00121	        PlayerController(Scorer).PlayerStat.StatFlagsR ++;
00122	      Scorer.PlayerReplicationInfo.Score += 3;
00123	      if (Level.Game.StatLog != None)
00124	        Level.Game.StatLog.LogSpecialEvent("flag_returned", Scorer.PlayerReplicationInfo.PlayerID, theFlag.Team.TeamIndex);
00125	      BroadcastLocalizedMessage( class'XIIIMPCTFMessage', 1, Scorer.PlayerReplicationInfo, None, TheFlag );
00126	      return;
00127	    }
00128	
00129	    if ( PlayerController(Scorer) != none )
00130	      PlayerController(Scorer).PlayerStat.StatFlagsS ++;
00131	    Scorer.PlayerReplicationInfo.Score += 5;
00132	    Scorer.PlayerReplicationInfo.Team.Score += 1.0;
00133	
00134	    if (Level.Game.StatLog != None)
00135	      Level.Game.StatLog.LogSpecialEvent("flag_captured", Scorer.PlayerReplicationInfo.PlayerID, theFlag.Team.TeamIndex);
00136	
00137	    BroadcastLocalizedMessage( class'XIIIMPCTFMessage', 0, Scorer.PlayerReplicationInfo, None, TheFlag );
00138	    TriggerEvent(theFlag.HomeBase.Event,theFlag.HomeBase, Scorer.Pawn);
00139	
00140	    CheckScore(Scorer.PlayerReplicationInfo);
00141	}
00142	
00143	
00144	//_____________________________________________________________________________
00145	function ScoreKill(Controller Killer, Controller Other)
00146	{
00147	    if (killer == Other)
00148	    { // Suicide or killed by something and not someone
00149	      if ( PlayerController(Other) != none )
00150	        PlayerController(Other).PlayerStat.StatSuicides ++;
00151	      Other.PlayerReplicationInfo.Score -= 1;
00152	      //Other.PlayerReplicationInfo.Team.Score -= 1;
00153	    }
00154	    else if ( killer.PlayerReplicationInfo != None )
00155	    {
00156	      if ( Killer.PlayerReplicationInfo.Team != Other.PlayerReplicationInfo.Team )
00157	      {
00158	        if ( PlayerController(Killer) != none)
00159	          PlayerController(killer).PlayerStat.StatKills ++;
00160	        if ( PlayerController(Other) != none)
00161	          PlayerController(Other).PlayerStat.StatDeaths ++;
00162	        killer.PlayerReplicationInfo.Score += 1;
00163	        XIIIPlayerReplicationInfo(killer.PlayerReplicationInfo).MyDeathScore += 1;
00164	      }
00165	      else
00166	      {
00167	        if ( PlayerController(Killer) != none)
00168	          PlayerController(killer).PlayerStat.StatKills --;
00169	        killer.PlayerReplicationInfo.Score -= 1;
00170	      }
00171	    }
00172	
00173	    if ( GameRulesModifiers != None )
00174	      GameRulesModifiers.ScoreKill(Killer, Other);
00175	
00176	    CheckScore(Killer.PlayerReplicationInfo);
00177	}
00178	
00179	
00180	//_____________________________________________________________________________
00181	function Killed( Controller Killer, Controller Killed, Pawn KilledPawn, class<DamageType> damageType )
00182	{
00183	    local XIIIMPFlag F;
00184	
00185	    Super.Killed(Killer, Killed, KilledPawn, damageType);
00186	    if ( Killed.PlayerReplicationInfo.HasFlag != None )
00187	          Killed.PlayerReplicationInfo.HasFlag = none;
00188	
00189	//          XIIIMPFlag(Killed.PlayerReplicationInfo.HasFlag).SendHome();
00190	}
00191	
00192	
00193	
00194	defaultproperties
00195	{
00196	     ScoreBoardType="XIIIMP.XIIIMPCTFScoreBoard"
00197	     HUDType="XIIIMP.XIIICTFHUD"
00198	     MapPrefix="CTF"
00199	     GameName="Capture The Flag"
00200	     MutatorClass="XIIIMP.XIIIMPCTFMutator"
00201	}

End Source Code