From bfa5bc2b3c3fa6144cad531f0549a9d5cecda130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 3 Mar 2024 13:04:07 +0100 Subject: [PATCH 1/2] Remove remaining hard-coded server commands from client-side Followup for #7919. --- src/engine/client/client.cpp | 10 ---------- src/game/client/gameclient.cpp | 21 +-------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index d66e24ee7..53254a385 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -4070,16 +4070,6 @@ void CClient::ConchainStdoutOutputLevel(IConsole::IResult *pResult, void *pUserD void CClient::RegisterCommands() { m_pConsole = Kernel()->RequestInterface(); - // register server dummy commands for tab completion - m_pConsole->Register("kick", "i[id] ?r[reason]", CFGFLAG_SERVER, 0, 0, "Kick player with specified id for any reason"); - m_pConsole->Register("ban", "s[ip|id] ?i[minutes] r[reason]", CFGFLAG_SERVER, 0, 0, "Ban player with ip/id for x minutes for any reason"); - m_pConsole->Register("unban", "r[ip]", CFGFLAG_SERVER, 0, 0, "Unban ip"); - m_pConsole->Register("bans", "?i[page]", CFGFLAG_SERVER, 0, 0, "Show banlist (page 0 by default, 20 entries per page)"); - m_pConsole->Register("status", "?r[name]", CFGFLAG_SERVER, 0, 0, "List players containing name or all players"); - m_pConsole->Register("shutdown", "", CFGFLAG_SERVER, 0, 0, "Shut down"); - m_pConsole->Register("record", "r[file]", CFGFLAG_SERVER, 0, 0, "Record to a file"); - m_pConsole->Register("stoprecord", "", CFGFLAG_SERVER, 0, 0, "Stop recording"); - m_pConsole->Register("reload", "", CFGFLAG_SERVER, 0, 0, "Reload the map"); m_pConsole->Register("dummy_connect", "", CFGFLAG_CLIENT, Con_DummyConnect, this, "Connect dummy"); m_pConsole->Register("dummy_disconnect", "", CFGFLAG_CLIENT, Con_DummyDisconnect, this, "Disconnect dummy"); diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 4f735c5b4..5a0aaa1ce 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -161,29 +161,10 @@ void CGameClient::OnConsoleInit() &m_Controls, &m_Binds}); - // add the some console commands + // add basic console commands Console()->Register("team", "i[team-id]", CFGFLAG_CLIENT, ConTeam, this, "Switch team"); Console()->Register("kill", "", CFGFLAG_CLIENT, ConKill, this, "Kill yourself to restart"); - // register server dummy commands for tab completion - Console()->Register("tune", "s[tuning] ?f[value]", CFGFLAG_SERVER, 0, 0, "Tune variable to value or show current value"); - Console()->Register("tune_reset", "?s[tuning]", CFGFLAG_SERVER, 0, 0, "Reset all or one tuning variable to default"); - Console()->Register("tunes", "", CFGFLAG_SERVER, 0, 0, "List all tuning variables and their values"); - Console()->Register("change_map", "?r[map]", CFGFLAG_SERVER, 0, 0, "Change map"); - Console()->Register("restart", "?i[seconds]", CFGFLAG_SERVER, 0, 0, "Restart in x seconds"); - Console()->Register("broadcast", "r[message]", CFGFLAG_SERVER, 0, 0, "Broadcast message"); - Console()->Register("say", "r[message]", CFGFLAG_SERVER, 0, 0, "Say in chat"); - Console()->Register("set_team", "i[id] i[team-id] ?i[delay in minutes]", CFGFLAG_SERVER, 0, 0, "Set team of player to team"); - Console()->Register("set_team_all", "i[team-id]", CFGFLAG_SERVER, 0, 0, "Set team of all players to team"); - Console()->Register("add_vote", "s[name] r[command]", CFGFLAG_SERVER, 0, 0, "Add a voting option"); - Console()->Register("remove_vote", "s[name]", CFGFLAG_SERVER, 0, 0, "remove a voting option"); - Console()->Register("force_vote", "s[name] s[command] ?r[reason]", CFGFLAG_SERVER, 0, 0, "Force a voting option"); - Console()->Register("clear_votes", "", CFGFLAG_SERVER, 0, 0, "Clears the voting options"); - Console()->Register("add_map_votes", "", CFGFLAG_SERVER, 0, 0, "Automatically adds voting options for all maps"); - Console()->Register("vote", "r['yes'|'no']", CFGFLAG_SERVER, 0, 0, "Force a vote to yes/no"); - Console()->Register("swap_teams", "", CFGFLAG_SERVER, 0, 0, "Swap the current teams"); - Console()->Register("shuffle_teams", "", CFGFLAG_SERVER, 0, 0, "Shuffle the current teams"); - // register tune zone command to allow the client prediction to load tunezones from the map Console()->Register("tune_zone", "i[zone] s[tuning] f[value]", CFGFLAG_CLIENT | CFGFLAG_GAME, ConTuneZone, this, "Tune in zone a variable to value"); From dd94da67fbe1256b2de9a4d3dde06d6d13a2417b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 3 Mar 2024 13:25:41 +0100 Subject: [PATCH 2/2] Hide `tune_zone` command in local console Prevent the `tune_zone` command from being shown and used in the local console, which could cause issues with prediction, by only registering it as a game setting but not as a client command. The command callback is still correctly called when map settings are loaded in the `CGameClient::LoadMapSettings` function. --- src/game/client/gameclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 5a0aaa1ce..a9ed2f38b 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -166,7 +166,7 @@ void CGameClient::OnConsoleInit() Console()->Register("kill", "", CFGFLAG_CLIENT, ConKill, this, "Kill yourself to restart"); // register tune zone command to allow the client prediction to load tunezones from the map - Console()->Register("tune_zone", "i[zone] s[tuning] f[value]", CFGFLAG_CLIENT | CFGFLAG_GAME, ConTuneZone, this, "Tune in zone a variable to value"); + Console()->Register("tune_zone", "i[zone] s[tuning] f[value]", CFGFLAG_GAME, ConTuneZone, this, "Tune in zone a variable to value"); for(auto &pComponent : m_vpAll) pComponent->m_pClient = this;