diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-10-11 23:35:40 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-10-11 23:35:40 +0100 |
commit | c5cf48bba33159fc268904688f29ed20c14b11b3 (patch) | |
tree | 88aa6d01bf204f93ece63e50d3f1b9b4ca263094 /NorthstarDedicatedTest/serverscriptpersistence.cpp | |
parent | cb386ef4857f5a0f13998d1813cfa7d57a00af7d (diff) | |
download | NorthstarLauncher-c5cf48bba33159fc268904688f29ed20c14b11b3.tar.gz NorthstarLauncher-c5cf48bba33159fc268904688f29ed20c14b11b3.zip |
add server script early persistence writes
Diffstat (limited to 'NorthstarDedicatedTest/serverscriptpersistence.cpp')
-rw-r--r-- | NorthstarDedicatedTest/serverscriptpersistence.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/serverscriptpersistence.cpp b/NorthstarDedicatedTest/serverscriptpersistence.cpp new file mode 100644 index 00000000..4f7bba88 --- /dev/null +++ b/NorthstarDedicatedTest/serverscriptpersistence.cpp @@ -0,0 +1,30 @@ +#include "pch.h" +#include "serverscriptpersistence.h" +#include "squirrel.h" +#include "masterserver.h" +#include "serverauthentication.h" + +// void function NSEarlyWritePlayerPersistenceForLeave( entity player ) +SQInteger SQ_EarlyWritePlayerPersistenceForLeave(void* sqvm) +{ + void* player; + if (!ServerSq_getentity(sqvm, &player) || !g_ServerAuthenticationManager->m_additionalPlayerData.count(player)) + return 0; + + g_ServerAuthenticationManager->m_additionalPlayerData[player].needPersistenceWriteOnLeave = false; + g_ServerAuthenticationManager->WritePersistentData(player); + return 0; +} + +// bool function NSIsWritingPlayerPersistence() +SQInteger SQ_IsWritingPlayerPersistence(void* sqvm) +{ + ServerSq_pushbool(sqvm, g_MasterServerManager->m_savingPersistentData); + return 1; +} + +void InitialiseServerScriptPersistence(HMODULE baseAddress) +{ + g_ServerSquirrelManager->AddFuncRegistration("void", "NSEarlyWritePlayerPersistenceForLeave", "entity player", "", SQ_EarlyWritePlayerPersistenceForLeave); + g_ServerSquirrelManager->AddFuncRegistration("bool", "NSIsWritingPlayerPersistence", "", "", SQ_IsWritingPlayerPersistence); +}
\ No newline at end of file |