Navigation Menu

Skip to content

Commit

Permalink
Changed DM spawn protection to use an uber condition
Browse files Browse the repository at this point in the history
  • Loading branch information
NicknineTheEagle committed Jul 11, 2016
1 parent e5913b9 commit 4164a74
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 42 deletions.
8 changes: 5 additions & 3 deletions src/game/client/tf/c_tf_player.cpp
Expand Up @@ -959,7 +959,9 @@ class CProxyInvulnLevel : public CResultProxy

if ( pPlayer )
{
if ( pPlayer->m_Shared.IsInvulnerable() && !pPlayer->m_Shared.InCond( TF_COND_INVULNERABLE_WEARINGOFF ) )
if ( pPlayer->m_Shared.IsInvulnerable() &&
!pPlayer->m_Shared.InCond( TF_COND_INVULNERABLE_WEARINGOFF ) &&
( !pPlayer->m_Shared.InCond( TF_COND_INVULNERABLE_SPAWN_PROTECT ) || pPlayer->m_Shared.GetConditionDuration( TF_COND_INVULNERABLE_SPAWN_PROTECT ) > 1.0f ) )
{
m_pResult->SetFloatValue( 1.0 );
}
Expand Down Expand Up @@ -1188,7 +1190,7 @@ class CProxyModelGlowColor : public CResultProxy
vecColor = critColor;
}
else if ( !pPlayer->m_Shared.InCond( TF_COND_DISGUISED ) ||
pPlayer->InSameTeam( C_TFPlayer::GetLocalTFPlayer() ) ||
!pPlayer->IsEnemyPlayer() ||
pPlayer->GetTeamNumber() == pPlayer->m_Shared.GetDisguiseTeam() )
{
switch ( pPlayer->GetTeamNumber() )
Expand Down Expand Up @@ -2091,7 +2093,7 @@ void C_TFPlayer::InitInvulnerableMaterial( void )

int iVisibleTeam = GetTeamNumber();
// if this player is disguised and on the other team, use disguise team
if ( m_Shared.InCond( TF_COND_DISGUISED ) && !InSameTeam( pLocalPlayer ) )
if ( m_Shared.InCond( TF_COND_DISGUISED ) && IsEnemyPlayer() )
{
iVisibleTeam = m_Shared.GetDisguiseTeam();
}
Expand Down
19 changes: 6 additions & 13 deletions src/game/server/tf/tf_player.cpp
Expand Up @@ -114,6 +114,7 @@ ConVar tf2c_random_weapons( "tf2c_random_weapons", "0", FCVAR_NOTIFY, "Makes pla
ConVar tf2c_allow_special_classes( "tf2c_allow_special_classes", "0", FCVAR_NOTIFY, "Enables gamemode specific classes (Civilian, Mercenary, ...) in normal gameplay." );
ConVar tf2c_force_stock_weapons( "tf2c_force_stock_weapons", "0", FCVAR_NOTIFY, "Forces players to use the stock loadout." );
ConVar tf2c_legacy_weapons( "tf2c_legacy_weapons", "0", FCVAR_DEVELOPMENTONLY, "Disables all new weapons as well as Econ Item System." );
ConVar tf2c_dm_spawnprotecttime( "tf2c_dm_spawnprotecttime", "5", FCVAR_REPLICATED | FCVAR_NOTIFY, "Time (in seconds) that the DM spawn protection lasts" );

// -------------------------------------------------------------------------------- //
// Player animation event. Sent to the client when a player fires, jumps, reloads, etc..
Expand Down Expand Up @@ -501,19 +502,6 @@ void CTFPlayer::TFPlayerThink()
m_bJumpEffect = true;
}

if ( TFGameRules()->IsDeathmatch() && IsAlive() && m_flSpawnProtectTime )
{
if ( ( gpGlobals->curtime > m_flSpawnProtectTime ) || ( m_nButtons & IN_ATTACK ) )
{
RemoveFlag( FL_GODMODE );
m_nRenderFX = kRenderFxNone;
RemoveEffects( EF_ITEM_BLINK );
GetViewModel()->m_nRenderFX = kRenderFxNone;
GetViewModel()->RemoveEffects( EF_ITEM_BLINK );
m_flSpawnProtectTime = 0;
}
}

SetContextThink( &CTFPlayer::TFPlayerThink, gpGlobals->curtime, "TFPlayerThink" );
}

Expand Down Expand Up @@ -974,6 +962,11 @@ void CTFPlayer::Spawn()
m_Shared.AddCond( TF_COND_HEALTH_BUFF );
}

if ( TFGameRules()->IsDeathmatch() )
{
m_Shared.AddCond( TF_COND_INVULNERABLE_SPAWN_PROTECT, tf2c_dm_spawnprotecttime.GetFloat() );
}

