diff --git a/r5dev/engine/host_state.cpp b/r5dev/engine/host_state.cpp index 6775bca1..44a0dc11 100644 --- a/r5dev/engine/host_state.cpp +++ b/r5dev/engine/host_state.cpp @@ -216,6 +216,7 @@ FORCEINLINE void CHostState::Think(void) const static bool bInitialized = false; static CFastTimer banListTimer; static CFastTimer pylonTimer; + static CFastTimer reloadTimer; static CFastTimer statsTimer; if (!bInitialized) // Initialize clocks. @@ -226,6 +227,7 @@ FORCEINLINE void CHostState::Think(void) const pylonTimer.Start(); #endif // DEDICATED statsTimer.Start(); + reloadTimer.Start(); #endif // !CLIENT_DLL bInitialized = true; } @@ -263,6 +265,14 @@ FORCEINLINE void CHostState::Think(void) const } #endif // DEDICATED #ifndef CLIENT_DLL + if (sv_autoReloadRate->GetBool()) + { + if (reloadTimer.GetDurationInProgress().GetSeconds() > sv_autoReloadRate->GetDouble()) + { + Cbuf_AddText(Cbuf_GetCurrentPlayer(), "reload\n", cmd_source_t::kCommandSrcCode); + reloadTimer.Start(); + } + } if (statsTimer.GetDurationInProgress().GetSeconds() > sv_statusRefreshInterval->GetDouble()) { string svCurrentPlaylist = KeyValues_GetCurrentPlaylist(); diff --git a/r5dev/tier1/IConVar.cpp b/r5dev/tier1/IConVar.cpp index 9b66648e..d429d794 100644 --- a/r5dev/tier1/IConVar.cpp +++ b/r5dev/tier1/IConVar.cpp @@ -104,6 +104,8 @@ void ConVar::Init(void) const sv_pylonRefreshInterval = ConVar::Create("sv_pylonRefreshInterval" , "5.0", FCVAR_RELEASE, "Pylon server host request post update interval (seconds).", true, 2.f, true, 8.f, nullptr, nullptr); sv_banlistRefreshInterval = ConVar::Create("sv_banlistRefreshInterval", "1.0", FCVAR_RELEASE, "Banlist refresh interval (seconds).", true, 1.f, false, 0.f, nullptr, nullptr); sv_statusRefreshInterval = ConVar::Create("sv_statusRefreshInterval" , "0.5", FCVAR_RELEASE, "Server status bar update interval (seconds).", false, 0.f, false, 0.f, nullptr, nullptr); + + sv_autoReloadRate = ConVar::Create("sv_autoReloadRate" , "0", FCVAR_RELEASE, "Time in seconds between each server auto-reload (disabled if null). ", true, 0.f, false, 0.f, nullptr, nullptr); #ifdef DEDICATED sv_rcon_debug = ConVar::Create("sv_rcon_debug" , "0" , FCVAR_RELEASE, "Show rcon debug information ( !slower! ).", false, 0.f, false, 0.f, nullptr, nullptr); sv_rcon_sendlogs = ConVar::Create("sv_rcon_sendlogs" , "0" , FCVAR_RELEASE, "Network console logs to connected and authenticated sockets.", false, 0.f, false, 0.f, nullptr, nullptr); diff --git a/r5dev/tier1/cmd.cpp b/r5dev/tier1/cmd.cpp index 500ac32a..ecb3ab90 100644 --- a/r5dev/tier1/cmd.cpp +++ b/r5dev/tier1/cmd.cpp @@ -421,6 +421,7 @@ void ConCommand::InitShipped(void) "launchplaylist", "quit", "exit", + "reload", "restart", "status", "version", diff --git a/r5dev/tier1/cvar.cpp b/r5dev/tier1/cvar.cpp index a6b0b0cb..9a0a19f2 100644 --- a/r5dev/tier1/cvar.cpp +++ b/r5dev/tier1/cvar.cpp @@ -67,6 +67,8 @@ ConVar* sv_pylonRefreshInterval = nullptr; ConVar* sv_banlistRefreshInterval = nullptr; ConVar* sv_statusRefreshInterval = nullptr; +ConVar* sv_autoReloadRate = nullptr; + #ifdef DEDICATED ConVar* sv_rcon_debug = nullptr; ConVar* sv_rcon_sendlogs = nullptr; diff --git a/r5dev/tier1/cvar.h b/r5dev/tier1/cvar.h index d1a97721..f585a45f 100644 --- a/r5dev/tier1/cvar.h +++ b/r5dev/tier1/cvar.h @@ -63,6 +63,8 @@ extern ConVar* sv_pylonRefreshInterval; extern ConVar* sv_banlistRefreshInterval; extern ConVar* sv_statusRefreshInterval; +extern ConVar* sv_autoReloadRate; + #ifdef DEDICATED extern ConVar* sv_rcon_debug; extern ConVar* sv_rcon_sendlogs;