diff --git a/src/game/server/tf/tf_player.cpp b/src/game/server/tf/tf_player.cpp index fa944e35611..c6cafbe62df 100644 --- a/src/game/server/tf/tf_player.cpp +++ b/src/game/server/tf/tf_player.cpp @@ -14085,31 +14085,31 @@ int CTFPlayer::GiveAmmo( int iCount, int iAmmoIndex, bool bSuppressSound, EAmmoS // ammo. if ( iAmmoIndex != TF_AMMO_METAL ) { - //int iAmmoBecomesHealth = 0; - //CALL_ATTRIB_HOOK_INT( iAmmoBecomesHealth, ammo_becomes_health ); - //if ( iAmmoBecomesHealth == 1 ) - //{ - // // Ammo from ground pickups is converted to health. - // if ( eAmmoSource == kAmmoSource_Pickup ) - // { - // int iTakenHealth = TakeHealth( iCount, DMG_GENERIC ); - // if ( iTakenHealth > 0 ) - // { - // if ( !bSuppressSound ) - // { - // EmitSound( "BaseCombatCharacter.AmmoPickup" ); - // } - // m_Shared.HealthKitPickupEffects( iCount ); - // } - // return iTakenHealth; - // } - - // // Ammo from the cart or engineer dispensers is flatly ignored. - // if ( eAmmoSource == kAmmoSource_DispenserOrCart ) - // return 0; - - // Assert( eAmmoSource == kAmmoSource_Resupply ); - //} + int iAmmoBecomesHealth = 0; + CALL_ATTRIB_HOOK_INT( iAmmoBecomesHealth, ammo_becomes_health ); + if ( iAmmoBecomesHealth == 1 ) + { + // Ammo from ground pickups is converted to health. + if ( eAmmoSource == kAmmoSource_Pickup ) + { + int iTakenHealth = TakeHealth( iCount, DMG_GENERIC ); + if ( iTakenHealth > 0 ) + { + if ( !bSuppressSound ) + { + EmitSound( "BaseCombatCharacter.AmmoPickup" ); + } + m_Shared.HealthKitPickupEffects( iCount ); + } + return iTakenHealth; + } + + // Ammo from the cart or engineer dispensers is flatly ignored. + if ( eAmmoSource == kAmmoSource_DispenserOrCart ) + return 0; + + Assert( eAmmoSource == kAmmoSource_Resupply ); + } // Items that rely on timers to refill ammo use these attributes // Prevents "touch supply closet and spam the thing" scenario. diff --git a/src/game/shared/tf/tf_gamerules.cpp b/src/game/shared/tf/tf_gamerules.cpp index c3ec6c0d998..f3f51d7a865 100644 --- a/src/game/shared/tf/tf_gamerules.cpp +++ b/src/game/shared/tf/tf_gamerules.cpp @@ -6278,21 +6278,21 @@ bool CTFGameRules::ApplyOnDamageModifyRules( CTakeDamageInfo &info, CBaseEntity } //// Some weapons minicrit *any* target in the air, regardless of how they got there. - //int iMiniCritAirborneDeploy = 0; - //CALL_ATTRIB_HOOK_INT_ON_OTHER( pWeapon, iMiniCritAirborneDeploy, mini_crit_airborne_deploy ); - //if ( iMiniCritAirborneDeploy > 0 && - // pWeapon && - // ( gpGlobals->curtime - pWeapon->GetLastDeployTime() ) < iMiniCritAirborneDeploy && - // // - - // pVictim && !( pVictim->GetFlags() & FL_ONGROUND ) && - // ( pVictim->GetWaterLevel() == WL_NotInWater ) ) - //{ - // bAllSeeCrit = true; - // info.SetCritType( CTakeDamageInfo::CRIT_MINI ); - // eBonusEffect = kBonusEffect_MiniCrit; - // break; - //} + int iMiniCritAirborneDeploy = 0; + CALL_ATTRIB_HOOK_INT_ON_OTHER( pWeapon, iMiniCritAirborneDeploy, mini_crit_airborne_deploy ); + if ( iMiniCritAirborneDeploy > 0 && + pWeapon && + ( gpGlobals->curtime - pWeapon->GetLastDeployTime() ) < iMiniCritAirborneDeploy && + + + pVictim && !( pVictim->GetFlags() & FL_ONGROUND ) && + ( pVictim->GetWaterLevel() == WL_NotInWater ) ) + { + bAllSeeCrit = true; + info.SetCritType( CTakeDamageInfo::CRIT_MINI ); + eBonusEffect = kBonusEffect_MiniCrit; + break; + } } } diff --git a/src/game/shared/tf/tf_weaponbase.cpp b/src/game/shared/tf/tf_weaponbase.cpp index 5d740661dc8..9270e500c91 100644 --- a/src/game/shared/tf/tf_weaponbase.cpp +++ b/src/game/shared/tf/tf_weaponbase.cpp @@ -656,7 +656,7 @@ const char *CTFWeaponBase::GetViewModel( int iViewModel ) const int iHandModelIndex = 0; if ( pPlayer ) { - //CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pPlayer, iHandModelIndex, override_hand_model_index ); // this is a cleaner way of doing it, but... + CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pPlayer, iHandModelIndex, override_hand_model_index ); // this is a cleaner way of doing it, but... CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pPlayer, iHandModelIndex, wrench_builds_minisentry ); // ...the gunslinger is the only thing that uses this attribute for now } @@ -2257,19 +2257,19 @@ void CTFWeaponBase::SetReloadTimer( float flReloadTime ) CALL_ATTRIB_HOOK_FLOAT( flReloadTime, fast_reload ); CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pPlayer, flReloadTime, hwn_mult_reload_time ); - //int iPanicAttack = 0; - //CALL_ATTRIB_HOOK_INT( iPanicAttack, panic_attack ); - //if ( iPanicAttack ) - //{ - // if ( pPlayer->GetHealth() < pPlayer->GetMaxHealth() * 0.33f ) - // { - // flReloadTime *= 0.3f; - // } - // else if ( pPlayer->GetHealth() < pPlayer->GetMaxHealth() * 0.66f ) - // { - // flReloadTime *= 0.6f; - // } - //} + int iPanicAttack = 0; + CALL_ATTRIB_HOOK_INT( iPanicAttack, panic_attack ); + if ( iPanicAttack ) + { + if ( pPlayer->GetHealth() < pPlayer->GetMaxHealth() * 0.33f ) + { + flReloadTime *= 0.3f; + } + else if ( pPlayer->GetHealth() < pPlayer->GetMaxHealth() * 0.66f ) + { + flReloadTime *= 0.6f; + } + } // Haste Powerup Rune adds multiplier to reload time. if ( pPlayer->m_Shared.GetCarryingRuneType() == RUNE_HASTE ) @@ -5316,15 +5316,14 @@ void CTFWeaponBase::ApplyOnHitAttributes( CBaseEntity *pVictimBaseEntity, CTFPla } // Damage bonus on hit - // Disabled because we have no attributes that use it - /* + float flAddDamageDoneBonusOnHit = 0; CALL_ATTRIB_HOOK_FLOAT( flAddDamageDoneBonusOnHit, addperc_ondmgdone_tmpbuff ); if ( flAddDamageDoneBonusOnHit ) { pAttacker->m_Shared.AddTmpDamageBonus( flAddDamageDoneBonusOnHit, 10.0 ); } - */ + if ( pVictim ) { diff --git a/src/game/shared/tf/tf_weaponbase_gun.cpp b/src/game/shared/tf/tf_weaponbase_gun.cpp index 58d0dc27075..92aba201d51 100644 --- a/src/game/shared/tf/tf_weaponbase_gun.cpp +++ b/src/game/shared/tf/tf_weaponbase_gun.cpp @@ -706,12 +706,12 @@ CBaseEntity *CTFWeaponBaseGun::FirePipeBomb( CTFPlayer *pPlayer, int iPipeBombTy pProjectile->SetCritical( IsCurrentAttackACrit() ); pProjectile->SetLauncher( this ); - //float flFizzle = 0; - //CALL_ATTRIB_HOOK_FLOAT( flFizzle, stickybomb_fizzle_time ); - //if ( flFizzle ) - //{ - // pProjectile->SetDetonateTimerLength( flFizzle ); - //} + float flFizzle = 0; + CALL_ATTRIB_HOOK_FLOAT( flFizzle, stickybomb_fizzle_time ); + if ( flFizzle ) + { + pProjectile->SetDetonateTimerLength( flFizzle ); + } CAttribute_String attrCustomModelName; GetCustomProjectileModel( &attrCustomModelName ); if ( attrCustomModelName.has_value() ) @@ -1054,8 +1054,7 @@ void CTFWeaponBaseGun::ZoomIn( void ) // TODO: The weapon fov should be gotten from the script file. float fBaseZoom = TF_WEAPON_ZOOM_FOV; - // Disabled this for now, because we have no attributes using it - //CALL_ATTRIB_HOOK_FLOAT( fBaseZoom, mult_zoom_fov ); + CALL_ATTRIB_HOOK_FLOAT( fBaseZoom, mult_zoom_fov ); pPlayer->SetFOV( pPlayer, fBaseZoom, 0.1f ); pPlayer->m_Shared.AddCond( TF_COND_ZOOMED );