if ( !m_bSeenRoundInfo )
{
TFGameRules()->ShowRoundInfoPanel( this );
Expand Down
2 changes: 0 additions & 2 deletions src/game/server/tf/tf_player.h
Expand Up @@ -455,8 +455,6 @@ class CTFPlayer : public CBaseMultiplayerPlayer, public IHasAttributes
CEconEntity *GetEntityForLoadoutSlot( int iSlot );
CEconWearable *GetWearableForLoadoutSlot( int iSlot );

float m_flSpawnProtectTime;

bool CalculateAmmoPackPositionAndAngles( CTFWeaponBase *pWeapon, Vector &vecOrigin, QAngle &vecAngles );

private:
Expand Down
21 changes: 0 additions & 21 deletions src/game/shared/tf/tf_gamerules.cpp
Expand Up @@ -93,8 +93,6 @@ ConVar tf_birthday( "tf_birthday", "0", FCVAR_NOTIFY | FCVAR_REPLICATED );
ConVar tf2c_falldamage_disablespread( "tf2c_falldamage_disablespread", "0", FCVAR_REPLICATED | FCVAR_NOTIFY, "Toggles random 20% fall damage spread." );
ConVar tf2c_allow_thirdperson( "tf2c_allow_thirdperson", "0", FCVAR_NOTIFY | FCVAR_REPLICATED, "Allow players to switch to third person mode." );

ConVar tf2c_dm_spawnprotecttime( "tf2c_dm_spawnprotecttime", "5", FCVAR_REPLICATED | FCVAR_NOTIFY, "Time (in seconds) that the DM spawn protection lasts" );

#ifdef GAME_DLL
// TF overrides the default value of this convar
ConVar mp_waitingforplayers_time( "mp_waitingforplayers_time", (IsX360()?"15":"30"), FCVAR_GAMEDLL | FCVAR_DEVELOPMENTONLY, "WaitingForPlayers time length in seconds" );
Expand Down Expand Up @@ -5304,25 +5302,6 @@ const char *CTFGameRules::GetGameDescription(void)
}
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGameRules::PlayerSpawn(CBasePlayer *pPlayer)
{
BaseClass::PlayerSpawn(pPlayer);
if ( IsDeathmatch() )
{
CTFPlayer *pTFPlayer = ToTFPlayer(pPlayer);
float flSpawnProtectTime = gpGlobals->curtime + tf2c_dm_spawnprotecttime.GetFloat();
pTFPlayer->AddFlag( FL_GODMODE );
pTFPlayer->m_nRenderFX = kRenderFxExplode;
pTFPlayer->AddEffects( EF_ITEM_BLINK );
pTFPlayer->GetViewModel()->m_nRenderFX = kRenderFxExplode;
pTFPlayer->GetViewModel()->AddEffects( EF_ITEM_BLINK );
pTFPlayer->m_flSpawnProtectTime = flSpawnProtectTime;
}
}

#endif

float CTFGameRules::GetRespawnWaveMaxLength( int iTeam, bool bScaleWithNumPlayers /* = true */ )
Expand Down
2 changes: 0 additions & 2 deletions src/game/shared/tf/tf_gamerules.h
Expand Up @@ -391,8 +391,6 @@ class CTFGameRules : public CTeamplayRoundBasedRules
void SendHudNotification( IRecipientFilter &filter, HudNotification_t iType );
void SendHudNotification( IRecipientFilter &filter, const char *pszText, const char *pszIcon, int iTeam = TEAM_UNASSIGNED );

virtual void PlayerSpawn( CBasePlayer *pPlayer );

private:

int DefaultFOV( void ) { return 75; }
Expand Down
3 changes: 2 additions & 1 deletion src/game/shared/tf/tf_player_shared.cpp
Expand Up @@ -436,7 +436,8 @@ bool CTFPlayerShared::IsInvulnerable( void )
if ( InCond( TF_COND_INVULNERABLE ) ||
InCond( TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGE ) ||
InCond( TF_COND_INVULNERABLE_USER_BUFF ) ||
InCond( TF_COND_INVULNERABLE_CARD_EFFECT ) )
InCond( TF_COND_INVULNERABLE_CARD_EFFECT ) ||
InCond( TF_COND_INVULNERABLE_SPAWN_PROTECT ) )
return true;

return false;
Expand Down
1 change: 1 addition & 0 deletions src/game/shared/tf/tf_shareddefs.h
Expand Up @@ -566,6 +566,7 @@ enum
// Add TF2C conds here
TF_COND_SMOKE_BOMB,
TF_COND_SLOWED,
TF_COND_INVULNERABLE_SPAWN_PROTECT,

// Powerup conditions
TF_COND_POWERUP_CRITDAMAGE,
Expand Down

0 comments on commit 4164a74

Please sign in to comment.