diff --git a/core/metamod.cpp b/core/metamod.cpp index 3967ca0..b388680 100644 --- a/core/metamod.cpp +++ b/core/metamod.cpp @@ -138,12 +138,6 @@ SourceMM::ISmmAPI *g_pMetamod = &g_Metamod; } \ } -void -mm_SetVspInfo(IServerPluginCallbacks *ispc, unsigned int version) -{ - vsp_version = version; -} - /* Initialize everything here */ void mm_InitializeForLoad() @@ -1069,8 +1063,11 @@ int MetamodSource::GetSourceEngineBuild() return engine_build; } -void MetamodSource::NotifyVSPListening(IServerPluginCallbacks *callbacks) +void MetamodSource::NotifyVSPListening(IServerPluginCallbacks *callbacks, int version) { + if (version != -1) + vsp_version = version; + vsp_callbacks = callbacks; ITER_EVENT(OnVSPListening, (callbacks)); } diff --git a/core/metamod.h b/core/metamod.h index 48aa407..5421fa4 100644 --- a/core/metamod.h +++ b/core/metamod.h @@ -97,7 +97,7 @@ public: const char *GetGameBinaryPath(); const char *GetPluginsFile(); void UnregisterConCommandBase(PluginId id, ConCommandBase *pCommand); - void NotifyVSPListening(IServerPluginCallbacks *callbacks); + void NotifyVSPListening(IServerPluginCallbacks *callbacks, int version); void SetGameDLLInfo(CreateInterfaceFn serverFactory, int version, bool loaded); }; @@ -124,9 +124,6 @@ mm_StartupMetamod(bool is_vsp_load); void mm_UnloadMetamod(); -void -mm_SetVspInfo(IServerPluginCallbacks *ispc, unsigned int version); - bool mm_IsVspBridged(); diff --git a/core/provider/vsp_listener.cpp b/core/provider/vsp_listener.cpp index 4c7a498..266e7b5 100644 --- a/core/provider/vsp_listener.cpp +++ b/core/provider/vsp_listener.cpp @@ -146,12 +146,16 @@ bool VSPListener::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gam m_bLoaded = true; SetLoadable(false); - g_Metamod.NotifyVSPListening(this); + g_Metamod.NotifyVSPListening(this, -1); return true; } -void VSPListener::OnQueryCvarValueFinished(QueryCvarCookie_t iCookie, edict_t *pPlayerEntity, EQueryCvarValueStatus eStatus, const char *pCvarName, const char *pCvarValue ) +void VSPListener::OnQueryCvarValueFinished(QueryCvarCookie_t iCookie, + edict_t *pPlayerEntity, + EQueryCvarValueStatus eStatus, + const char *pCvarName, + const char *pCvarValue) { } diff --git a/core/vsp_bridge.cpp b/core/vsp_bridge.cpp index 8f54713..d837812 100644 --- a/core/vsp_bridge.cpp +++ b/core/vsp_bridge.cpp @@ -77,6 +77,7 @@ public: (CreateInterfaceFn)info->engineFactory, (CreateInterfaceFn)info->engineFactory, pGlobals); + g_Metamod.NotifyVSPListening(info->vsp_callbacks, info->vsp_version); mm_StartupMetamod(true); g_plugin_unload = icvar->FindCommand("plugin_unload");