Fix hand viewmodel issues on death/respawn

This commit is contained in:
Blixibon 2022-10-26 23:01:50 -05:00
parent 5cc53c10ee
commit a7c90b042d

View File

@ -645,8 +645,14 @@ void CBasePlayer::CreateHandModel(int index, int iOtherVm)
{
Assert(index >= 0 && index < MAX_VIEWMODELS && iOtherVm >= 0 && iOtherVm < MAX_VIEWMODELS );
if (GetViewModel(index))
if (GetViewModel( index ))
{
// This can happen if the player respawns
// Don't draw unless we're already using a hands weapon
if ( !GetActiveWeapon() || !GetActiveWeapon()->UsesHands() )
GetViewModel( index )->AddEffects( EF_NODRAW );
return;
}
CBaseViewModel *vm = (CBaseViewModel *)CreateEntityByName("hand_viewmodel");
if (vm)
@ -1719,6 +1725,15 @@ void CBasePlayer::RemoveAllItems( bool removeSuit )
RemoveAllWeapons();
RemoveAllAmmo();
#ifdef MAPBASE
// Hide hand viewmodel
CBaseViewModel *vm = GetViewModel( 1 );
if ( vm )
{
vm->AddEffects( EF_NODRAW );
}
#endif
if ( removeSuit )
{
RemoveSuit();