Engine
Class GameRules

source: C:\XIII\Engine\Classes\GameRules.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Info
         |
         +--Engine.GameRules
Direct Known Subclasses:XIIISoloGameRules, XIIIMPGRInstaKill, XIIIMPGameRules

class GameRules
extends Engine.Info

//============================================================================= // GameRules. // // The GameRules class handles game rule modifications for the GameInfo such as scoring, // finding player starts, and damage modification. // //=============================================================================
Variables
 GameRules NextGameRules


Function Summary
 void AddGameRules(GameRules GR)
 bool CheckEndGame(PlayerReplicationInfo Winner, string Reason)
     
/* CheckEndGame()
Allows modification of game ending conditions.  Return false to prevent game from ending
*/
 bool CheckScore(PlayerReplicationInfo Scorer)
     
/* CheckScore()
see if this score means the game ends
return true to override gameinfo checkscore, or if game was ended (with a call to Level.Game.EndGame() )
*/
 NavigationPoint FindPlayerStart(Controller Player, optional byte, optional string)
     
/* Override GameInfo FindPlayerStart() - called by GameInfo.FindPlayerStart()
if a NavigationPoint is returned, it will be used as the playerstart
*/
 string GetRules()
     
/* return string containing game rules information
*/
 bool HandleRestartGame()
     
//
// Restart the game.
//
 bool OverridePickupQuery(Pawn Other, Pickup item, out byte)
     
/* OverridePickupQuery()
when pawn wants to pickup something, gamerules given a chance to modify it.  If this function 
returns true, bAllowPickup will determine if the object can be picked up.
*/
 void ScoreKill(Controller Killer, Controller Killed)
 void ScoreObjective(PlayerReplicationInfo Scorer, Int Score)



Source Code


00001	//=============================================================================
00002	// GameRules.
00003	//
00004	// The GameRules class handles game rule modifications for the GameInfo such as scoring, 
00005	// finding player starts, and damage modification.
00006	//
00007	//=============================================================================
00008	class GameRules extends Info;
00009	
00010	var GameRules NextGameRules;
00011	
00012	function AddGameRules(GameRules GR)
00013	{
00014		if ( NextGameRules == None )
00015			NextGameRules = GR;
00016		else
00017			NextGameRules.AddGameRules(GR);
00018	}
00019	
00020	/* Override GameInfo FindPlayerStart() - called by GameInfo.FindPlayerStart()
00021	if a NavigationPoint is returned, it will be used as the playerstart
00022	*/
00023	function NavigationPoint FindPlayerStart( Controller Player, optional byte InTeam, optional string incomingName )
00024	{
00025		if ( NextGameRules != None )
00026			return NextGameRules.FindPlayerStart(Player,InTeam,incomingName);
00027	
00028		return None;
00029	}
00030	
00031	/* return string containing game rules information
00032	*/
00033	function string GetRules()
00034	{
00035		local string ResultSet;
00036	
00037		if ( NextGameRules == None )
00038			ResultSet = ResultSet$NextGameRules.GetRules();
00039	
00040		return ResultSet;
00041	}
00042	
00043	//
00044	// Restart the game.
00045	//
00046	function bool HandleRestartGame()
00047	{
00048		if ( (NextGameRules != None) && NextGameRules.HandleRestartGame() )
00049			return true;
00050		return false;
00051	}
00052	
00053	/* CheckEndGame()
00054	Allows modification of game ending conditions.  Return false to prevent game from ending
00055	*/
00056	function bool CheckEndGame(PlayerReplicationInfo Winner, string Reason)
00057	{
00058		if ( NextGameRules != None )
00059			return NextGameRules.CheckEndGame(Winner,Reason);
00060	
00061		return true;
00062	}
00063	
00064	/* CheckScore()
00065	see if this score means the game ends
00066	return true to override gameinfo checkscore, or if game was ended (with a call to Level.Game.EndGame() )
00067	*/
00068	function bool CheckScore(PlayerReplicationInfo Scorer)
00069	{
00070		if ( NextGameRules != None )
00071			return NextGameRules.CheckScore(Scorer);
00072	
00073		return false;
00074	}
00075	
00076	/* OverridePickupQuery()
00077	when pawn wants to pickup something, gamerules given a chance to modify it.  If this function 
00078	returns true, bAllowPickup will determine if the object can be picked up.
00079	*/
00080	function bool OverridePickupQuery(Pawn Other, Pickup item, out byte bAllowPickup)
00081	{
00082		if ( (NextGameRules != None) &&  NextGameRules.OverridePickupQuery(Other, item, bAllowPickup) )
00083			return true;
00084		return false;
00085	}
00086	
00087	function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
00088	{
00089		if ( (NextGameRules != None) && NextGameRules.PreventDeath(Killed,Killer, damageType,HitLocation) )
00090			return true;
00091		return false;
00092	}
00093	
00094	function ScoreObjective(PlayerReplicationInfo Scorer, Int Score)
00095	{
00096		if ( NextGameRules != None )
00097			NextGameRules.ScoreObjective(Scorer,Score);
00098	}
00099	
00100	function ScoreKill(Controller Killer, Controller Killed)
00101	{
00102		if ( NextGameRules != None )
00103			NextGameRules.ScoreKill(Killer,Killed);
00104	}
00105	
00106	function int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, vector Momentum, class<DamageType> DamageType )
00107	{
00108		if ( NextGameRules != None )
00109			return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
00110		return Damage;
00111	}
00112	
00113	defaultproperties
00114	{
00115	}

End Source Code