1515#include " patch-hook.hpp"
1616
1717/* *
18- * @brief The plugin is a static singleton that is exported as an interface. Max plugin interface version Portal 2 uses is 3.
18+ * @brief The plugin is a static singleton that is exported as an interface. Highest plugin interface version Portal 2 uses is version 3.
1919 */
2020EXPOSE_SINGLE_INTERFACE_GLOBALVAR (CP2SMPlusPlusPlugin, IServerPluginCallbacks, " ISERVERPLUGINCALLBACKS003" , g_P2SMPlusPlusPlugin);
2121
2222/* *
23- * @brief Constructor
23+ * @brief Plugin class constructor.
2424 */
2525CP2SMPlusPlusPlugin::CP2SMPlusPlusPlugin ()
2626{
@@ -32,25 +32,19 @@ CP2SMPlusPlusPlugin::CP2SMPlusPlusPlugin()
3232}
3333
3434/* *
35- * @brief Destructor
35+ * @brief Plugin class destructor.
3636 */
3737CP2SMPlusPlusPlugin::~CP2SMPlusPlusPlugin ()
3838{
3939 this ->debugID = EVENT_DEBUG_ID_SHUTDOWN;
4040}
4141
42- // ---------------------------------------------------------------------------------
43- // Purpose: Description of plugin outputted when the "plugin_print" console command is executed.
44- // ---------------------------------------------------------------------------------
45- const char * CP2SMPlusPlusPlugin::GetPluginDescription ()
46- {
47- return " P2SourceModPlusPlus Plugin | Plugin Version: " P2SMPLUSPLUS_PLUGIN_VERSION;
48- }
49-
50- // ---------------------------------------------------------------------------------
51- // Purpose: Called when the plugin is loaded, initialization process.
52- // Loads the interfaces we need from the engine and applies our patches.
53- // ---------------------------------------------------------------------------------
42+ /* *
43+ * @brief Called when the plugin is loaded, the primary initialization process for the plugin.
44+ * @param interfaceFactory Interface factory to get game interfaces.
45+ * @param gameServerFactory Game server interface factory to get other game interfaces.
46+ * @return True if plugin started correctly.
47+ */
5448bool CP2SMPlusPlusPlugin::Load (CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory)
5549{
5650 if (pluginLoaded)
@@ -185,9 +179,9 @@ bool CP2SMPlusPlusPlugin::Load(CreateInterfaceFn interfaceFactory, CreateInterfa
185179 return true ;
186180}
187181
188- // ---------------------------------------------------------------------------------
189- // Purpose: Called when the plugin is turning off/unloading .
190- // ---------------------------------------------------------------------------------
182+ /* *
183+ * @brief Called when the plugin is shutting down. Also called when the plugin fails to load .
184+ */
191185void CP2SMPlusPlusPlugin::Unload ()
192186{
193187 // If the plugin errors for some reason, prevent it from unloading.
@@ -256,30 +250,56 @@ void CP2SMPlusPlusPlugin::Unload()
256250 Log (INFO, false , " Plugin unloaded! Goodbye!" );
257251}
258252
253+ void CP2SMPlusPlusPlugin::Pause () {}
254+
255+ void CP2SMPlusPlusPlugin::UnPause () {}
256+
257+ /* *
258+ * @brief Description of plugin outputted when the "plugin_print" console command is executed.
259+ * @return Plugin description.
260+ */
261+ const char * CP2SMPlusPlusPlugin::GetPluginDescription ()
262+ {
263+ return " P2SourceModPlusPlus Plugin | Plugin Version: " P2SMPLUSPLUS_PLUGIN_VERSION;
264+ }
265+
266+ void CP2SMPlusPlusPlugin::LevelInit (const char * mapName) {}
267+
268+ void CP2SMPlusPlusPlugin::ServerActivate (Edict* edictList, int edictCount, int clientMax) {}
269+
270+ void CP2SMPlusPlusPlugin::GameFrame (bool simulating) {}
271+
272+ void CP2SMPlusPlusPlugin::LevelShutdown () {}
273+
274+ void CP2SMPlusPlusPlugin::ClientActive (Edict* edict) {}
275+
276+ /* *
277+ * @brief Player has fully connected to the server, but the player entity isn't fully initialized yet.
278+ * @param edict Edict of player that has fully connected.
279+ */
259280void CP2SMPlusPlusPlugin::ClientFullyConnect (Edict* edict)
260281{
261282 // Make sure the r_drawscreenoverlay ConVar is enabled for connecting clients.
262283 engineServer->ClientCommand (edict, " r_drawscreenoverlay 1" );
263284 Log (WARNING, true , " r_drawscreenoverlay enabled for client." );
264285}
265286
266- // ---------------------------------------------------------------------------------
267- // Purpose: Unused callbacks
268- // ---------------------------------------------------------------------------------
269- #pragma region UNUSED_CALLBACKS
270- void Pause () {}
271- void UnPause () {}
272- void ServerActivate (Edict* edictList, int edictCount, int clientMax) {}
273- void GameFrame (bool simulating) {}
274- void ClientActive (Edict* edict) {}
275- void ClientDisconnect (Edict* edict) {}
276- void ClientPutInServer (Edict* edict, char const * playerName) {}
277- void SetCommandClient (int index) {}
278- void ClientSettingsChanged (Edict* edict) {}
279- PluginResult ClientConnect (bool * allowConnect, Edict* edict, const char * name, const char * ipAddress, char * reject, int maxRejectLen) { return PluginResult::Continue; }
280- PluginResult ClientCommand (Edict* edict, const CCommand& args) { return PluginResult::Continue; }
281- PluginResult NetworkIDValidated (const char * username, const char * networkID) { return PluginResult::Continue; }
282- void OnQueryCvarValueFinished (QueryCvarCookie cookie, Edict* edict, QueryCvarValueStatus status, const char * cvarName, const char * cvarValue) {}
283- void OnEdictAllocated (Edict* edict) {}
284- void OnEdictFreed (const Edict* edict) {}
285- #pragma endregion
287+ void CP2SMPlusPlusPlugin::ClientDisconnect (Edict* edict) {}
288+
289+ void CP2SMPlusPlusPlugin::ClientPutInServer (Edict* edict, char const * playerName) {}
290+
291+ void CP2SMPlusPlusPlugin::SetCommandClient (int index) {}
292+
293+ void CP2SMPlusPlusPlugin::ClientSettingsChanged (Edict* edict) {}
294+
295+ PluginResult CP2SMPlusPlusPlugin::ClientConnect (bool * allowConnect, Edict* edict, const char * name, const char * ipAddress, char * reject, int maxRejectLen) { return PluginResult::Continue; }
296+
297+ PluginResult CP2SMPlusPlusPlugin::ClientCommand (Edict* edict, const CCommand& args) { return PluginResult::Continue; }
298+
299+ PluginResult CP2SMPlusPlusPlugin::NetworkIDValidated (const char * username, const char * networkID) { return PluginResult::Continue; }
300+
301+ void CP2SMPlusPlusPlugin::OnQueryCvarValueFinished (QueryCvarCookie cookie, Edict* edict, QueryCvarValueStatus status, const char * cvarName, const char * cvarValue) {}
302+
303+ void CP2SMPlusPlusPlugin::OnEdictAllocated (Edict* edict) {}
304+
305+ void CP2SMPlusPlusPlugin::OnEdictFreed (const Edict* edict) {}
0 commit comments