## Engine
Class CheatManager

source: C:\XIII\Engine\Classes\CheatManager.uc

    Core.Object
       |
       +--Engine.CheatManager

Direct Known Subclasses:XIIICheatManager

class CheatManager
extends Core.Object

    //=============================================================================
    // CheatManager
    // Object within playercontroller that manages "cheat" commands
    // only spawned in single player mode
    //=============================================================================

Function Summary
`void` | `AllAmmo()`
    /* ELR Replaced by MaxAmmo
    exec
`void` | `Amphibious()`
    /*
    exec
`void` | `Avatar(string ClassName)`
    /* Avatar()
    Possess a pawn of the requested class
    */
`void` | `CauseEvent(name EventName)`
`void` | `ChangeSize(float F)`
    // Scale the player's size to be F * default size
    exec
`void` | `EndPath()`
    /* Stop interpolation
    */
`void` | `Fly()`
    {
    	Pawn.UnderwaterTime = +999999.0;
    }
    */
`void` | `FreeCamera(bool B)`
    /*
    Camera and pawn aren't rotated together in behindview when bFreeCamera is true
    */
`void` | `Ghost()`
`void` | `God()`
    {
    	Pawn.bHidden = B;

    	if (B)
    		Pawn.Visibility = 0;
    	else
    		Pawn.Visibility = Pawn.Default.Visibility;
    }
    */
`void` | `Invisible(bool B)`
    /*
    exec
`void` | `KillPawns()`
`void` | `Loaded()`
    /*
    exec
`void` | `PlayersOnly()`
`void` | `RememberSpot()`
    // remember spot for path testing (display path using ShowDebug)
`void` | `SetCameraDist(float F)`
    {
    	if ( Pawn.SetCollisionSize(Pawn.Default.CollisionRadius * F,Pawn.Default.CollisionHeight * F) )
    	{
    		Pawn.SetDrawScale(F);
    		Pawn.SetLocation(Pawn.Location);
    	}
    }
    */
`void` | `SetFlash(float F)`
`void` | `SetFogB(float F)`
`void` | `SetFogG(float F)`
`void` | `SetFogR(float F)`
`void` | `SetJumpZ(float F)`
`void` | `SetSpeed(float F)`
    /*
    exec
`void` | `SloMo(float T)`
`void` | `Summon(string ClassName)`
`void` | `ViewPlayer(string S)`
`void` | `ViewSelf(optional bool)`
    // ***********************************************************
    // Changing viewtarget
`void` | `Walk()`
`void` | `WriteToLog()`
    /* Used for correlating game situation with log file
    */

