aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/misccommands.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-10-06 23:33:28 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-10-06 23:33:28 +0100
commitcb386ef4857f5a0f13998d1813cfa7d57a00af7d (patch)
tree910abfcba3c471373b01ed81503db299cdec6494 /NorthstarDedicatedTest/misccommands.cpp
parent900855c0036aa9a6a6305e3f17a41a55640bdfaf (diff)
downloadNorthstarLauncher-cb386ef4857f5a0f13998d1813cfa7d57a00af7d.tar.gz
NorthstarLauncher-cb386ef4857f5a0f13998d1813cfa7d57a00af7d.zip
add ns_leave_to_lobby command
Diffstat (limited to 'NorthstarDedicatedTest/misccommands.cpp')
-rw-r--r--NorthstarDedicatedTest/misccommands.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/misccommands.cpp b/NorthstarDedicatedTest/misccommands.cpp
new file mode 100644
index 00000000..c03ba713
--- /dev/null
+++ b/NorthstarDedicatedTest/misccommands.cpp
@@ -0,0 +1,28 @@
+#include "pch.h"
+#include "misccommands.h"
+#include "concommand.h"
+#include "gameutils.h"
+
+void ForceLoadMapCommand(const CCommand& arg)
+{
+ if (arg.ArgC() < 2)
+ return;
+
+ g_pHostState->m_iNextState = HS_NEW_GAME;
+ strncpy(g_pHostState->m_levelName, arg.Arg(1), sizeof(g_pHostState->m_levelName));
+}
+
+void LeaveToLobbyCommand(const CCommand& arg)
+{
+ SetCurrentPlaylist("tdm");
+
+ // note: for host, this will kick all clients, since it hits HS_GAME_SHUTDOWN
+ g_pHostState->m_iNextState = HS_NEW_GAME;
+ strcpy(g_pHostState->m_levelName, "mp_lobby");
+}
+
+void AddMiscConCommands()
+{
+ RegisterConCommand("force_newgame", ForceLoadMapCommand, "forces a map load through directly setting g_pHostState->m_iNextState to HS_NEW_GAME", FCVAR_NONE);
+ RegisterConCommand("ns_leave_to_lobby", LeaveToLobbyCommand, "called by the server, used to return the player to lobby when leaving a game", FCVAR_SERVER_CAN_EXECUTE);
+} \ No newline at end of file