ff_u_x_shutdown
Shutdown the server right after start (after a small delay)
If NWN_SHUTDOWN is set, then shutdown the server.
Variables
ENABLE__FF_U_X_SHUTDOWN: (string) (opt-out) Set to “N” on module to disable unit.
Source code
// @code
#include "ff_i_core"
const string ENABLE__FF_U_X_SHUTDOWN = "ENABLE__FF_U_X_SHUTDOWN";
// -----------------------------------------------------------------------------
void Shutdown();
void Shutdown()
{
string sEnv = GetEnvironmentVariableAsBool(NWN_SHUTDOWN);
if (sEnv != "T")
return;
LogFatal("Server shutdown requested via environment variable NWN_SHUTDOWN");
NWNX_Administration_ShutdownServer();
}
// -----------------------------------------------------------------------------
void main()
{
if (GetModuleFlag(ENABLE__FF_U_X_SHUTDOWN, TRUE) == FALSE)
return;
string sEvent = GetCurrentEvent();
if (sEvent == ON_REGISTER)
SubscribeToEvent(ON_MODULE_LOAD, __FILE__);
else if (sEvent == ON_MODULE_LOAD)
DelayCommand(1.2f, Shutdown());
}