2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-01-13 15:18:19 +03:00

Added clientmeta option

This commit is contained in:
asmodai 2017-03-11 19:12:09 +03:00
parent 3674c3e946
commit 29b0f402f1
4 changed files with 21 additions and 3 deletions

View File

@ -36,6 +36,7 @@ public:
int m_debuglevel; // to use for meta_debug
char *m_gamedll; // string if specified in config.ini
char *m_exec_cfg; // ie exec.cfg
int m_clientmeta;
private:
option_t *m_list;

View File

@ -22,6 +22,7 @@ void MM_PRE_HOOK EXT_FUNC mm_ClientDisconnect(edict_t *pEntity)
g_players.clear_player_cvar_query(pEntity);
}
// this forward can be disabled from metamod.cpp
void MM_PRE_HOOK mm_ClientCommand(edict_t *pEntity)
{
if (!strcmp(CMD_ARGV(0), "meta")) {
@ -281,3 +282,8 @@ void compile_gamedll_callbacks()
compile_dllfunc_callbacks();
compile_newdllfunc_callbacks();
}
void disable_clientcommand_fwd()
{
g_dllfunc_cdata[offsetof(DLL_FUNCTIONS, pfnClientCommand) / sizeof(int)].mm_hook = 0;
}

View File

@ -14,4 +14,5 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *in
#ifdef METAMOD_CORE
void compile_gamedll_callbacks();
void disable_clientcommand_fwd();
#endif

View File

@ -7,11 +7,12 @@ MConfig *g_config = &g_static_config;
option_t g_global_options[] =
{
{ "debuglevel", CF_INT, &g_config->m_debuglevel, "0" },
{ "gamedll", CF_PATH, &g_config->m_gamedll, NULL },
{ "exec_cfg", CF_STR, &g_config->m_exec_cfg, NULL },
{ "gamedll", CF_PATH, &g_config->m_gamedll, nullptr },
{ "exec_cfg", CF_STR, &g_config->m_exec_cfg, nullptr },
{ "clientmeta", CF_BOOL, &g_config->m_clientmeta, false },
// list terminator
{ NULL, CF_NONE, NULL, NULL }
{ nullptr, CF_NONE, nullptr, nullptr }
};
gamedll_t g_GameDLL;
@ -139,11 +140,20 @@ void metamod_startup()
g_config->set("exec_cfg", cp);
}
if ((cp = LOCALINFO("mm_clientmeta")) && *cp != '\0')
{
META_LOG("Clientmeta specified via localinfo: %s", cp);
g_config->set("clientmeta", cp);
}
// Check for an initial debug level, since cfg files don't get exec'd
// until later.
if (g_config->m_debuglevel != 0)
CVAR_SET_FLOAT("meta_debug", g_config->m_debuglevel);
if (!g_config->m_clientmeta)
disable_clientcommand_fwd();
// Prepare for registered commands from plugins.
g_regCmds = new MRegCmdList();
g_regCvars = new MRegCvarList();