aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/serverscriptpersistence.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest/serverscriptpersistence.cpp')
-rw-r--r--NorthstarDedicatedTest/serverscriptpersistence.cpp30
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