Jump to content

[Mod] Rx_Mutator_DoubleJump


Ukill

Recommended Posts

Rx_Mutator_DoubleJump


*  This mutator will add the DoubleJump to the Renegade X game    *
*  


 

Version 1.0.0

Compatible with Renegade X v5.282  

Mutator :

Rx_Mutator_DoubleJump.u (Download)

Source :

Spoiler

 

Rx_Mutator_DoubleJump.uc (Download)

Spoiler


/******************************************************************************
*  Modified by Ukill, this can contain parts of code written by Jessica\Yosh  *
*    This mutator will add the DoubleJump function to the Renegade X game     *
*******************************************************************************
* Rx_Mutator_DoubleJump                                                       *
******************************************************************************/

class Rx_Mutator_DoubleJump extends UTMutator;

function bool CheckReplacement(Actor Other) {
	if(Other.IsA('Rx_TeamInfo')) {
		Rx_Game(WorldInfo.Game).DefaultPawnClass = class'Rx_Mutator_DoubleJump_Pawn' ;
		Rx_Game(WorldInfo.Game).PlayerControllerClass = class'Rx_Mutator_DoubleJump_Controller' ; 
	}
return true;
}

DefaultProperties {
}
  


 

Rx_Mutator_DoubleJump_Controller.uc (Download)

Spoiler


/******************************************************************************
*  Modified by Ukill, this can contain parts of code written by Jessica\Yosh  *
*    This mutator will add the DoubleJump function to the Renegade X game     *
*******************************************************************************
* Rx_Mutator_DoubleJump_Controller                                            *
******************************************************************************/

class Rx_Mutator_DoubleJump_Controller extends Rx_Controller;

function CheckJumpOrDuck() { 
	if ( Pawn == None ) { return; } 
	if ( bDoubleJump && (bUpdating || ((Rx_Pawn(Pawn) != None) && Rx_Pawn(Pawn).CanDoubleJump())) ) { Rx_Pawn(Pawn).DoDoubleJump( bUpdating ); bDoubleJump = false; }
    else if ( bPressedJump ) { Pawn.DoJump( bUpdating ); } 
	if ( Pawn.Physics != PHYS_Falling && Pawn.bCanCrouch ) { Pawn.ShouldCrouch(bDuck != 0); }
}
  


 

Rx_Mutator_DoubleJump_Pawn.uc (Download)

Spoiler


/******************************************************************************
*  Modified by Ukill, this can contain parts of code written by Jessica\Yosh  *
*    This mutator will add the DoubleJump function to the Renegade X game     *
*******************************************************************************
* Rx_Mutator_DoubleJump_Pawn                                                  *
******************************************************************************/

class Rx_Mutator_DoubleJump_Pawn extends Rx_Pawn;

var bool canDJ ;

function bool DoJump( bool bUpdating ) { canDJ=true; 
	if(JumpZ < default.JumpZ) JumpZ = default.JumpZ; CurrentHopStamina = 1;
	if(Abs(Velocity.Z) < DoubleJumpThreshold) LogInternal("In doublejump threshhold");
	if ( !bUpdating && CanDoubleJump() && (Abs(Velocity.Z) < DoubleJumpThreshold) && IsLocallyControlled() ) {
		if ( Rx_Controller(Controller) != None ) Rx_Controller(Controller).bDoubleJump = true; 
			LogInternal("222222222222222222222222DJump N Node Single:" $ Rx_Controller(Controller).bDoubleJump); 
			DoDoubleJump(bUpdating); MultiJumpRemaining -= 1; 
			return true; 
		}
	if (bJumpCapable && !bIsCrouched && !bWantsToCrouch && (Physics == PHYS_Walking || Physics == PHYS_Ladder || Physics == PHYS_Spider)) {
		if ( Physics == PHYS_Spider ) Velocity = JumpZ * Floor; 
		else if ( Physics == PHYS_Ladder ) Velocity.Z = 0;
		else if ( bIsWalking ) Velocity.Z = Default.JumpZ;
		else Velocity.Z = JumpZ; 
		if (Base != None && !Base.bWorldGeometry && Base.Velocity.Z > 0.f) { 
			if ( (WorldInfo.WorldGravityZ != WorldInfo.DefaultGravityZ) && (GetGravityZ() == WorldInfo.WorldGravityZ) ) { Velocity.Z += Base.Velocity.Z * sqrt(GetGravityZ()/WorldInfo.DefaultGravityZ); }
			else { Velocity.Z += Base.Velocity.Z; } }
		SetPhysics(PHYS_Falling); bReadyToDoubleJump = true; canDJ = CanDoubleJump(); 
		LogInternal("SingleJump _ VarbUpdating:" $ bUpdating); bDodging = false;
		canDJ = (!bUpdating && CanDoubleJump() && (Abs(Velocity.Z) < DoubleJumpThreshold) && IsLocallyControlled() ); 
		LogInternal("CanDJ0000000000NormalJump:" $ canDJ) ;
		if ( !bUpdating ) PlayJumpingSound(); return true; 
	} return false;
}

simulated function DoDoubleJump( bool bUpdating ) { 
	if ( !bIsCrouched && !bWantsToCrouch ) { if ( !IsLocallyControlled() || AIController(Controller) != None ) { MultiJumpRemaining -= 1; } 
		Velocity.Z = JumpZ + MultiJumpBoost; LogInternal("01010101110101DoneDid A Double Jump"); RX_InventoryManager(InvManager).OwnerEvent('MultiJump'); SetPhysics(PHYS_Falling); BaseEyeHeight = DoubleJumpEyeHeight; 
		if (!bUpdating) { SoundGroupClass.Static.PlayDoubleJumpSound(self); } 
	} 
}

function bool CanDoubleJump() { return ( (MultiJumpRemaining > 0) && (Physics == PHYS_Falling) && (bReadyToDoubleJump || (UTBot(Controller) != None)) ); }
function bool CanMultiJump() { return ( MaxMultiJump > 0 ); }

DefaultProperties
{
	MaxMultiJump=1				// default is 0
	MultiJumpRemaining=0		// default is 0
	JumpZ=500					// default is 320
	MaxJumpHeight=150			// something less than 49
}
  


 

 


 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...