aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/miscserverscript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL/miscserverscript.cpp')
-rw-r--r--NorthstarDLL/miscserverscript.cpp35
1 files changed, 11 insertions, 24 deletions
diff --git a/NorthstarDLL/miscserverscript.cpp b/NorthstarDLL/miscserverscript.cpp
index 758323ef..a8e7264b 100644
--- a/NorthstarDLL/miscserverscript.cpp
+++ b/NorthstarDLL/miscserverscript.cpp
@@ -8,22 +8,21 @@
#include <filesystem>
-// void function NSEarlyWritePlayerPersistenceForLeave( entity player )
-SQRESULT SQ_EarlyWritePlayerPersistenceForLeave(HSquirrelVM* sqvm)
+ADD_SQFUNC("void", NSEarlyWritePlayerPersistenceForLeave, "entity player", "", ScriptContext::SERVER)
{
- const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
+ const R2::CBasePlayer* pPlayer = g_pSquirrel<context>->getentity<R2::CBasePlayer>(sqvm, 1);
if (!pPlayer)
{
spdlog::warn("NSEarlyWritePlayerPersistenceForLeave got null player");
- g_pSquirrel<ScriptContext::SERVER>->pushbool(sqvm, false);
+ g_pSquirrel<context>->pushbool(sqvm, false);
return SQRESULT_NOTNULL;
}
R2::CBaseClient* pClient = &R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1];
if (g_pServerAuthentication->m_PlayerAuthenticationData.find(pClient) == g_pServerAuthentication->m_PlayerAuthenticationData.end())
{
- g_pSquirrel<ScriptContext::SERVER>->pushbool(sqvm, false);
+ g_pSquirrel<context>->pushbool(sqvm, false);
return SQRESULT_NOTNULL;
}
@@ -32,42 +31,30 @@ SQRESULT SQ_EarlyWritePlayerPersistenceForLeave(HSquirrelVM* sqvm)
return SQRESULT_NULL;
}
-// bool function NSIsWritingPlayerPersistence()
-SQRESULT SQ_IsWritingPlayerPersistence(HSquirrelVM* sqvm)
+ADD_SQFUNC("bool", NSIsWritingPlayerPersistence, "", "", ScriptContext::SERVER)
{
- g_pSquirrel<ScriptContext::SERVER>->pushbool(sqvm, g_pMasterServerManager->m_bSavingPersistentData);
+ g_pSquirrel<context>->pushbool(sqvm, g_pMasterServerManager->m_bSavingPersistentData);
return SQRESULT_NOTNULL;
}
-// bool function NSIsPlayerLocalPlayer( entity player )
-SQRESULT SQ_IsPlayerLocalPlayer(HSquirrelVM* sqvm)
+ADD_SQFUNC("bool", NSIsPlayerLocalPlayer, "entity player", "", ScriptContext::SERVER)
{
const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
if (!pPlayer)
{
spdlog::warn("NSIsPlayerLocalPlayer got null player");
- g_pSquirrel<ScriptContext::SERVER>->pushbool(sqvm, false);
+ g_pSquirrel<context>->pushbool(sqvm, false);
return SQRESULT_NOTNULL;
}
R2::CBaseClient* pClient = &R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1];
- g_pSquirrel<ScriptContext::SERVER>->pushbool(sqvm, !strcmp(R2::g_pLocalPlayerUserID, pClient->m_UID));
+ g_pSquirrel<context>->pushbool(sqvm, !strcmp(R2::g_pLocalPlayerUserID, pClient->m_UID));
return SQRESULT_NOTNULL;
}
-// bool function NSIsDedicated()
-SQRESULT SQ_IsDedicated(HSquirrelVM* sqvm)
+ADD_SQFUNC("bool", NSIsDedicated, "", "", ScriptContext::SERVER)
{
- g_pSquirrel<ScriptContext::SERVER>->pushbool(sqvm, IsDedicatedServer());
+ g_pSquirrel<context>->pushbool(sqvm, IsDedicatedServer());
return SQRESULT_NOTNULL;
}
-
-ON_DLL_LOAD_RELIESON("server.dll", MiscServerScriptCommands, ServerSquirrel, (CModule module))
-{
- g_pSquirrel<ScriptContext::SERVER>->AddFuncRegistration(
- "void", "NSEarlyWritePlayerPersistenceForLeave", "entity player", "", SQ_EarlyWritePlayerPersistenceForLeave);
- g_pSquirrel<ScriptContext::SERVER>->AddFuncRegistration("bool", "NSIsWritingPlayerPersistence", "", "", SQ_IsWritingPlayerPersistence);
- g_pSquirrel<ScriptContext::SERVER>->AddFuncRegistration("bool", "NSIsPlayerLocalPlayer", "entity player", "", SQ_IsPlayerLocalPlayer);
- g_pSquirrel<ScriptContext::SERVER>->AddFuncRegistration("bool", "NSIsDedicated", "", "", SQ_IsDedicated);
-}