Implemented CVar mp_scoreboard_showdefkit Closed #472

This commit is contained in:
s1lent 2020-01-15 22:10:32 +07:00
parent dd59006db0
commit 6ff75da41c
5 changed files with 57 additions and 13 deletions

View File

@ -76,6 +76,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_unduck_method | 0 | 0 | 1 | Don't unduck if ducking isn't finished yet.<br/>`0` disabled<br/>`1` enabled<br/>`NOTE`: This also prevents double duck. | | mp_unduck_method | 0 | 0 | 1 | Don't unduck if ducking isn't finished yet.<br/>`0` disabled<br/>`1` enabled<br/>`NOTE`: This also prevents double duck. |
| mp_scoreboard_showhealth | 3 | 0 | 5 | Show `HP` field into a scoreboard.<br/>`0` don't send any update for `HP` field to any clients<br/>`1` show only Terrorist `HP` field to all clients<br/>`2` show only CT `HP` field to all clients<br/>`3` show `HP` field to teammates<br/>`4` show `HP` field to all clients<br/>`5` show `HP` field to teammates and spectators | | mp_scoreboard_showhealth | 3 | 0 | 5 | Show `HP` field into a scoreboard.<br/>`0` don't send any update for `HP` field to any clients<br/>`1` show only Terrorist `HP` field to all clients<br/>`2` show only CT `HP` field to all clients<br/>`3` show `HP` field to teammates<br/>`4` show `HP` field to all clients<br/>`5` show `HP` field to teammates and spectators |
| mp_scoreboard_showmoney | 3 | 0 | 5 | Show `Money` field into a scoreboard.<br/>`0` don't send any update for `Money` field to any clients<br/>`1` show only Terrorist `Money` field to all clients<br/>`2` show only CT `Money` field to all clients<br/>`3` show `Money` field to teammates<br/>`4` show `Money` field to all clients<br/>`5` show `Money` field to teammates and spectators | | mp_scoreboard_showmoney | 3 | 0 | 5 | Show `Money` field into a scoreboard.<br/>`0` don't send any update for `Money` field to any clients<br/>`1` show only Terrorist `Money` field to all clients<br/>`2` show only CT `Money` field to all clients<br/>`3` show `Money` field to teammates<br/>`4` show `Money` field to all clients<br/>`5` show `Money` field to teammates and spectators |
| mp_scoreboard_showdefkit | 1 | 0 | 1 | Show `D. Kit` field into a scoreboard for teammates.<br/>`0` disabled<br/>`1` enabled<br/>`NOTE`: If you don't want to show `D. Kit` field for dead enemies then disable this CVar or configure mp_forcecamera |
| ff_damage_reduction_bullets | 0.35 | 0.0 | 1.0 | How much to reduce damage done to teammates when shot.<br/> Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) | | ff_damage_reduction_bullets | 0.35 | 0.0 | 1.0 | How much to reduce damage done to teammates when shot.<br/> Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) |
| ff_damage_reduction_grenade | 0.25 | 0.0 | 1.0 | How much to reduce damage done to teammates by a thrown grenade.<br/> Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) | | ff_damage_reduction_grenade | 0.25 | 0.0 | 1.0 | How much to reduce damage done to teammates by a thrown grenade.<br/> Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) |
| ff_damage_reduction_grenade_self | 1.0 | 0.0 | 1.0 | How much to damage a player does to himself with his own grenade.<br/> Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) | | ff_damage_reduction_grenade_self | 1.0 | 0.0 | 1.0 | How much to damage a player does to himself with his own grenade.<br/> Range is from `0` - `1` (with 1 being damage equal to what is done to an enemy) |

9
dist/game.cfg vendored
View File

@ -281,6 +281,15 @@ mp_scoreboard_showhealth 3
// Default value: "3" // Default value: "3"
mp_scoreboard_showmoney 3 mp_scoreboard_showmoney 3
// Show 'D. Kit' field into a scoreboard for teammates
// NOTE: If you don't want to show defuse kit field for dead enemies
// then disable this CVar or configure mp_forcecamera
// 0 - disabled
// 1 - enabled
//
// Default value: "1"
mp_scoreboard_showdefkit 1
// How much to reduce damage done to teammates when shot. // How much to reduce damage done to teammates when shot.
// Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy) // Range is from 0 - 1 (with 1 being damage equal to what is done to an enemy)
// //

View File

@ -98,6 +98,7 @@ cvar_t sk_scientist_heal3 = { "sk_scientist_heal3", "0", 0, 0.0f, nullptr };
cvar_t scoreboard_showmoney = { "mp_scoreboard_showmoney", "3", FCVAR_SERVER, 0.0f, nullptr }; cvar_t scoreboard_showmoney = { "mp_scoreboard_showmoney", "3", FCVAR_SERVER, 0.0f, nullptr };
cvar_t scoreboard_showhealth = { "mp_scoreboard_showhealth", "3", FCVAR_SERVER, 0.0f, nullptr }; cvar_t scoreboard_showhealth = { "mp_scoreboard_showhealth", "3", FCVAR_SERVER, 0.0f, nullptr };
cvar_t scoreboard_showdefkit = { "mp_scoreboard_showdefkit", "1", FCVAR_SERVER, 0.0f, nullptr };
#endif #endif
@ -253,6 +254,7 @@ void EXT_FUNC GameDLLInit()
#ifdef BUILD_LATEST #ifdef BUILD_LATEST
CVAR_REGISTER(&scoreboard_showhealth); CVAR_REGISTER(&scoreboard_showhealth);
CVAR_REGISTER(&scoreboard_showmoney); CVAR_REGISTER(&scoreboard_showmoney);
CVAR_REGISTER(&scoreboard_showdefkit);
#endif #endif
// Remove unused cvars // Remove unused cvars

