diff --git a/src/game/shared/tf/tf_gamerules.cpp b/src/game/shared/tf/tf_gamerules.cpp index 01640475c4a..974c53c47fa 100644 --- a/src/game/shared/tf/tf_gamerules.cpp +++ b/src/game/shared/tf/tf_gamerules.cpp @@ -918,6 +918,7 @@ ConVar tf_mvm_respec_credit_goal( "tf_mvm_respec_credit_goal", "2000", FCVAR_CHE ConVar tf_mvm_buybacks_method( "tf_mvm_buybacks_method", "0", FCVAR_REPLICATED | FCVAR_HIDDEN, "When set to 0, use the traditional, currency-based system. When set to 1, use finite, charge-based system.", true, 0.0, true, 1.0 ); ConVar tf_mvm_buybacks_per_wave( "tf_mvm_buybacks_per_wave", "3", FCVAR_REPLICATED | FCVAR_HIDDEN, "The fixed number of buybacks players can use per-wave." ); +ConVar tf_splash_fix( "tf_splash_fix", "1", FCVAR_PROTECTED, "Fixes a bug where splash damage could go through walls. Rockets may still visually disapear and may not deal any damage in rare cases." ); #ifdef GAME_DLL enum { kMVM_CurrencyPackMinSize = 1, }; @@ -5780,8 +5781,9 @@ int CTFRadiusDamageInfo::ApplyToEntity( CBaseEntity *pEntity ) UTIL_TraceLine( vecSrc, vecSpot, MASK_RADIUS_DAMAGE, &filterSelf, &tr ); } - // If we don't trace the whole way to the target, and we didn't hit the target entity, we're blocked - if ( tr.fraction != 1.f && tr.m_pEnt != pEntity ) + // If we don't trace the whole way to the target, and we didn't hit the target entity, we're blocked. + // Startsolid check since if a trace starts within a wall, often it will give fraction as 1.0 + if ( ( tr.fraction != 1.f && tr.m_pEnt != pEntity ) || ( tf_splash_fix.GetBool( ) && tr.startsolid && tr.m_pEnt != pEntity ) ) { // Don't let projectiles block damage return 0; diff --git a/src/game/shared/tf/tf_gamerules.h b/src/game/shared/tf/tf_gamerules.h index 56bd58bab57..60d3aa9993c 100644 --- a/src/game/shared/tf/tf_gamerules.h +++ b/src/game/shared/tf/tf_gamerules.h @@ -99,6 +99,8 @@ class CMannVsMachineUpgrades; extern ConVar tf_mvm_defenders_team_size; extern ConVar tf_mvm_max_invaders; +extern ConVar tf_splash_fix; + const int kLadder_TeamSize_6v6 = 6; const int kLadder_TeamSize_9v9 = 9; const int kLadder_TeamSize_12v12 = 12; diff --git a/src/game/shared/tf/tf_weaponbase_rocket.cpp b/src/game/shared/tf/tf_weaponbase_rocket.cpp index 59ca309da85..7a88c79b90b 100644 --- a/src/game/shared/tf/tf_weaponbase_rocket.cpp +++ b/src/game/shared/tf/tf_weaponbase_rocket.cpp @@ -70,6 +70,8 @@ END_DATADESC() ConVar tf_rocket_show_radius( "tf_rocket_show_radius", "0", FCVAR_REPLICATED | FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY, "Render rocket radius." ); #endif +ConVar tf_splash_fix_extreme( "tf_splash_fix_extreme", "0", FCVAR_PROTECTED, "Don't use unless necessary. Plane normal will not be added to origin on explosion which might cause problems for small bumps or displacements." ); + //============================================================================= // // Shared (client/server) functions. @@ -433,7 +435,13 @@ void CTFBaseRocket::Explode( trace_t *pTrace, CBaseEntity *pOther ) // Pull out a bit. if ( pTrace->fraction != 1.0 ) { - SetAbsOrigin( pTrace->endpos + ( pTrace->plane.normal * 1.0f ) ); + if ( !tf_splash_fix_extreme.GetBool( ) ) + { + // This line causes a bug where when the endpos + normal is within a wall, trace fraction will often be 1.0 or close enough to 1.0 to splash through things. + // Checking if the start is in a solid should fix it. This will still allow players to shoot around corners but without it, displacements and tiny bumps may block explosions. + // I don't know why this is done so I have added a ConVar so you can change it as a server-owner. + SetAbsOrigin( pTrace->endpos + ( pTrace->plane.normal * 1.0f ) ); + } } // Play explosion sound and effect. diff --git a/src/game/shared/tf/tf_weaponbase_rocket.h b/src/game/shared/tf/tf_weaponbase_rocket.h index 9fcf4ef1962..8de31ac7ccf 100644 --- a/src/game/shared/tf/tf_weaponbase_rocket.h +++ b/src/game/shared/tf/tf_weaponbase_rocket.h @@ -12,6 +12,7 @@ #include "cbase.h" #include "tf_shareddefs.h" #include "baseprojectile.h" +#include "convar.h" // Server specific. #ifdef GAME_DLL @@ -28,6 +29,8 @@ #define TF_FLARE_RADIUS_FOR_FJS (100.0f) #define TF_ROCKET_DESTROYABLE_TIMER (0.25) +extern ConVar tf_fix_splash; + //============================================================================= //