diff options
author | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-07-18 00:00:39 +0100 |
---|---|---|
committer | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-07-18 00:00:39 +0100 |
commit | b0bef05111a95a4cce6250d2b79e2aa5baa6dd98 (patch) | |
tree | 5bdc39717bebfc437adf8683405d58d97e1f43b2 /NorthstarDLL/squirrel.cpp | |
parent | 6ae30c9b15fcc200c7b642016e7adbfdf9b979f4 (diff) | |
download | NorthstarLauncher-b0bef05111a95a4cce6250d2b79e2aa5baa6dd98.tar.gz NorthstarLauncher-b0bef05111a95a4cce6250d2b79e2aa5baa6dd98.zip |
use modular ServerPresence system for registering servers
Diffstat (limited to 'NorthstarDLL/squirrel.cpp')
-rw-r--r-- | NorthstarDLL/squirrel.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/NorthstarDLL/squirrel.cpp b/NorthstarDLL/squirrel.cpp index 2db944e8..e2333dad 100644 --- a/NorthstarDLL/squirrel.cpp +++ b/NorthstarDLL/squirrel.cpp @@ -2,6 +2,7 @@ #include "squirrel.h"
#include "concommand.h"
#include "modmanager.h"
+#include "dedicated.h"
#include "r2engine.h"
#include "NSMem.h"
@@ -130,14 +131,20 @@ template <ScriptContext context> void ScriptCompileErrorHook(void* sqvm, const c // ideally we'd just check if the sqvm was fully initialised here, somehow
if (strcmp(file, "console") && strcmp(file, "unnamedbuffer"))
{
- R2::Cbuf_AddText(
- R2::Cbuf_GetCurrentPlayer(),
- fmt::format("disconnect \"Encountered {} script compilation error, see console for details.\"", GetContextName(realContext))
- .c_str(),
- R2::cmd_source_t::kCommandSrcCode);
-
- if (realContext == ScriptContext::UI) // likely temp: show console so user can see any errors, as error message wont display if ui is dead
- R2::Cbuf_AddText(R2::Cbuf_GetCurrentPlayer(), "showconsole", R2::cmd_source_t::kCommandSrcCode);
+ // kill dedicated server if we hit this
+ if (IsDedicatedServer())
+ abort();
+ else
+ {
+ R2::Cbuf_AddText(
+ R2::Cbuf_GetCurrentPlayer(),
+ fmt::format("disconnect \"Encountered {} script compilation error, see console for details.\"", GetContextName(realContext))
+ .c_str(),
+ R2::cmd_source_t::kCommandSrcCode);
+
+ if (realContext == ScriptContext::UI) // likely temp: show console so user can see any errors, as error message wont display if ui is dead
+ R2::Cbuf_AddText(R2::Cbuf_GetCurrentPlayer(), "showconsole", R2::cmd_source_t::kCommandSrcCode);
+ }
}
// dont call the original function since it kills game lol
|