Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make spectate also reduce slowmo by the usual 2 seconds #136

Merged
merged 3 commits into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions mp/src/game/server/sdk/bots/sdk_bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,20 @@ CON_COMMAND_F( bot_giveslowmo, "Give all bots one second of slow motion", FCVAR_
pPlayer->GiveSlowMo(1);
}
}

CON_COMMAND_F(giveslowmo, "Give all players one second of slow motion", FCVAR_CHEAT)
{
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
CSDKPlayer* pPlayer = ToSDKPlayer(UTIL_PlayerByIndex(i));

if (!pPlayer)
continue;

if (!pPlayer->IsAlive())
continue;

if (!pPlayer->IsBot())
pPlayer->GiveSlowMo(1);
}
}
18 changes: 9 additions & 9 deletions mp/src/game/server/sdk/sdk_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,10 @@ void CSDKPlayer::Event_Killed( const CTakeDamageInfo &info )
// because we still want to transmit to the clients in our PVS.
CreateRagdollEntity();

// Turn off slow motion.
if (m_flSlowMoTime)
DeactivateSlowMo();

State_Transition( STATE_DEATH_ANIM ); // Transition into the dying state.

//Tony; after transition, remove remaining items
Expand Down Expand Up @@ -1902,15 +1906,6 @@ void CSDKPlayer::Event_Killed( const CTakeDamageInfo &info )

SetStylePoints(m_flStylePoints - flLostPoints);

// Turn off slow motion.
if (m_flSlowMoTime)
DeactivateSlowMo();

m_flSlowMoSeconds -= 2;

if (m_flSlowMoSeconds < 0)
m_flSlowMoSeconds = 0;

m_flSlowMoTime = 0;
m_iSlowMoType = SLOWMO_NONE;

Expand Down Expand Up @@ -3754,6 +3749,11 @@ void CSDKPlayer::State_Enter_ACTIVE()
void CSDKPlayer::State_Leave_ACTIVE()
{
DropBriefcase();
m_flSlowMoSeconds -= 2;

if (m_flSlowMoSeconds < 0)
m_flSlowMoSeconds = 0;

}

void CSDKPlayer::State_PreThink_ACTIVE()
Expand Down