* Add OnServerHibernationUpdate forward (closes #1483) * Clarify hibernation state * make it 2 forwards instead of 1 --------- Co-authored-by: Odin Landers <ojl9576@rit.edu>
This commit is contained in:
parent
908ffdb523
commit
e60c672485
@ -59,6 +59,8 @@ bool g_OnMapStarted = false;
|
||||
IForward *PreAdminCheck = NULL;
|
||||
IForward *PostAdminCheck = NULL;
|
||||
IForward *PostAdminFilter = NULL;
|
||||
IForward *ServerEnterHibernation = NULL;
|
||||
IForward *ServerExitHibernation = NULL;
|
||||
|
||||
const unsigned int *g_NumPlayersToAuth = NULL;
|
||||
int lifestate_offset = -1;
|
||||
@ -203,6 +205,8 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
PreAdminCheck = forwardsys->CreateForward("OnClientPreAdminCheck", ET_Event, 1, p1);
|
||||
PostAdminCheck = forwardsys->CreateForward("OnClientPostAdminCheck", ET_Ignore, 1, p1);
|
||||
PostAdminFilter = forwardsys->CreateForward("OnClientPostAdminFilter", ET_Ignore, 1, p1);
|
||||
ServerEnterHibernation = forwardsys->CreateForward("OnServerEnterHibernation", ET_Ignore, 0, NULL);
|
||||
ServerExitHibernation = forwardsys->CreateForward("OnServerExitHibernation", ET_Ignore, 0, NULL);
|
||||
|
||||
m_bIsListenServer = !engine->IsDedicatedServer();
|
||||
m_ListenClient = 0;
|
||||
@ -254,6 +258,8 @@ void PlayerManager::OnSourceModShutdown()
|
||||
forwardsys->ReleaseForward(PreAdminCheck);
|
||||
forwardsys->ReleaseForward(PostAdminCheck);
|
||||
forwardsys->ReleaseForward(PostAdminFilter);
|
||||
forwardsys->ReleaseForward(ServerEnterHibernation);
|
||||
forwardsys->ReleaseForward(ServerExitHibernation);
|
||||
|
||||
delete [] m_Players;
|
||||
|
||||
@ -778,6 +784,11 @@ void PlayerManager::OnSourceModLevelEnd()
|
||||
|
||||
void PlayerManager::OnServerHibernationUpdate(bool bHibernating)
|
||||
{
|
||||
cell_t res;
|
||||
if (bHibernating)
|
||||
ServerEnterHibernation->Execute(&res);
|
||||
else
|
||||
ServerExitHibernation->Execute(&res);
|
||||
/* If bots were added at map start, but not fully inited before hibernation, there will
|
||||
* be no OnClientDisconnect for them, despite them getting booted right before this.
|
||||
*/
|
||||
|
@ -215,6 +215,18 @@ forward Action OnClientPreAdminCheck(int client);
|
||||
*/
|
||||
forward void OnClientPostAdminFilter(int client);
|
||||
|
||||
/**
|
||||
* Called directly before the server enters hibernation.
|
||||
* This is your last chance to do anything in the plugin before
|
||||
* hibernation occurs, as SV_Frame will no longer be called.
|
||||
*/
|
||||
forward void OnServerEnterHibernation();
|
||||
|
||||
/**
|
||||
* Called directly before the server leaves hibernation.
|
||||
*/
|
||||
forward void OnServerExitHibernation();
|
||||
|
||||
/**
|
||||
* Called once a client is authorized and fully in-game, and
|
||||
* after all post-connection authorizations have been performed.
|
||||
|
Loading…
Reference in New Issue
Block a user