Core: add option to run the game fully offline

The game can now be ran fully offline by providing '-offline' to the command line arguments. The engine will auto execute 'system/autoexec_offline.cfg' which overrides other autoexecs to ensure the game runs offline. The system/autoexec_offline.cfg file only overrides the variables it sets.
This commit is contained in:
Kawe Mazidjatari 2024-11-09 01:22:43 +01:00
parent a702323181
commit 43e162711e
2 changed files with 15 additions and 1 deletions

View File

@ -250,7 +250,17 @@ void Systems_Init()
#ifdef DEDICATED
InitCommandLineParameters();
#endif // DEDICATED
#else
// Must append these here if user specified the -offline parameter so the
// engine can take care of disabling the platform systems on time. The
// dedicated server already has these disabled, so we don't need to check
// for it here.
if (CommandLine()->CheckParm("-offline"))
{
CommandLine()->AppendParm("-noorigin", "");
CommandLine()->AppendParm("-nodiscord", "");
}
#endif// DEDICATED
// Script context registration callbacks.
ScriptConstantRegister_Callback = ScriptConstantRegistrationCallback;

View File

@ -421,6 +421,10 @@ void CHostState::LoadConfig(void) const
Cbuf_AddText(Cbuf_GetCurrentPlayer(), "exec tools/rcon_client_dev.cfg\n", cmd_source_t::kCommandSrcCode);
#endif // !DEDICATED
}
if (CommandLine()->CheckParm("-offline"))
{
Cbuf_AddText(Cbuf_GetCurrentPlayer(), "exec system/autoexec_offline.cfg\n", cmd_source_t::kCommandSrcCode);
}
#ifndef CLIENT_DLL
Cbuf_AddText(Cbuf_GetCurrentPlayer(), "exec liveapi.cfg\n", cmd_source_t::kCommandSrcCode);
#endif //!CLIENT_DLL