diff options
author | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-10-08 16:47:43 +0100 |
---|---|---|
committer | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-10-08 16:47:43 +0100 |
commit | da3d91228c08ec660564368f992a2ba6b78ca4a8 (patch) | |
tree | ce0bc00ae9c5ed647d8eca1f1995b645b40bb803 | |
parent | ed77a516d8061db848329072c70fa6b3d910027c (diff) | |
download | NorthstarLauncher-da3d91228c08ec660564368f992a2ba6b78ca4a8.tar.gz NorthstarLauncher-da3d91228c08ec660564368f992a2ba6b78ca4a8.zip |
set serverfilter betterv1.9.8-rc1
-rw-r--r-- | NorthstarDLL/misccommands.cpp | 11 | ||||
-rw-r--r-- | NorthstarDLL/scriptserverbrowser.cpp | 9 |
2 files changed, 9 insertions, 11 deletions
diff --git a/NorthstarDLL/misccommands.cpp b/NorthstarDLL/misccommands.cpp index b316571c..3aae19d0 100644 --- a/NorthstarDLL/misccommands.cpp +++ b/NorthstarDLL/misccommands.cpp @@ -29,11 +29,8 @@ void ConCommand_ns_start_reauth_and_leave_to_lobby(const CCommand& arg) void ConCommand_ns_end_reauth_and_leave_to_lobby(const CCommand& arg) { - R2::Cbuf_AddText( - R2::Cbuf_GetCurrentPlayer(), - fmt::format("serverfilter {}", g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first).c_str(), - R2::cmd_source_t::kCommandSrcCode); - R2::Cbuf_Execute(); + if (g_pServerAuthentication->m_RemoteAuthenticationData.size()) + R2::g_pCVar->FindVar("serverfilter")->SetValue(g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first.c_str()); // weird way of checking, but check if client script vm is initialised, mainly just to allow players to cancel this if (g_pSquirrel<ScriptContext::CLIENT>->m_pSQVM) @@ -108,6 +105,7 @@ void FixupCvarFlags() pCommand->m_nFlags |= FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS; } while (ppEngineClientCommands[++i]); + // array of cvars and the flags we want to add to them const std::vector<std::tuple<const char*, uint32_t>> CVAR_FIXUP_ADD_FLAGS = { // system commands (i.e. necessary for proper functionality) // servers need to be able to disconnect @@ -138,10 +136,13 @@ void FixupCvarFlags() {"test_setteam", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}, {"melee_lunge_ent", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}}; + // array of cvars and the flags we want to remove from them const std::vector<std::tuple<const char*, uint32_t>> CVAR_FIXUP_REMOVE_FLAGS = { // unsure how this command works, not even sure it's used on retail servers, deffo shouldn't be used on northstar {"migrateme", FCVAR_SERVER_CAN_EXECUTE | FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}, {"recheck", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}, // we don't need this on northstar servers, it's for communities + + // unsure how these work exactly (rpt system likely somewhat stripped?), removing anyway since they won't be used {"rpt_client_enable", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}, {"rpt_password", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}}; diff --git a/NorthstarDLL/scriptserverbrowser.cpp b/NorthstarDLL/scriptserverbrowser.cpp index a361aeb8..e33406fc 100644 --- a/NorthstarDLL/scriptserverbrowser.cpp +++ b/NorthstarDLL/scriptserverbrowser.cpp @@ -371,8 +371,7 @@ SQRESULT SQ_ConnectToAuthedServer(HSquirrelVM* sqvm) // set auth token, then try to connect // i'm honestly not entirely sure how silentconnect works regarding ports and encryption so using connect for now - R2::Cbuf_AddText( - R2::Cbuf_GetCurrentPlayer(), fmt::format("serverfilter {}", info.authToken).c_str(), R2::cmd_source_t::kCommandSrcCode); + R2::g_pCVar->FindVar("serverfilter")->SetValue(info.authToken); R2::Cbuf_AddText( R2::Cbuf_GetCurrentPlayer(), fmt::format( @@ -403,10 +402,8 @@ SQRESULT SQ_CompleteAuthWithLocalServer(HSquirrelVM* sqvm) { // literally just set serverfilter // note: this assumes we have no authdata other than our own - R2::Cbuf_AddText( - R2::Cbuf_GetCurrentPlayer(), - fmt::format("serverfilter {}", g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first).c_str(), - R2::cmd_source_t::kCommandSrcCode); + if (g_pServerAuthentication->m_RemoteAuthenticationData.size()) + R2::g_pCVar->FindVar("serverfilter")->SetValue(g_pServerAuthentication->m_RemoteAuthenticationData.begin()->first.c_str()); return SQRESULT_NULL; } |