diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-09 19:58:45 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-09 19:58:45 +0100 |
commit | 1885caebdaf971bf68073884754325aa8d1c0da7 (patch) | |
tree | 71fae6595c8a24ae067e8a037082e43803920586 /NorthstarDedicatedTest/squirrel.cpp | |
parent | bf56157c9a3a50452d322dd99aa5b82baf4b0013 (diff) | |
download | NorthstarLauncher-1885caebdaf971bf68073884754325aa8d1c0da7.tar.gz NorthstarLauncher-1885caebdaf971bf68073884754325aa8d1c0da7.zip |
improve showing console for ui script compile errors
Diffstat (limited to 'NorthstarDedicatedTest/squirrel.cpp')
-rw-r--r-- | NorthstarDedicatedTest/squirrel.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp index 34eb0fdc..754661a4 100644 --- a/NorthstarDedicatedTest/squirrel.cpp +++ b/NorthstarDedicatedTest/squirrel.cpp @@ -144,7 +144,7 @@ template <ScriptContext context> void ScriptCompileErrorHook(void* sqvm, const c cmd_source_t::kCommandSrcCode); if (realContext == ScriptContext::UI) - Cbuf_AddText(Cbuf_GetCurrentPlayer(), "toggleconsole", cmd_source_t::kCommandSrcCode); // likely temp: show console so user can see any errors + Cbuf_AddText(Cbuf_GetCurrentPlayer(), "showconsole", cmd_source_t::kCommandSrcCode); // likely temp: show console so user can see any errors } // dont call the original function since it kills game lol @@ -225,7 +225,7 @@ template <ScriptContext context> bool CallScriptInitCallbackHook(void* sqvm, con return ret; } -template <ScriptContext context> void ExecuteCodeCommand(const CCommand& args) +template <ScriptContext context> void ConCommand_script(const CCommand& args) { if (context == ScriptContext::CLIENT) g_pClientSquirrel->ExecuteCode(args.ArgS()); @@ -247,8 +247,7 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (HMODULE baseAddr (char*)baseAddress + 0x12B00, &SQPrintHook<ScriptContext::CLIENT>, reinterpret_cast<LPVOID*>(&ClientSQPrint)); // client print function - RegisterConCommand( - "script_client", ExecuteCodeCommand<ScriptContext::CLIENT>, "Executes script code on the client vm", FCVAR_CLIENTDLL); + RegisterConCommand("script_client", ConCommand_script<ScriptContext::CLIENT>, "Executes script code on the client vm", FCVAR_CLIENTDLL); // ui inits g_pUISquirrel = new SquirrelManager<ScriptContext::UI>; @@ -258,7 +257,7 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (HMODULE baseAddr (char*)baseAddress + 0x12BA0, &SQPrintHook<ScriptContext::UI>, reinterpret_cast<LPVOID*>(&UISQPrint)); // ui print function - RegisterConCommand("script_ui", ExecuteCodeCommand<ScriptContext::UI>, "Executes script code on the ui vm", FCVAR_CLIENTDLL); + RegisterConCommand("script_ui", ConCommand_script<ScriptContext::UI>, "Executes script code on the ui vm", FCVAR_CLIENTDLL); g_pClientSquirrel->RegisterSquirrelFunc = (RegisterSquirrelFuncType)((char*)baseAddress + 0x108E0); g_pUISquirrel->RegisterSquirrelFunc = (RegisterSquirrelFuncType)((char*)baseAddress + 0x108E0); @@ -379,7 +378,7 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (HMODULE baseAddr // for script_client and script_ui, we don't use cheats, so clients can execute them on themselves all they want RegisterConCommand( "script", - ExecuteCodeCommand<ScriptContext::SERVER>, + ConCommand_script<ScriptContext::SERVER>, "Executes script code on the server vm", FCVAR_GAMEDLL | FCVAR_CLIENTCMD_CAN_EXECUTE | FCVAR_CHEAT); })
\ No newline at end of file |