Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/game/server/triggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2844,6 +2844,7 @@ void CAI_ChangeHintGroup::InputActivate( inputdata_t &inputdata )
#define SF_CAMERA_PLAYER_SNAP_TO 16
#define SF_CAMERA_PLAYER_NOT_SOLID 32
#define SF_CAMERA_PLAYER_INTERRUPT 64
#define SF_CAMERA_PLAYER_NO_INVULN 128


//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -3095,10 +3096,12 @@ void CTriggerCamera::Enable( void )

m_nPlayerButtons = pPlayer->m_nButtons;


// Make the player invulnerable while under control of the camera. This will prevent situations where the player dies while under camera control but cannot restart their game due to disabled player inputs.
m_nOldTakeDamage = m_hPlayer->m_takedamage;
m_hPlayer->m_takedamage = DAMAGE_NO;
if ( !HasSpawnFlags( SF_CAMERA_PLAYER_NO_INVULN ) )
{
// Make the player invulnerable while under control of the camera. This will prevent situations where the player dies while under camera control but cannot restart their game due to disabled player inputs.
m_hPlayer->m_takedamage = DAMAGE_NO;
}

if ( HasSpawnFlags( SF_CAMERA_PLAYER_NOT_SOLID ) )
{
Expand Down Expand Up @@ -3239,8 +3242,11 @@ void CTriggerCamera::Disable( void )
{
((CBasePlayer*)m_hPlayer.Get())->GetActiveWeapon()->RemoveEffects( EF_NODRAW );
}
//return the player to previous takedamage state
m_hPlayer->m_takedamage = m_nOldTakeDamage;
// return the player to previous takedamage state if the camera has enabled invulnerability
if ( !HasSpawnFlags( SF_CAMERA_PLAYER_NO_INVULN ) )
{
m_hPlayer->m_takedamage = m_nOldTakeDamage;
}
}

m_state = USE_OFF;
Expand Down