//============================================================================= // JumpMod // // This mutator allows a server to configure the abilities for players to jump // around as well as how much boost they receive with each jump. // // Contact : bob.chatman@gmail.com // Website : www.gneu.org // License : Content is available under Creative Commons Attribution-ShareAlike // 3.0 License. //============================================================================= Class JumpMod extends UTMutator Config( JumpMod ); `include( JumpMod/Classes/LibraryMessage.uci ) var const string Version; var config int iMaxNumJumps; var config int iMaxJumpBoost; struct JMIEntry { var Controller P; var Info_JumpMod I; }; var array JMInfos; function InitMutator(string Options, out string ErrorMessage) { `Log("********************* JumpMod ********************",, 'Gneu Load'); `Log("* JumpMod {v." @ Version @ "}",, 'Gneu Load'); `Log("*",, 'Gneu Load'); `Log("* For other mutators, check www.gneu.org",, 'Gneu Load'); `Log("*",, 'Gneu Load'); `Log("* If you are having issues, please contact the",, 'Gneu Load'); `Log("* developer - bob.chatman@gmail.com",, 'Gneu Load'); `Log("**************************************************",, 'Gneu Load'); `DebugMessage("Initializing Mutator"); iMaxNumJumps = ValidJumpCount(iMaxNumJumps); iMaxJumpBoost = ValidJumpBoost(iMaxJumpBoost); SaveConfig(); Super.InitMutator(Options, ErrorMessage); } function int ValidJumpCount(coerce int n) { `DebugMessage("Validating Jump Count {" $ n $ "}"); if (n < 0|| n > 30) return 4; return n; } function int ValidJumpBoost(coerce int n) { `DebugMessage("Validating Jump Boost {" $ n $ "}"); if (n < 1|| n > 10) return 4; return n; } // Remove the player from our array function NotifyLogout( Controller player ) { local int ndx; `DebugMessage("Player has logged out" @ player); ndx = JMInfos.Find('P', player); if (ndx > -1) JMInfos.Remove(ndx, 1); Super.NotifyLogout( player ); } // Set up the info on the player. // Since we dont have the pawn yet, just ignore that value and move on. function NotifyLogin(Controller NewPlayer) { local JMIEntry J; if( UTPlayerController( NewPlayer ) != None ) { `DebugMessage("Attaching Info_JumpMod to PlayerController {" $ NewPlayer $ "}"); J.I = Spawn( Class'Info_JumpMod', NewPlayer ); j.P = NewPlayer; J.I.riMaxNumJumps = iMaxNumJumps; J.I.riMaxJumpBoost = iMaxJumpBoost; JMInfos.AddItem(J); } Super.NotifyLogin(NewPlayer); } function Mutate(string MutateString, PlayerController Sender) { local array ParsedString; local bool Update; local JMIEntry J; ParseStringIntoArray(Caps(MutateString), ParsedString, " ", true); if (ParsedString.Length != 3 || ParsedString[0] != "JUMPMOD") { `DebugMessage("Either Invalid Input OR Not for this mutator - " $ MutateString); Super.Mutate(MutateString, Sender); return; } switch (ParsedString[1]) { case "SETMAXJUMPS": `LogMessage("Setting Max Jumps To" @ ParsedString[2]); iMaxNumJumps = ValidJumpCount(ParsedString[2]); Update = true; break; case "SETJUMPBOOST": `LogMessage("Setting Jump Boost To" @ ParsedString[2]); iMaxJumpBoost = ValidJumpBoost(ParsedString[2]); Update = true; break; default: Super.Mutate(MutateString, Sender); } if (Update) { foreach JMInfos(J) { `DebugMessage("Updating New Mutated Values for Pawn {" $ J.P $ "}"); UpdatePawn(UTPawn(J.P.Pawn)); J.I.riMaxNumJumps = iMaxNumJumps; J.I.riMaxJumpBoost = iMaxJumpBoost; } `DebugMessage("Saving Configuraiton"); SaveConfig(); } Super.Mutate(MutateString, Sender); } function UpdatePawn(UTPawn P) { if (P == None) { `DebugMessage("P is not a UTPawn"); return; } `DebugMessage("Updating JumpMod Values for Pawn {" $ P $ "}" @ iMaxNumJumps @ iMaxJumpBoost); P.MaxMultiJump = iMaxNumJumps; P.MultiJumpBoost = (iMaxJumpBoost * 40); P.MultiJumpRemaining = iMaxNumJumps; } // We have the pawn at this point, function ModifyPlayer(Pawn P) { local int ndx; `DebugMessage("Updating JumpMod Pawn {" $ P $ "}"); // find its info_jumpmod ndx = JMInfos.Find('P', P.Controller); if (ndx > -1) { JMInfos[ndx].I.rPlayerPawn = UTPawn(P); UpdatePawn(UTPawn(P)); } super.ModifyPlayer(P); } // Set Default Properties defaultproperties { iMaxNumJumps = 5 iMaxJumpBoost = 4 GroupNames(0)="MULTIJUMP" Version = "2.1.0"; }