Skip to content

Commit

Permalink
Merge pull request #995 from splewis/reset_team_config_on_end
Browse files Browse the repository at this point in the history
Reset team config on match end
  • Loading branch information
nickdnk committed Mar 10, 2023
2 parents b42e8e9 + 6c01184 commit d6a65d9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
9 changes: 5 additions & 4 deletions documentation/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ disable.<br>**`Default: ""`**

####`get5_reset_cvars_on_end`
: Whether the `cvars` of a [match configuration](../match_schema#schema) as well as
the [Get5-determined hostname](#get5_hostname_format) are reset to their original values when a series ends. You may
want to disable this if you only run Get5 on your servers and use `cvars` to
configure [demos](../gotv), [backups](../backup) or [remote URL logging](../events_and_forwards#http) on a per-match
basis, as reverting some of those parameters can be problematic.<br>**`Default: 1`**
the [Get5-determined hostname](#get5_hostname_format) are reset to their original values when a series ends. This also
causes team-specific configuration options (name, flag, logo etc.) to be set to empty on match end. You may want to
disable this if you only run Get5 on your servers and use `cvars` to configure [demos](../gotv), [backups](../backup)
or [remote URL logging](../events_and_forwards#http) on a per-match basis, as reverting some of those parameters can be
problematic.<br>**`Default: 1`**

####`get5_debug`
: Enable or disable verbose debug output from Get5. Intended for development and debugging purposes
Expand Down
1 change: 1 addition & 0 deletions scripting/get5.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,7 @@ void ResetMatchCvarsAndHostnameAndKickPlayers(bool kickPlayers) {
if (g_ResetCvarsOnEndCvar.BoolValue) {
RestoreCvars(g_MatchConfigChangedCvars);
ResetHostname();
ResetTeamConfigs();
} else {
CloseCvarStorage(g_MatchConfigChangedCvars);
}
Expand Down
14 changes: 14 additions & 0 deletions scripting/get5/matchconfig.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,20 @@ void ResetHostname() {
g_HostnamePreGet5 = "";
}

void ResetTeamConfigs() {
SetConVarStringSafe("mp_teamname_1", "");
SetConVarStringSafe("mp_teamflag_1", "");
SetConVarStringSafe("mp_teamlogo_1", "");
SetConVarStringSafe("mp_teammatchstat_1", "");
SetConVarStringSafe("mp_teamscore_1", "");

SetConVarStringSafe("mp_teamname_2", "");
SetConVarStringSafe("mp_teamflag_2", "");
SetConVarStringSafe("mp_teamlogo_2", "");
SetConVarStringSafe("mp_teammatchstat_2", "");
SetConVarStringSafe("mp_teamscore_2", "");
}

void UpdateHostname() {
char formattedHostname[128];
if (FormatCvarString(g_SetHostnameCvar, formattedHostname, sizeof(formattedHostname), false)) {
Expand Down
12 changes: 1 addition & 11 deletions scripting/get5/tests.sp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,7 @@ static void Get5_Test() {
SetConVarStringSafe("mp_teammatchstat_txt", "");
SetConVarStringSafe("mp_teamprediction_pct", "0");

SetConVarStringSafe("mp_teamname_1", "");
SetConVarStringSafe("mp_teamflag_1", "");
SetConVarStringSafe("mp_teamlogo_1", "");
SetConVarStringSafe("mp_teammatchstat_1", "");
SetConVarStringSafe("mp_teamscore_1", "");

SetConVarStringSafe("mp_teamname_2", "");
SetConVarStringSafe("mp_teamflag_2", "");
SetConVarStringSafe("mp_teamlogo_2", "");
SetConVarStringSafe("mp_teammatchstat_2", "");
SetConVarStringSafe("mp_teamscore_2", "");
ResetTeamConfigs();

ValidMatchConfigTest("addons/sourcemod/configs/get5/tests/default_valid.json");
ValidMatchConfigTest("addons/sourcemod/configs/get5/tests/default_valid.cfg");
Expand Down

0 comments on commit d6a65d9

Please sign in to comment.