Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UTGame.UTGreedGame


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
/**
 * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
 */
class UTGreedGame extends UTTeamGame abstract;

/** Flag bases at which to UTGreedFlags are spawned */
var UTCTFBase FlagBases[2];
/** Number of skulls needed for a "Hoarder" message */
var int HoarderMessageThreshold;

var class<UTCTFFlag> BlueFlagType;
var class<UTCTFFlag> RedFlagType;

var SoundCue CoinReturnSound;

simulated function PostBeginPlay()
{
	local UTCTFBase CTFBase;
	local UTVehicleFactory VF;

	Super.PostBeginPlay();
	ForEach WorldInfo.AllNavigationPoints(class'UTCTFBase', CTFBase)
	{
		if (CTFBase.DefenderTeamIndex < 2)
		{
			if (CTFBase.DefenderTeamIndex == 0)
			{
				CTFBase.FlagType = RedFlagType; 
			}
			else
			{
				CTFBase.FlagType = BlueFlagType;
			}

			FlagBases[CTFBase.DefenderTeamIndex] = CTFBase;
			CTFBase.myflag = Spawn(CTFBase.FlagType, CTFBase);
			CTFBase.myFlag.HomeBase = CTFBase;
			CTFBase.myFlag.Team = Teams[CTFBase.DefenderTeamIndex];
		}
	}

	// If we find any vehicle factories, allow the hoverboard
	ForEach WorldInfo.AllNavigationPoints(class'UTVehicleFactory', VF)
	{
		bAllowHoverboard = true;
		bStartWithLockerWeaps = true;
		break;
	}
}

// Returns whether a mutator should be allowed with this gametype
static function bool AllowMutator( string MutatorClassName )
{
	if (( MutatorClassName ~= "UTGame.UTMutator_NoTranslocator") ||
		( MutatorClassName ~= "UTGame.UTMutator_NoOrbs") ||
		( MutatorClassName ~= "UTGame.UTMutator_Survival") ||
		( MutatorClassName ~= "UTGame.UTMutator_LowGrav"))
	{
		return false;
	}

	return Super.AllowMutator(MutatorClassName);
}

function AddMutator(string mutname, optional bool bUserAdded)
{
	local UTVehicleFactory VF;

	// don't allow instagib or low grav with vehicles
	if ( (mutname ~= "UTGame.UTMutator_Instagib") || (mutname ~= "UTGame.UTMutator_LowGrav") )
	{
		ForEach AllActors(class'UTVehicleFactory', VF)
		{
			return;
		}
	}
	super.AddMutator(mutname, bUserAdded);
}

/** Announce a greed score - requires different rules since can increment by more than one point at a time 
  */
function AnnounceGreedScore(int ScoringTeam, int ScoreBump)
{
	local UTPlayerController PC;
	local int OtherTeam, MessageIndex;

	if ( TeamScoreMessageClass == None )
	{
		return;
	}

	OtherTeam = 1 - ScoringTeam;
	
	if ( Teams[ScoringTeam].Score - ScoreBump <= Teams[OtherTeam].Score )
	{
		// scoring team was behind or tied
		if ( Teams[ScoringTeam].Score > Teams[OtherTeam].Score )
		{
			// takes the lead
			MessageIndex = 4 + ScoringTeam;
		}
		else
		{
			MessageIndex = ScoringTeam;
		}
	}
	else
	{
		// scoring team was already leading
		MessageIndex = ScoringTeam;
	}

	foreach WorldInfo.AllControllers(class'UTPlayerController', PC)
	{
		PC.ReceiveLocalizedMessage(TeamScoreMessageClass, MessageIndex);
	}
}

/** Clears the coin count of CoinOwner, and spawns 
*  CoinValue coins at CoinOwner's location
*/
function DropCoins(Controller CoinOwner, int CoinValue);

/*
* Increments the player and team score when coins are returned to
* the opposing team's base.
* Returns true if the score is incremented, false other
*/ 
function bool ScoreCoinReturn(Controller Scorer);

function bool NearGoal(Controller C)
{
	local UTGameObjective B;

	B = FlagBases[1 - C.PlayerReplicationInfo.Team.TeamIndex];
	return ( VSize(C.Pawn.Location - B.Location) < 1000 );
}

/** Teleports a pawn to a spawn location at it's team base */
function TeleportToBase(UTPawn Traveler)
{
	local NavigationPoint BestStart;
	local vector PrevPosition;
	local rotator NewRotation;

	BestStart = ChoosePlayerStart(Traveler.Controller);

	if (BestStart != None)
	{
		PrevPosition = Traveler.Location;
		Traveler.SetLocation(BestStart.Location);
		Traveler.DoTranslocate(PrevPosition);
		NewRotation = BestStart.Rotation;
		NewRotation.Roll = 0;
		Traveler.Controller.ClientSetRotation(NewRotation);
	}
}

defaultproperties
{
   HoarderMessageThreshold=20
   bScoreTeamKills=False
   bSpawnInTeamArea=True
   bUndrivenVehicleDamage=True
   bScoreDeaths=False
   bShouldPostRenderEnemyPawns=True
   Description="Return the enemy's skulls to their base."
   MapPrefixes(0)="CTF"
   MapPrefixes(1)="VCTF"
   EndOfMatchRulesTemplateStr_Scoring="First team to score `g skulls wins"
   EndOfMatchRulesTemplateStr_ScoringSingle="First team to capture a skull wins"
   EndOfMatchRulesTemplateStr_Time="Team with most captured skulls in `t mins. wins"
   GameName="Greed"
   DeathMessageClass=Class'UTGame.UTTeamDeathMessage'
   OnlineStatsWriteClass=Class'UTGame.UTLeaderboardWriteGreed'
   OnlineGameSettingsClass=Class'UTGame.UTGameSettingsGreed'
   Name="Default__UTGreedGame"
   ObjectArchetype=UTTeamGame'UTGame.Default__UTTeamGame'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: tr 31-1-2018 17:18:36.000 - Creation time: sk 18-3-2018 10:01:21.478 - Created with UnCodeX