diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-03-06 18:58:55 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-03-06 18:58:55 +0000 |
commit | 6a9fae96aeab36a9a9a32af7cd8d6b0c700d2f2b (patch) | |
tree | a12afb79844f7074a7d7124b8867c35b8f75d231 /NorthstarDedicatedTest | |
parent | 17aaab6f250cd4d576fce78392596762e2a09142 (diff) | |
download | NorthstarLauncher-6a9fae96aeab36a9a9a32af7cd8d6b0c700d2f2b.tar.gz NorthstarLauncher-6a9fae96aeab36a9a9a32af7cd8d6b0c700d2f2b.zip |
add support for server=>client script stringcommands
Diffstat (limited to 'NorthstarDedicatedTest')
5 files changed, 38 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj index f12a9eee..c5a5ce60 100644 --- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj +++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj @@ -553,6 +553,7 @@ <ClInclude Include="scriptserverbrowser.h" /> <ClInclude Include="scriptsrson.h" /> <ClInclude Include="serverauthentication.h" /> + <ClInclude Include="scriptservertoclientstringcommand.h" /> <ClInclude Include="sigscanning.h" /> <ClInclude Include="sourceconsole.h" /> <ClInclude Include="sourceinterface.h" /> @@ -609,6 +610,7 @@ <ClCompile Include="serverauthentication.cpp" /> <ClCompile Include="miscserverscript.cpp" /> <ClCompile Include="serverchathooks.cpp" /> + <ClCompile Include="scriptservertoclientstringcommand.cpp" /> <ClCompile Include="sigscanning.cpp" /> <ClCompile Include="sourceconsole.cpp" /> <ClCompile Include="sourceinterface.cpp" /> diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters index 37277e2e..f384e81b 100644 --- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters +++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters @@ -1471,6 +1471,9 @@ <Filter>Header Files\Client</Filter> </ClInclude> <ClInclude Include="localchatwriter.h"> + <Filter>Header Files\Client</Filter> + </ClInclude> + <ClInclude Include="scriptservertoclientstringcommand.h"> <Filter>Header Files\Client</Filter> </ClInclude> <ClInclude Include="plugins.h"> @@ -1629,6 +1632,9 @@ <Filter>Source Files\Client</Filter> </ClCompile> <ClCompile Include="localchatwriter.cpp"> + <Filter>Source Files\Client</Filter> + </ClCompile> + <ClCompile Include="scriptservertoclientstringcommand.cpp"> <Filter>Source Files\Client</Filter> </ClCompile> <ClCompile Include="plugins.cpp"> diff --git a/NorthstarDedicatedTest/dllmain.cpp b/NorthstarDedicatedTest/dllmain.cpp index f906e724..6a079da0 100644 --- a/NorthstarDedicatedTest/dllmain.cpp +++ b/NorthstarDedicatedTest/dllmain.cpp @@ -37,6 +37,7 @@ #include "serverchathooks.h" #include "clientchathooks.h" #include "localchatwriter.h" +#include "scriptservertoclientstringcommand.h" #include <string.h> #include "pch.h" #include "plugin_abi.h" @@ -239,6 +240,7 @@ bool InitialiseNorthstar() AddDllLoadCallback("client.dll", InitialisePluginCommands); AddDllLoadCallback("client.dll", InitialiseClientChatHooks); AddDllLoadCallback("client.dll", InitialiseLocalChatWriter); + AddDllLoadCallback("client.dll", InitialiseScriptServerToClientStringCommands); } AddDllLoadCallback("engine.dll", InitialiseEngineSpewFuncHooks); diff --git a/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp b/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp new file mode 100644 index 00000000..58d92ec6 --- /dev/null +++ b/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp @@ -0,0 +1,25 @@ +#include "pch.h" +#include "scriptservertoclientstringcommand.h" +#include "squirrel.h" +#include "convar.h" +#include "concommand.h" +#include "dedicated.h" + +void ConCommand_ns_script_servertoclientstringcommand(const CCommand& arg) +{ + if (g_ClientSquirrelManager->sqvm && g_ClientSquirrelManager->setupfunc("NSClientCodeCallback_RecievedServerToClientStringCommand") != SQRESULT_ERROR) + { + g_ClientSquirrelManager->pusharg(arg.ArgS()); + g_ClientSquirrelManager->call(1); // todo: doesn't throw or log errors from within this, probably not great behaviour + } +} + +void InitialiseScriptServerToClientStringCommands(HMODULE baseAddress) +{ + if (IsDedicated()) + return; + + RegisterConCommand( + "ns_script_servertoclientstringcommand", ConCommand_ns_script_servertoclientstringcommand, "", + FCVAR_CLIENTDLL | FCVAR_SERVER_CAN_EXECUTE); +}
\ No newline at end of file diff --git a/NorthstarDedicatedTest/scriptservertoclientstringcommand.h b/NorthstarDedicatedTest/scriptservertoclientstringcommand.h new file mode 100644 index 00000000..609c6105 --- /dev/null +++ b/NorthstarDedicatedTest/scriptservertoclientstringcommand.h @@ -0,0 +1,3 @@ +#pragma once + +void InitialiseScriptServerToClientStringCommands(HMODULE baseAddress);
\ No newline at end of file |