View File

@ -177,5 +177,6 @@ extern cvar_t radio_maxinround;
extern cvar_t scoreboard_showmoney; extern cvar_t scoreboard_showmoney;
extern cvar_t scoreboard_showhealth; extern cvar_t scoreboard_showhealth;
extern cvar_t scoreboard_showdefkit;
void GameDLLInit(); void GameDLLInit();

View File

@ -5183,8 +5183,24 @@ void CBasePlayer::SetScoreAttrib(CBasePlayer *dest)
state |= SCORE_STATUS_VIP; state |= SCORE_STATUS_VIP;
#ifdef BUILD_LATEST #ifdef BUILD_LATEST
#ifdef REGAMEDLL_FIXES
if (scoreboard_showdefkit.value)
#endif
{
if (m_bHasDefuser) if (m_bHasDefuser)
state |= SCORE_STATUS_DEFKIT; state |= SCORE_STATUS_DEFKIT;
}
#endif
#ifdef REGAMEDLL_FIXES
// TODO: Remove these fixes when they are implemented on the client side
if (state & (SCORE_STATUS_BOMB | SCORE_STATUS_DEFKIT) && GetForceCamera(dest) != CAMERA_MODE_SPEC_ANYONE)
{
if (CSGameRules()->PlayerRelationship(this, dest) != GR_TEAMMATE)
state &= ~(SCORE_STATUS_BOMB | SCORE_STATUS_DEFKIT);
}
#endif #endif
if (gmsgScoreAttrib) if (gmsgScoreAttrib)
@ -7206,7 +7222,12 @@ void EXT_FUNC CBasePlayer::__API_HOOK(UpdateClientData)()
} }
#ifdef BUILD_LATEST #ifdef BUILD_LATEST
if ((m_iTeam == CT || m_iTeam == TERRORIST) &&
if (
#ifdef REGAMEDLL_FIXES
(scoreboard_showmoney.value != -1.0f || scoreboard_showhealth.value != -1.0f) &&
#endif
(m_iTeam == CT || m_iTeam == TERRORIST) &&
(m_iLastAccount != m_iAccount || m_iLastClientHealth != m_iClientHealth || m_tmNextAccountHealthUpdate < gpGlobals->time)) (m_iLastAccount != m_iAccount || m_iLastClientHealth != m_iClientHealth || m_tmNextAccountHealthUpdate < gpGlobals->time))
{ {
m_tmNextAccountHealthUpdate = gpGlobals->time + 5.0f; m_tmNextAccountHealthUpdate = gpGlobals->time + 5.0f;
@ -7225,16 +7246,26 @@ void EXT_FUNC CBasePlayer::__API_HOOK(UpdateClientData)()
continue; continue;
#endif // REGAMEDLL_FIXES #endif // REGAMEDLL_FIXES
#ifdef REGAMEDLL_FIXES
if (scoreboard_showmoney.value != -1.0f)
#endif
{
MESSAGE_BEGIN(MSG_ONE, gmsgHealthInfo, nullptr, pPlayer->edict()); MESSAGE_BEGIN(MSG_ONE, gmsgHealthInfo, nullptr, pPlayer->edict());
WRITE_BYTE(entindex()); WRITE_BYTE(entindex());
WRITE_LONG(ShouldToShowHealthInfo(pPlayer) ? m_iClientHealth : -1 /* means that 'HP' field will be hidden */); WRITE_LONG(ShouldToShowHealthInfo(pPlayer) ? m_iClientHealth : -1 /* means that 'HP' field will be hidden */);
MESSAGE_END(); MESSAGE_END();
}
#ifdef REGAMEDLL_FIXES
if (scoreboard_showhealth.value != -1.0f)
#endif
{
MESSAGE_BEGIN(MSG_ONE, gmsgAccount, nullptr, pPlayer->edict()); MESSAGE_BEGIN(MSG_ONE, gmsgAccount, nullptr, pPlayer->edict());
WRITE_BYTE(entindex()); WRITE_BYTE(entindex());
WRITE_LONG(ShouldToShowAccount(pPlayer) ? m_iAccount : -1 /* means that this 'Money' will be hidden */); WRITE_LONG(ShouldToShowAccount(pPlayer) ? m_iAccount : -1 /* means that this 'Money' will be hidden */);
MESSAGE_END(); MESSAGE_END();
} }
}
m_iLastAccount = m_iAccount; m_iLastAccount = m_iAccount;
m_iLastClientHealth = m_iClientHealth; m_iLastClientHealth = m_iClientHealth;