| 126 | } |
| 127 | |
| 128 | void ChatTriggers::OnSourceModGameInitialized() |
| 129 | { |
| 130 | ConCommand *say_team = FindCommand("say_team"); |
| 131 | |
| 132 | CommandHook::Callback pre_hook = [this] (int client, const ICommandArgs *args) -> bool { |
| 133 | return this->OnSayCommand_Pre(client, args); |
| 134 | }; |
| 135 | CommandHook::Callback post_hook = [this] (int client, const ICommandArgs *args) -> bool { |
| 136 | return this->OnSayCommand_Post(client, args); |
| 137 | }; |
| 138 | |
| 139 | if (ConCommand *say = FindCommand("say")) { |
| 140 | hooks_.push_back(sCoreProviderImpl.AddCommandHook(say, pre_hook)); |
| 141 | hooks_.push_back(sCoreProviderImpl.AddPostCommandHook(say, post_hook)); |
| 142 | } |
| 143 | if (ConCommand *say_team = FindCommand("say_team")) { |
| 144 | hooks_.push_back(sCoreProviderImpl.AddCommandHook(say_team, pre_hook)); |
| 145 | hooks_.push_back(sCoreProviderImpl.AddPostCommandHook(say_team, post_hook)); |
| 146 | } |
| 147 | |
| 148 | #if SOURCE_ENGINE == SE_EPISODEONE |
| 149 | m_bIsINS = (strcmp(g_SourceMod.GetGameFolderName(), "insurgency") == 0); |
| 150 | if (m_bIsINS) { |
| 151 | if (ConCommand *say2 = FindCommand("say2")) { |
| 152 | hooks_.push_back(sCoreProviderImpl.AddCommandHook(say2, pre_hook)); |
| 153 | hooks_.push_back(sCoreProviderImpl.AddPostCommandHook(say2, post_hook)); |
| 154 | } |
| 155 | } |
| 156 | #elif SOURCE_ENGINE == SE_NUCLEARDAWN |
| 157 | if (ConCommand *say_squad = FindCommand("say_squad")) { |
| 158 | hooks_.push_back(sCoreProviderImpl.AddCommandHook(say_squad, pre_hook)); |
| 159 | hooks_.push_back(sCoreProviderImpl.AddPostCommandHook(say_squad, post_hook)); |
| 160 | } |
| 161 | #endif |
| 162 | } |
| 163 | |
| 164 | void ChatTriggers::OnSourceModShutdown() |
| 165 | { |
nothing calls this directly
no test coverage detected