Tweaked Dota 2 support to account for lack of IPluginHelpers (bug 5656, r=asherkin).
This commit is contained in:
parent
519e8c5fcd
commit
877ef76540
@ -283,7 +283,11 @@ void ChatTriggers::OnSayCommand_Post()
|
|||||||
/* Execute the cached command */
|
/* Execute the cached command */
|
||||||
int client = g_ConCmds.GetCommandClient();
|
int client = g_ConCmds.GetCommandClient();
|
||||||
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
|
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
|
||||||
|
#if SOURCE_ENGINE == SE_DOTA
|
||||||
|
engine->ClientCommand(PEntityOfEntIndex(client), "%s", m_ToExecute);
|
||||||
|
#else
|
||||||
serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
|
serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
|
||||||
|
#endif
|
||||||
SetReplyTo(old);
|
SetReplyTo(old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -614,10 +614,12 @@ QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char
|
|||||||
{
|
{
|
||||||
cookie = engine->StartQueryCvarValue(pPlayer, name);
|
cookie = engine->StartQueryCvarValue(pPlayer, name);
|
||||||
}
|
}
|
||||||
|
#if SOURCE_ENGINE != SE_DOTA
|
||||||
else if (m_bIsVSPQueryHooked)
|
else if (m_bIsVSPQueryHooked)
|
||||||
{
|
{
|
||||||
cookie = serverpluginhelpers->StartQueryCvarValue(pPlayer, name);
|
cookie = serverpluginhelpers->StartQueryCvarValue(pPlayer, name);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return InvalidQueryCvarCookie;
|
return InvalidQueryCvarCookie;
|
||||||
|
@ -733,7 +733,11 @@ void CHalfLife2::ProcessFakeCliCmdQueue()
|
|||||||
if (g_Players.GetClientOfUserId(pFake->userid) == pFake->client)
|
if (g_Players.GetClientOfUserId(pFake->userid) == pFake->client)
|
||||||
{
|
{
|
||||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(pFake->client);
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(pFake->client);
|
||||||
|
#if SOURCE_ENGINE == SE_DOTA
|
||||||
|
engine->ClientCommand(pPlayer->GetEdict(), "%s", pFake->cmd.c_str());
|
||||||
|
#else
|
||||||
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), pFake->cmd.c_str());
|
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), pFake->cmd.c_str());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
m_CmdQueue.pop();
|
m_CmdQueue.pop();
|
||||||
|
@ -65,16 +65,20 @@ bool ValveMenuStyle::OnClientCommand(int client, const char *cmdname, const CCom
|
|||||||
|
|
||||||
void ValveMenuStyle::OnSourceModAllInitialized()
|
void ValveMenuStyle::OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE != SE_DOTA
|
||||||
g_Players.AddClientListener(this);
|
g_Players.AddClientListener(this);
|
||||||
SH_ADD_HOOK(IServerPluginHelpers, CreateMessage, serverpluginhelpers, SH_MEMBER(this, &ValveMenuStyle::HookCreateMessage), false);
|
SH_ADD_HOOK(IServerPluginHelpers, CreateMessage, serverpluginhelpers, SH_MEMBER(this, &ValveMenuStyle::HookCreateMessage), false);
|
||||||
g_pSPHCC = SH_GET_CALLCLASS(serverpluginhelpers);
|
g_pSPHCC = SH_GET_CALLCLASS(serverpluginhelpers);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValveMenuStyle::OnSourceModShutdown()
|
void ValveMenuStyle::OnSourceModShutdown()
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE != SE_DOTA
|
||||||
SH_RELEASE_CALLCLASS(g_pSPHCC);
|
SH_RELEASE_CALLCLASS(g_pSPHCC);
|
||||||
SH_REMOVE_HOOK(IServerPluginHelpers, CreateMessage, serverpluginhelpers, SH_MEMBER(this, &ValveMenuStyle::HookCreateMessage), false);
|
SH_REMOVE_HOOK(IServerPluginHelpers, CreateMessage, serverpluginhelpers, SH_MEMBER(this, &ValveMenuStyle::HookCreateMessage), false);
|
||||||
g_Players.RemoveClientListener(this);
|
g_Players.RemoveClientListener(this);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValveMenuStyle::HookCreateMessage(edict_t *pEdict,
|
void ValveMenuStyle::HookCreateMessage(edict_t *pEdict,
|
||||||
|
@ -1105,7 +1105,11 @@ static cell_t FakeClientCommand(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_DOTA
|
||||||
|
engine->ClientCommand(pPlayer->GetEdict(), "%s", buffer);
|
||||||
|
#else
|
||||||
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), buffer);
|
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), buffer);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -254,6 +254,9 @@ static cell_t IsSoundPrecached(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
static cell_t smn_CreateDialog(IPluginContext *pContext, const cell_t *params)
|
static cell_t smn_CreateDialog(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE == SE_DOTA
|
||||||
|
return pContext->ThrowNativeError("CreateDialog is not supported on this game");
|
||||||
|
#else
|
||||||
KeyValues *pKV;
|
KeyValues *pKV;
|
||||||
HandleError herr;
|
HandleError herr;
|
||||||
Handle_t hndl = static_cast<Handle_t>(params[2]);
|
Handle_t hndl = static_cast<Handle_t>(params[2]);
|
||||||
@ -281,6 +284,7 @@ static cell_t smn_CreateDialog(IPluginContext *pContext, const cell_t *params)
|
|||||||
vsp_interface);
|
vsp_interface);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
#endif // DOTA
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t PrintToChat(IPluginContext *pContext, const cell_t *params)
|
static cell_t PrintToChat(IPluginContext *pContext, const cell_t *params)
|
||||||
|
@ -69,7 +69,9 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
|
|||||||
GET_V_IFACE_CURRENT(GetEngineFactory, engrandom, IUniformRandomStream, VENGINE_SERVER_RANDOM_INTERFACE_VERSION);
|
GET_V_IFACE_CURRENT(GetEngineFactory, engrandom, IUniformRandomStream, VENGINE_SERVER_RANDOM_INTERFACE_VERSION);
|
||||||
GET_V_IFACE_CURRENT(GetFileSystemFactory, basefilesystem, IBaseFileSystem, BASEFILESYSTEM_INTERFACE_VERSION);
|
GET_V_IFACE_CURRENT(GetFileSystemFactory, basefilesystem, IBaseFileSystem, BASEFILESYSTEM_INTERFACE_VERSION);
|
||||||
GET_V_IFACE_CURRENT(GetEngineFactory, enginesound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);
|
GET_V_IFACE_CURRENT(GetEngineFactory, enginesound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);
|
||||||
|
#if SOURCE_ENGINE != SE_DOTA
|
||||||
GET_V_IFACE_CURRENT(GetEngineFactory, serverpluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
GET_V_IFACE_CURRENT(GetEngineFactory, serverpluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* :TODO: Make this optional and... make it find earlier versions [?] */
|
/* :TODO: Make this optional and... make it find earlier versions [?] */
|
||||||
GET_V_IFACE_CURRENT(GetServerFactory, playerinfo, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER);
|
GET_V_IFACE_CURRENT(GetServerFactory, playerinfo, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER);
|
||||||
|
@ -247,7 +247,9 @@ bool SDKTools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool
|
|||||||
GET_V_IFACE_ANY(GetEngineFactory, engsound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);
|
GET_V_IFACE_ANY(GetEngineFactory, engsound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);
|
||||||
GET_V_IFACE_ANY(GetEngineFactory, enginetrace, IEngineTrace, INTERFACEVERSION_ENGINETRACE_SERVER);
|
GET_V_IFACE_ANY(GetEngineFactory, enginetrace, IEngineTrace, INTERFACEVERSION_ENGINETRACE_SERVER);
|
||||||
GET_V_IFACE_ANY(GetEngineFactory, netstringtables, INetworkStringTableContainer, INTERFACENAME_NETWORKSTRINGTABLESERVER);
|
GET_V_IFACE_ANY(GetEngineFactory, netstringtables, INetworkStringTableContainer, INTERFACENAME_NETWORKSTRINGTABLESERVER);
|
||||||
|
#if SOURCE_ENGINE != SE_DOTA
|
||||||
GET_V_IFACE_ANY(GetEngineFactory, pluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
GET_V_IFACE_ANY(GetEngineFactory, pluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
||||||
|
#endif
|
||||||
GET_V_IFACE_ANY(GetServerFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);
|
GET_V_IFACE_ANY(GetServerFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);
|
||||||
GET_V_IFACE_ANY(GetEngineFactory, voiceserver, IVoiceServer, INTERFACEVERSION_VOICESERVER);
|
GET_V_IFACE_ANY(GetEngineFactory, voiceserver, IVoiceServer, INTERFACEVERSION_VOICESERVER);
|
||||||
GET_V_IFACE_ANY(GetServerFactory, playerinfomngr, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER);
|
GET_V_IFACE_ANY(GetServerFactory, playerinfomngr, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER);
|
||||||
|
@ -565,7 +565,11 @@ static cell_t SlapPlayer(IPluginContext *pContext, const cell_t *params)
|
|||||||
/* Force suicide */
|
/* Force suicide */
|
||||||
if (should_slay)
|
if (should_slay)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE == SE_DOTA
|
||||||
|
engine->ClientCommand(pEdict, "kill\n");
|
||||||
|
#else
|
||||||
pluginhelpers->ClientCommand(pEdict, "kill\n");
|
pluginhelpers->ClientCommand(pEdict, "kill\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_frag_offs > 0)
|
if (s_frag_offs > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user