mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-26 14:55:30 +03:00
Initial commit
This commit is contained in:
parent
783c8e8fb7
commit
f8d3bea87e
@ -68,6 +68,10 @@ ConVar player_throwforce( "player_throwforce", "1000" );
|
||||
ConVar physcannon_dmg_glass( "physcannon_dmg_glass", "15" );
|
||||
ConVar physcannon_right_turrets( "physcannon_right_turrets", "0" );
|
||||
|
||||
#ifdef MAPBASE
|
||||
ConVar sv_player_enable_propsprint("sv_player_enable_propsprint", "0", FCVAR_REPLICATED, "If enabled, allows the player to sprint while holding a physics object" );
|
||||
ConVar sv_player_enable_gravgun_sprint("sv_player_enable_gravgun_sprint", "0", FCVAR_REPLICATED, "Enables the player to sprint while holding a phys. object with the gravity gun" );
|
||||
#endif
|
||||
extern ConVar hl2_normspeed;
|
||||
extern ConVar hl2_walkspeed;
|
||||
|
||||
@ -1042,11 +1046,22 @@ void CPlayerPickupController::Init( CBasePlayer *pPlayer, CBaseEntity *pObject )
|
||||
}
|
||||
|
||||
CHL2_Player *pOwner = (CHL2_Player *)ToBasePlayer( pPlayer );
|
||||
#ifndef MAPBASE
|
||||
if ( pOwner )
|
||||
{
|
||||
pOwner->EnableSprint( false );
|
||||
}
|
||||
|
||||
#else
|
||||
if ( pOwner && sv_player_enable_propsprint.GetBool() == false )
|
||||
{
|
||||
pOwner->EnableSprint( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
pOwner->EnableSprint( true );
|
||||
}
|
||||
#endif
|
||||
// If the target is debris, convert it to non-debris
|
||||
if ( pObject->GetCollisionGroup() == COLLISION_GROUP_DEBRIS )
|
||||
{
|
||||
@ -1102,10 +1117,17 @@ void CPlayerPickupController::Shutdown( bool bThrown )
|
||||
if ( m_pPlayer )
|
||||
{
|
||||
CHL2_Player *pOwner = (CHL2_Player *)ToBasePlayer( m_pPlayer );
|
||||
#ifndef MAPBASE
|
||||
if ( pOwner )
|
||||
{
|
||||
pOwner->EnableSprint( true );
|
||||
}
|
||||
#else
|
||||
if ( pOwner && sv_player_enable_propsprint.GetBool() == false )
|
||||
{
|
||||
pOwner->EnableSprint( true );
|
||||
}
|
||||
#endif
|
||||
|
||||
m_pPlayer->SetUseEntity( NULL );
|
||||
if ( m_pPlayer->GetActiveWeapon() )
|
||||
@ -2497,6 +2519,7 @@ bool CWeaponPhysCannon::AttachObject( CBaseEntity *pObject, const Vector &vPosit
|
||||
// NVNT set the players constant force to simulate holding mass
|
||||
HapticSetConstantForce(pOwner,clamp(m_grabController.GetLoadWeight()*0.05,1,5)*Vector(0,-1,0));
|
||||
#endif
|
||||
#ifndef MAPBASE
|
||||
pOwner->EnableSprint( false );
|
||||
|
||||
float loadWeight = ( 1.0f - GetLoadPercentage() );
|
||||
@ -2504,6 +2527,22 @@ bool CWeaponPhysCannon::AttachObject( CBaseEntity *pObject, const Vector &vPosit
|
||||
|
||||
//Msg( "Load perc: %f -- Movement speed: %f/%f\n", loadWeight, maxSpeed, hl2_normspeed.GetFloat() );
|
||||
pOwner->SetMaxSpeed( maxSpeed );
|
||||
#else
|
||||
if ( sv_player_enable_gravgun_sprint.GetBool() == false )
|
||||
{
|
||||
pOwner->EnableSprint( false );
|
||||
|
||||
float loadWeight = ( 1.0f - GetLoadPercentage() );
|
||||
float maxSpeed = hl2_walkspeed.GetFloat() + ( ( hl2_normspeed.GetFloat() - hl2_walkspeed.GetFloat() ) * loadWeight );
|
||||
|
||||
//Msg( "Load perc: %f -- Movement speed: %f/%f\n", loadWeight, maxSpeed, hl2_normspeed.GetFloat() );
|
||||
pOwner->SetMaxSpeed( maxSpeed );
|
||||
}
|
||||
else
|
||||
{
|
||||
pOwner->EnableSprint( true );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Don't drop again for a slight delay, in case they were pulling objects near them
|
||||
@ -2950,9 +2989,17 @@ void CWeaponPhysCannon::DetachObject( bool playSound, bool wasLaunched )
|
||||
CHL2_Player *pOwner = (CHL2_Player *)ToBasePlayer( GetOwner() );
|
||||
if( pOwner != NULL )
|
||||
{
|
||||
#ifndef MAPBASE
|
||||
pOwner->EnableSprint( true );
|
||||
pOwner->SetMaxSpeed( hl2_normspeed.GetFloat() );
|
||||
|
||||
#else
|
||||
if (sv_player_enable_gravgun_sprint.GetBool() == false)
|
||||
{
|
||||
pOwner->EnableSprint( true );
|
||||
pOwner->SetMaxSpeed( hl2_normspeed.GetFloat() );
|
||||
}
|
||||
#endif
|
||||
if( wasLaunched )
|
||||
{
|
||||
pOwner->RumbleEffect( RUMBLE_357, 0, RUMBLE_FLAG_RESTART );
|
||||
|
Loading…
Reference in New Issue
Block a user