Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
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 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 |
// ============================================================================ // JBMutatorDebug // Copyright 2003 by Mychaeel <mychaeel@planetjailbreak.com> // $Id: JBMutatorDebug.uc,v 1.15 2006-11-11 11:20:14 jrubzjeknf Exp $ // // Provides helper functions for debugging Jailbreak maps and code. // ============================================================================ class JBMutatorDebug extends Mutator notplaceable; // ============================================================================ // Variables // ============================================================================ var JBGameRulesDebug JBGameRulesDebug; // ============================================================================ // MutatorIsAllowed // // Allows using this mutator only with Jailbreak games. // ============================================================================ function bool MutatorIsAllowed() { return (Jailbreak(Level.Game) != None); } // ============================================================================ // PostBeginPlay // // Registers a JBGameRules actor with the game. // ============================================================================ event PostBeginPlay() { Log("Jailbreak Debugging: Debugging functions are available"); JBGameRulesDebug = Spawn(Class'JBGameRulesDebug'); if (Level.Game.GameRulesModifiers == None) Level.Game.GameRulesModifiers = JBGameRulesDebug; else Level.Game.GameRulesModifiers.AddGameRules(JBGameRulesDebug); } // ============================================================================ // Mutate // // Provides commands to influence Jailbreak gameplay. Commands and their // switches are not case-sensitive. // // CauseEvent <event> Works like the CauseEvent console command // available in standalone games, but works in // online games too. // // SetSwitch On|Off [Red|Blue] Enables or disables the release switches // for the given team. If no team is specified, // affects both teams. // // Jam Red|Blue Jams the jails of the given team. // // UnJam Red|Blue UnJams the jails of the given team. // // CanBeJailed On|Off [<name>|Me|Team Red|Team Blue] // Sets whether the given player will be sent // to jail after being killed or not. If no // name is specified, affects all players. // // Release Red|Blue|<jailtag>|<releaseevent> // Causes a release of the given team, the // given jail (for both teams if applicable) or // the given switch event, respectively. // // ForceRelease Red|Blue|<jailtag>|<releaseevent> // Causes a forcerelease of the given team, the // given jail (for both teams if applicable) or // the given switch event, respectively. // // KillPlayer Red|Blue|Each|<name> // Kills the given player. Splat. // // ArenaMatch Starts an Arena match in the first Arena // it finds. // // ============================================================================ function Mutate(string TextMutate, PlayerController Sender) { local string TextCommand; local string TextFlag; local string TextName; local string TextTeam; local Actor thisActor; local JBInfoArena thisArena; local JBInfoJail thisJail; local Controller ControllerKilled; Super.Mutate(TextMutate, Sender); TextCommand = GetParam(TextMutate); if (TextCommand ~= "CauseEvent") { foreach DynamicActors(Class'Actor', thisActor) if (string(thisActor.Tag) ~= TextMutate) thisActor.Trigger(Sender.Pawn, Sender.Pawn); } else if (TextCommand ~= "DestroyActor") { foreach DynamicActors(Class'Actor', thisActor) if (string(thisActor.Name) ~= TextMutate) { Log("Jailbreak Debugging: Destroying actor" @ thisActor @ "at" @ thisActor.Location); thisActor.Destroy(); } } else if (TextCommand ~= "SetSwitch") { TextFlag = GetParam(TextMutate); TextTeam = GetParam(TextMutate); if (TextTeam ~= "Red" || TextTeam == "") JBGameRulesDebug.ExecSetSwitch(0, TextFlag ~= "On"); if (TextTeam ~= "Blue" || TextTeam == "") JBGameRulesDebug.ExecSetSwitch(1, TextFlag ~= "On"); } else if (TextCommand ~= "Jam") { TextTeam = GetParam(TextMutate); if (TextTeam == "") Log("Jailbreak Debugging: Jamming all jails of both teams"); else Log("Jailbreak Debugging: Jamming all jails of team" @ TextTeam); for (thisJail = JBGameReplicationInfo(Level.Game.GameReplicationInfo).firstJail; thisJail != none; thisJail = thisJail.nextJail) { if (TextTeam ~= "Red" || TextTeam == "") thisJail.Jam(0); if (TextTeam ~= "Blue" || TextTeam == "") thisJail.Jam(1); } } else if (TextCommand ~= "UnJam") { TextTeam = GetParam(TextMutate); if (TextTeam == "") Log("Jailbreak Debugging: Jamming all jails of both teams"); else Log("Jailbreak Debugging: Jamming all jails of team" @ TextTeam); for (thisJail = JBGameReplicationInfo(Level.Game.GameReplicationInfo).firstJail; thisJail != none; thisJail = thisJail.nextJail) { if (TextTeam ~= "Red" || TextTeam == "") thisJail.UnJam(0); if (TextTeam ~= "Blue" || TextTeam == "") thisJail.UnJam(1); } } else if (TextCommand ~= "CanBeJailed") { TextFlag = GetParam(TextMutate); TextName = GetParam(TextMutate); if (TextName ~= "Me") TextName = Sender.PlayerReplicationInfo.PlayerName; if (TextName ~= "Team") { TextTeam = GetParam(TextMutate); } JBGameRulesDebug.ExecCanBeJailed(TextName, TextFlag ~= "On", TextTeam); } else if (TextCommand ~= "Release") { JBGameRulesDebug.ExecRelease(TextMutate); } else if (TextCommand ~= "ForceRelease") { JBGameRulesDebug.ExecForceRelease(TextMutate); } else if (TextCommand ~= "KillPlayer") { TextName = GetParam(TextMutate); if( TextName ~= "Each" ) { ControllerKilled = JBGameRulesDebug.FindPlayer("Red"); if (ControllerKilled != None) ControllerKilled.Pawn.GibbedBy(Sender); ControllerKilled = JBGameRulesDebug.FindPlayer("Blue"); if (ControllerKilled != None) ControllerKilled.Pawn.GibbedBy(Sender); } else { ControllerKilled = JBGameRulesDebug.FindPlayer(TextName); if (ControllerKilled != None) ControllerKilled.Pawn.GibbedBy(Sender); } } else if (TextCommand ~= "ArenaMatch") { foreach AllActors(class'JBInfoArena',thisArena) break; if ( thisArena != None ) { thisArena.Trigger(Self, None); } } else if (TextCommand ~= "ToggleShowLocation") { JBGameRulesDebug.ShowLocation(Sender); } } // ============================================================================ // GetParam // // Extracts and returns the first whitespace-delimited parameter from the // given string. // ============================================================================ function string GetParam(out string TextParam) { local int iCharSeparator; local string TextResult; iCharSeparator = InStr(TextParam, " "); if (iCharSeparator < 0) iCharSeparator = Len(TextParam); TextResult = Left(TextParam, iCharSeparator); TextParam = Mid (TextParam, iCharSeparator); while (Left(TextParam, 1) == " ") TextParam = Mid(TextParam, 1); return TextResult; } // ============================================================================ // Defaults // ============================================================================ defaultproperties { FriendlyName = "Jailbreak Debug"; Description = "Provides helper functions for debugging Jailbreak maps and code."; } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |