mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-17 16:01:34 +00:00
Rework CTFPlayer::CanAirDash and air_dash_count attribute
This changes the requirements for a given class/player to air dash: Halloween Speed Boost condition allows air dash at all times for any class (unchanged) All classes may air dash if they have nonzero air dash count from attributes/conditions Scouts have base air dash count dictated by tf_scout_air_dash_count cvar, other classes have 0 set_scout_doublejump_disabled attribute nullifies the effect of tf_scout_air_dash_count cvar Soda Popper Hype condition adds 4 to air dash count air_dash_count attribute further adds to air dash count, increasing the number of dashes available air_dash_count_from_weapon further adds to air dash count, but only if the current active weapon is able to attack (via m_flFirstPrimaryAttack); note that this replaces the 0.7s hack for the Atomizer's full deploy behavior; this also requires a schema change for the Atomizer to use this new attribute class Differences from stock behavior: set_scout_doublejump_disabled previously disabled air dashes entirely unless the player had Halloween Speed Boost or Soda Popper Hype, now it only disables the base air dash count that Scouts get from the cvar Soda Popper and the air_dash_count attribute allow any class to gain air dashes, instead of only Scout Stock servers should function the same as before (where players cannot obtain Hype or air_dash_count if they are not a Scout, and cannot obtain set_scout_doublejump_disabled at all since it was removed from the Sandman)
This commit is contained in:
parent
0759e2e8e1
commit
f235122f25
1 changed files with 13 additions and 20 deletions
|
@ -12656,36 +12656,29 @@ bool CTFPlayer::CanAirDash( void ) const
|
|||
if ( m_Shared.InCond( TF_COND_HALLOWEEN_SPEED_BOOST ) )
|
||||
return true;
|
||||
|
||||
bool bScout = GetPlayerClass()->IsClass( TF_CLASS_SCOUT );
|
||||
if ( !bScout )
|
||||
return false;
|
||||
int iNoAirDash = 0;
|
||||
CALL_ATTRIB_HOOK_INT( iNoAirDash, set_scout_doublejump_disabled );
|
||||
|
||||
int iDashCount = ( !iNoAirDash && GetPlayerClass()->IsClass( TF_CLASS_SCOUT ) ) ? tf_scout_air_dash_count.GetInt() : 0;
|
||||
|
||||
if ( m_Shared.InCond( TF_COND_SODAPOPPER_HYPE ) )
|
||||
{
|
||||
if ( m_Shared.GetAirDash() < 5 )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
iDashCount += 4;
|
||||
}
|
||||
|
||||
CALL_ATTRIB_HOOK_INT( iDashCount, air_dash_count )
|
||||
|
||||
CTFWeaponBase *pTFActiveWeapon = GetActiveTFWeapon();
|
||||
int iDashCount = tf_scout_air_dash_count.GetInt();
|
||||
CALL_ATTRIB_HOOK_INT_ON_OTHER( pTFActiveWeapon, iDashCount, air_dash_count );
|
||||
|
||||
if ( m_Shared.GetAirDash() >= iDashCount )
|
||||
return false;
|
||||
|
||||
if ( pTFActiveWeapon )
|
||||
{
|
||||
// TODO(driller): Hack fix to restrict this to The Atomzier (currently the only item that uses this attribute) on what would be the third jump
|
||||
float flTimeSinceDeploy = gpGlobals->curtime - pTFActiveWeapon->GetLastDeployTime();
|
||||
if ( iDashCount >= 2 && m_Shared.GetAirDash() == 1 && flTimeSinceDeploy < 0.7f )
|
||||
return false;
|
||||
// (for Atomizer): enforce that the item providing this attribute must be fully deployed to provide the bonus jumps
|
||||
if ( gpGlobals->curtime >= m_Shared.m_flFirstPrimaryAttack )
|
||||
{
|
||||
CALL_ATTRIB_HOOK_INT_ON_OTHER( pTFActiveWeapon, iDashCount, air_dash_count_from_weapon );
|
||||
}
|
||||
}
|
||||
|
||||
int iNoAirDash = 0;
|
||||
CALL_ATTRIB_HOOK_INT( iNoAirDash, set_scout_doublejump_disabled );
|
||||
if ( 1 == iNoAirDash )
|
||||
if ( m_Shared.GetAirDash() >= iDashCount )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue