Source-1-Games
Source-1-Games copied to clipboard
[TF2] Brass ejection can't be disabled
In previous source games, weapon brass ejection could be disabled by using the cl_ejectbrass command, as seen in c_te_legacytempents.ccp:
void CTempEnts::EjectBrass( const Vector &pos1, const QAngle &angles, const QAngle &gunAngles, int type )
{
if ( cl_ejectbrass.GetBool() == false )
return;
...
}
This can't be done in tf2, as the function in charge of brass ejection doesn't check for it, making cl_ejectbrass completely useless. This can be fixed by opening tf_weaponbase.cpp , searching for the function called CTFWeaponBase::OnFireEvent and making the ejectbrass section check for cl_ejectbrass:
extern ConVar cl_ejectbrass;
bool CTFWeaponBase::OnFireEvent( C_BaseViewModel *pViewModel, const Vector& origin, const QAngle& angles, int event, const char *options )
{
if ( event == 6002 && ShouldEjectBrass() )
{
if ( cl_ejectbrass.GetBool() == false )
return;
if ( UsingViewModel() && !g_pClientMode->ShouldDrawViewModel() )
{
// Prevent effects when the ViewModel is hidden with r_drawviewmodel=0
return true;
}
...
}
Half-Life 2: https://github.com/ValveSoftware/Source-1-Games/assets/103285866/c6ea0270-24c1-47b3-9ef9-8a907644a07b
Team Fortress 2: https://github.com/ValveSoftware/Source-1-Games/assets/103285866/3bdb266f-bfb5-46e5-9a36-59d25eb6dc06