Source Code

    00001	//=============================================================================
    00002	// CheatManager
    00003	// Object within playercontroller that manages "cheat" commands
    00004	// only spawned in single player mode
    00005	//=============================================================================
    00006
    00007	class CheatManager extends Object within PlayerController
    00008		native;
    00009
    00010	/* Used for correlating game situation with log file
    00011	*/
    00012	exec function WriteToLog()
    00013	{
    00014		log("NOW!");
    00015	}
    00016
    00017	exec function SetFlash(float F)
    00018	{
    00019		FlashScale.X = F;
    00020	}
    00021
    00022	exec function SetFogR(float F)
    00023	{
    00024		FlashFog.X = F;
    00025	}
    00026
    00027	exec function SetFogG(float F)
    00028	{
    00029		FlashFog.Y = F;
    00030	}
    00031
    00032	exec function SetFogB(float F)
    00033	{
    00034		FlashFog.Z = F;
    00035	}
    00036
    00037	/*
    00038	// Scale the player's size to be F * default size
    00039	exec function ChangeSize( float F )
    00040	{
    00041		if ( Pawn.SetCollisionSize(Pawn.Default.CollisionRadius * F,Pawn.Default.CollisionHeight * F) )
    00042		{
    00043			Pawn.SetDrawScale(F);
    00044			Pawn.SetLocation(Pawn.Location);
    00045		}
    00046	}
    00047	*/
    00048
    00049	exec function SetCameraDist( float F )
    00050	{
    00051		CameraDist = FMax(F,2);
    00052	}
    00053
    00054	/* Stop interpolation
    00055	*/
    00056	exec function EndPath()
    00057	{
    00058	}
    00059
    00060	/*
    00061	Camera and pawn aren't rotated together in behindview when bFreeCamera is true
    00062	*/
    00063	exec function FreeCamera( bool B )
    00064	{
    00065		bFreeCamera = B;
    00066		bBehindView = B;
    00067	}
    00068
    00069
    00070	exec function CauseEvent( name EventName )
    00071	{
    00072		TriggerEvent( EventName, Pawn, Pawn);
    00073	}
    00074
    00075	/*
    00076	exec function Amphibious()
    00077	{
    00078		Pawn.UnderwaterTime = +999999.0;
    00079	}
    00080	*/
    00081
    00082	exec function Fly()
    00083	{
    00084		Pawn.UnderWaterTime = Pawn.Default.UnderWaterTime;
    00085		ClientMessage("You feel much lighter");
    00086		Pawn.SetCollision(true, true , true);
    00087		Pawn.bCollideWorld = true;
    00088		bCheatFlying = true;
    00089		Outer.GotoState('PlayerFlying');
    00090	}
    00091
    00092	exec function Walk()
    00093	{
    00094		if ( Pawn != None )
    00095		{
    00096			bCheatFlying = false;
    00097			Pawn.UnderWaterTime = Pawn.Default.UnderWaterTime;
    00098			Pawn.SetCollision(true, true , true);
    00099			Pawn.SetPhysics(PHYS_Walking);
    00100			Pawn.bCollideWorld = true;
    00101			ClientReStart();
    00102		}
    00103	}
    00104
    00105	exec function Ghost()
    00106	{
    00107		Pawn.UnderWaterTime = -1.0;
    00108		ClientMessage("You feel ethereal");
    00109		Pawn.SetCollision(false, false, false);
    00110		Pawn.bCollideWorld = false;
    00111		bCheatFlying = true;
    00112		Outer.GotoState('PlayerFlying');
    00113	}
    00114
    00115	/* ELR Replaced by MaxAmmo
    00116	exec function AllAmmo()
    00117	{
    00118		local Inventory Inv;
    00119
    00120		for( Inv=Pawn.Inventory; Inv!=None; Inv=Inv.Inventory )
    00121			if (Ammunition(Inv)!=None)
    00122			{
    00123				Ammunition(Inv).AmmoAmount  = 999;
    00124				Ammunition(Inv).MaxAmmo  = 999;
    00125			}
    00126	}
    00127	*/
    00128
    00129	/*
    00130	exec function Invisible(bool B)
    00131	{
    00132		Pawn.bHidden = B;
    00133
    00134		if (B)
    00135			Pawn.Visibility = 0;
    00136		else
    00137			Pawn.Visibility = Pawn.Default.Visibility;
    00138	}
    00139	*/
    00140
    00141	exec function God()
    00142	{
    00143		if ( bGodMode )
    00144		{
    00145			bGodMode = false;
    00146			ClientMessage("God mode off");
    00147			return;
    00148		}
    00149
    00150		bGodMode = true;
    00151		ClientMessage("God Mode on");
    00152	}
    00153
    00154	exec function SloMo( float T )
    00155	{
    00156		Level.Game.SetGameSpeed(T);
    00157		Level.Game.SaveConfig();
    00158		Level.Game.GameReplicationInfo.SaveConfig();
    00159	}
    00160
    00161	exec function SetJumpZ( float F )
    00162	{
    00163		Pawn.JumpZ = F;
    00164	}
    00165
    00166	/*
    00167	exec function SetSpeed( float F )
    00168	{
    00169		Pawn.GroundSpeed = Pawn.Default.GroundSpeed * f;
    00170		Pawn.WaterSpeed = Pawn.Default.WaterSpeed * f;
    00171	}
    00172	*/
    00173
    00174	exec function KillAll(class<actor> aClass)
    00175	{
    00176		local Actor A;
    00177
    00178		if ( ClassIsChildOf(aClass, class'Pawn') )
    00179		{
    00180			KillAllPawns(class<Pawn>(aClass));
    00181			return;
    00182		}
    00183		ForEach DynamicActors(class 'Actor', A)
    00184			if ( ClassIsChildOf(A.class, aClass) )
    00185				A.Destroy();
    00186	}
    00187
    00188	// Kill non-player pawns and their controllers
    00189	function KillAllPawns(class<Pawn> aClass)
    00190	{
    00191		local Pawn P;
    00192
    00193		ForEach DynamicActors(class'Pawn', P)
    00194			if ( ClassIsChildOf(P.Class, aClass)
    00195				&& !P.IsHumanControlled() )
    00196			{
    00197				if ( P.Controller != None )
    00198					P.Controller.Destroy();
    00199				P.Destroy();
    00200			}
    00201	}
    00202
    00203	exec function KillPawns()
    00204	{
    00205		KillAllPawns(class'Pawn');
    00206	}
    00207
    00208	/* Avatar()
    00209	Possess a pawn of the requested class
    00210	*/
    00211	exec function Avatar( string ClassName )
    00212	{
    00213		local class<actor> NewClass;
    00214		local Pawn P;
    00215
    00216		NewClass = class<actor>( DynamicLoadObject( ClassName, class'Class' ) );
    00217		if( NewClass!=None )
    00218		{
    00219			Foreach DynamicActors(class'Pawn',P)
    00220			{
    00221				if ( (P.Class == NewClass) && (P != Pawn) )
    00222				{
    00223					if ( Pawn.Controller != None )
    00224						Pawn.Controller.PawnDied();
    00225					Possess(P);
    00226					break;
    00227				}
    00228			}
    00229		}
    00230	}
    00231
    00232	exec function Summon( string ClassName )
    00233	{
    00234		local class<actor> NewClass;
    00235		local vector SpawnLoc;
    00236
    00237		log( "Fabricate " $ ClassName );
    00238		NewClass = class<actor>( DynamicLoadObject( ClassName, class'Class' ) );
    00239		if( NewClass!=None )
    00240		{
    00241			if ( Pawn != None )
    00242				SpawnLoc = Pawn.Location;
    00243			else
    00244				SpawnLoc = Location;
    00245			Spawn( NewClass,,,SpawnLoc + 72 * Vector(Rotation) + vect(0,0,1) * 15 );
    00246		}
    00247
} 00248 00249 exec function PlayersOnly() 00250 { 00251 Level.bPlayersOnly = !Level.bPlayersOnly; 00252 } 00253 00254 exec function CheatView( class<actor> aClass, optional bool bQuiet ) 00255 { 00256 ViewClass(aClass,bQuiet, true); 00257 } 00258 00259 // *********************************************************** 00260 // Navigation Aids (for testing) 00261 00262 // remember spot for path testing (display path using ShowDebug) 00263 exec function RememberSpot() 00264 { 00265 if ( Pawn != None ) 00266 Destination = Pawn.Location; 00267 else 00268 Destination = Location; 00269 } 00270 00271 // *********************************************************** 00272 // Changing viewtarget 00273 00274 exec function ViewSelf(optional bool bQuiet) 00275 { 00276 bBehindView = false; 00277 if ( Pawn != None ) 00278 SetViewTarget(Pawn); 00279 else 00280 SetViewtarget(outer); 00281 if (!bQuiet ) 00282 ClientMessage(OwnCamera, 'Event'); 00283 FixFOV(); 00284 } 00285 00286 exec function ViewPlayer( string S ) 00287 { 00288 local Controller P; 00289 00290 for ( P=Level.ControllerList; P!=None; P= P.NextController ) 00291 if ( P.bIsPlayer && (P.PlayerReplicationInfo.PlayerName ~= S) ) 00292 break; 00293 00294 if ( P.Pawn != None ) 00295 { 00296 ClientMessage(ViewingFrom@P.PlayerReplicationInfo.PlayerName, 'Event'); 00297 SetViewTarget(P.Pawn); 00298 } 00299 00300 bBehindView = ( ViewTarget != Pawn ); 00301 if ( bBehindView ) 00302 ViewTarget.BecomeViewTarget(); 00303 } 00304 00305 exec function ViewClass( class<actor> aClass, optional bool bQuiet, optional bool bCheat ) 00306 { 00307 local actor other, first; 00308 local bool bFound; 00309 00310 if ( (Level.Game != None) && !Level.Game.bCanViewOthers ) 00311 return; 00312 00313 first = None; 00314 ForEach AllActors( aClass, other ) 00315 { 00316 if ( bFound || (first == None) ) 00317 { 00318 first = other; 00319 if ( bFound ) 00320 break; 00321 } 00322 if ( other == ViewTarget ) 00323 bFound = true; 00324 } 00325 00326 if ( first != None ) 00327 { 00328 if ( !bQuiet ) 00329 { 00330 if ( Pawn(first) != None ) 00331 ClientMessage(ViewingFrom@First.GetHumanReadableName(), 'Event'); 00332 else 00333 ClientMessage(ViewingFrom@first, 'Event'); 00334 } 00335 SetViewTarget(first); 00336 bBehindView = ( ViewTarget != outer ); 00337 00338 if ( bBehindView ) 00339 ViewTarget.BecomeViewTarget(); 00340 00341 FixFOV(); 00342 } 00343 else 00344 ViewSelf(bQuiet); 00345 } 00346 00347 /* 00348 exec function Loaded() 00349 { 00350 local inventory Inv; 00351 local weapon Weap; 00352 00353 if( Level.Netmode!=NM_Standalone ) 00354 return; 00355 00356 Pawn.GiveWeapon("Weapons.WeapCOGAssaultRifle"); 00357 Pawn.GiveWeapon("Weapons.WeapCOGLightPlasma"); 00358 Pawn.GiveWeapon("Weapons.WeapCOGPistol"); 00359 Pawn.GiveWeapon("Weapons.WeapCOGMinigun"); 00360 Pawn.GiveWeapon("Weapons.WeapGeistSniperRifle"); 00361 Pawn.GiveWeapon("Weapons.WeapGeistGrenadeLauncher"); 00362 00363 for ( inv=Pawn.inventory; inv!=None; inv=inv.inventory ) 00364 { 00365 weap = Weapon(inv); 00366 if ( (weap != None) && (weap.AmmoType != None) ) 00367 weap.AmmoType.AmmoAmount = weap.AmmoType.MaxAmmo; 00368 } 00369 } 00370 */ 00371 00372 defaultproperties 00373 { 00374 }

End Source Code