mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add cvars for modsystem
Add cvars to enable/disable the modsystem, also added cvars to toggle modsystem debug.
This commit is contained in:
parent
f6650df951
commit
8f480d924b
@ -62,6 +62,11 @@ ConVar* r_visualizetraces_duration = nullptr;
|
||||
|
||||
ConVar* stream_overlay = nullptr;
|
||||
ConVar* stream_overlay_mode = nullptr;
|
||||
//-----------------------------------------------------------------------------
|
||||
// SHARED |
|
||||
ConVar* modsystem_enable = nullptr;
|
||||
ConVar* modsystem_debug = nullptr;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// SERVER |
|
||||
#ifndef CLIENT_DLL
|
||||
@ -274,6 +279,12 @@ void ConVar_StaticInit(void)
|
||||
r_drawWorldMeshes = ConVar::StaticCreate("r_drawWorldMeshes" , "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Render world meshes.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r_drawWorldMeshesDepthOnly = ConVar::StaticCreate("r_drawWorldMeshesDepthOnly" , "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Render world meshes (depth only).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
r_drawWorldMeshesDepthAtTheEnd = ConVar::StaticCreate("r_drawWorldMeshesDepthAtTheEnd", "1", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT, "Render world meshes (depth at the end).", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// SHARED |
|
||||
modsystem_enable = ConVar::StaticCreate("modsystem_enable", "0", FCVAR_RELEASE, "Enable the modsystem.", false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
modsystem_debug = ConVar::StaticCreate("modsystem_debug" , "0", FCVAR_RELEASE, "Debug the modsystem." , false, 0.f, false, 0.f, nullptr, nullptr);
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// SERVER |
|
||||
#ifndef CLIENT_DLL
|
||||
|
@ -53,6 +53,11 @@ extern ConVar* r_visualizetraces_duration;
|
||||
|
||||
extern ConVar* stream_overlay;
|
||||
extern ConVar* stream_overlay_mode;
|
||||
//-------------------------------------------------------------------------
|
||||
// SHARED |
|
||||
extern ConVar* modsystem_enable;
|
||||
extern ConVar* modsystem_debug;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// SERVER |
|
||||
#ifndef CLIENT_DLL
|
||||
|
@ -18,6 +18,9 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
void CModSystem::Init()
|
||||
{
|
||||
if (!modsystem_enable->GetBool())
|
||||
return;
|
||||
|
||||
LoadModStatusList();
|
||||
|
||||
CreateDirectories("platform\\mods");
|
||||
@ -28,7 +31,10 @@ void CModSystem::Init()
|
||||
continue;
|
||||
|
||||
fs::path basePath = it.path();
|
||||
|
||||
if (modsystem_debug->GetBool())
|
||||
DevMsg(eDLL_T::ENGINE, "Found mod at '%s'.\n", basePath.string().c_str());
|
||||
|
||||
fs::path settingsPath = basePath / "mod.vdf";
|
||||
|
||||
if (fs::exists(settingsPath))
|
||||
@ -141,7 +147,9 @@ CModSystem::ModInstance_t::ModInstance_t(const fs::path& basePath) : m_szName(st
|
||||
auto& enabledList = g_pModSystem->GetEnabledList();
|
||||
if (enabledList.count(idHash) == 0)
|
||||
{
|
||||
if (modsystem_debug->GetBool())
|
||||
DevMsg(eDLL_T::ENGINE, "Mod does not exist in 'mods.vdf'. Enabling...\n");
|
||||
|
||||
SetState(eModState::ENABLED);
|
||||
}
|
||||
else
|
||||
@ -149,6 +157,7 @@ CModSystem::ModInstance_t::ModInstance_t(const fs::path& basePath) : m_szName(st
|
||||
bool bEnable = enabledList[idHash];
|
||||
SetState(bEnable ? eModState::ENABLED : eModState::DISABLED);
|
||||
|
||||
if (modsystem_debug->GetBool())
|
||||
DevMsg(eDLL_T::ENGINE, "Mod exists in 'mods.vdf' and is %s.\n", bEnable ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user