1.1 --- a/sourcemm/ISmmPlugin.h Thu Feb 08 11:44:11 2007 +0000
1.2 +++ b/sourcemm/ISmmPlugin.h Sat Feb 10 00:31:34 2007 +0000
1.3 @@ -20,7 +20,7 @@
1.4 #include <sourcehook/sourcehook.h>
1.5 #include "ISmmAPI.h"
1.6
1.7 -#define PLAPI_VERSION 9
1.8 +#define PLAPI_VERSION 10
1.9 #define PLAPI_NAME "ISmmPlugin"
1.10
1.11 class ISmmAPI;
1.12 @@ -150,52 +150,172 @@
1.13 public:
1.14 virtual ~IMetamodListener() { }
1.15 public:
1.16 + /**
1.17 + * @brief Called when a plugin is loaded.
1.18 + *
1.19 + * @param id Id of the plugin.
1.20 + */
1.21 virtual void OnPluginLoad(PluginId id) { }
1.22
1.23 + /**
1.24 + * @brief Called when a plugin is unloaded.
1.25 + *
1.26 + * @param id Id of the plugin.
1.27 + */
1.28 virtual void OnPluginUnload(PluginId id) { }
1.29
1.30 + /**
1.31 + * @brief Called when a plugin is paused.
1.32 + *
1.33 + * @param id Id of the plugin.
1.34 + */
1.35 virtual void OnPluginPause(PluginId id) { }
1.36
1.37 + /**
1.38 + * @brief Called when a plugin is unpaused.
1.39 + *
1.40 + * @param id Id of the plugin.
1.41 + */
1.42 virtual void OnPluginUnpause(PluginId id) { }
1.43
1.44 + /**
1.45 + * @brief Called when the level is loaded (after GameInit, before ServerActivate).
1.46 + *
1.47 + * To override this, hook IServerGameDLL::LevelInit().
1.48 + *
1.49 + * @param pMapName Name of the map.
1.50 + * @param pMapEntities Lump string of the map entities, in KeyValue format.
1.51 + * @param pOldLevel Unknown.
1.52 + * @param pLandmarkName Unknown.
1.53 + * @param loadGame Unknown.
1.54 + * @param background Unknown.
1.55 + */
1.56 virtual void OnLevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) { }
1.57
1.58 + /**
1.59 + * @brief Called when the level is shut down. May be called more than once.
1.60 + */
1.61 virtual void OnLevelShutdown() { }
1.62
1.63 + /**
1.64 + * @brief Called when engineFactory() is used through Metamod:Source's wrapper.
1.65 + * This can be used to provide interfaces to other plugins or the GameDLL.
1.66 + *
1.67 + * If ret is passed, you should fill it with IFACE_OK or IFACE_FAILED.
1.68 + *
1.69 + * @param iface Interface string.
1.70 + * @param ret Optional pointer to store return code.
1.71 + * @return Generic pointer to the interface, or NULL if not found.
1.72 + */
1.73 virtual void *OnEngineQuery(const char *iface, int *ret)
1.74 {
1.75 if (ret)
1.76 + {
1.77 *ret = IFACE_FAILED;
1.78 + }
1.79 +
1.80 return NULL;
1.81 }
1.82
1.83 + /**
1.84 + * @brief Called when the physics factory is used through Metamod:Source's wrapper.
1.85 + * This can be used to provide interfaces to other plugins.
1.86 + *
1.87 + * If ret is passed, you should fill it with IFACE_OK or IFACE_FAILED.
1.88 + *
1.89 + * @param iface Interface string.
1.90 + * @param ret Optional pointer to store return code.
1.91 + * @return Generic pointer to the interface, or NULL if not found.
1.92 + */
1.93 virtual void *OnPhysicsQuery(const char *iface, int *ret)
1.94 {
1.95 if (ret)
1.96 + {
1.97 *ret = IFACE_FAILED;
1.98 + }
1.99 +
1.100 return NULL;
1.101 }
1.102
1.103 + /**
1.104 + * @brief Called when the filesystem factory is used through Metamod:Source's wrapper.
1.105 + * This can be used to provide interfaces to other plugins.
1.106 + *
1.107 + * If ret is passed, you should fill it with IFACE_OK or IFACE_FAILED.
1.108 + *
1.109 + * @param iface Interface string.
1.110 + * @param ret Optional pointer to store return code.
1.111 + * @return Generic pointer to the interface, or NULL if not found.
1.112 + */
1.113 virtual void *OnFileSystemQuery(const char *iface, int *ret)
1.114 {
1.115 if (ret)
1.116 + {
1.117 *ret = IFACE_FAILED;
1.118 + }
1.119 +
1.120 return NULL;
1.121 }
1.122
1.123 + /**
1.124 + * @brief Called when the server DLL's factory is used through Metamod:Source's wrapper.
1.125 + * This can be used to provide interfaces to other plugins.
1.126 + *
1.127 + * If ret is passed, you should fill it with IFACE_OK or IFACE_FAILED.
1.128 + *
1.129 + * @param iface Interface string.
1.130 + * @param ret Optional pointer to store return code.
1.131 + * @return Generic pointer to the interface, or NULL if not found.
1.132 + */
1.133 virtual void *OnGameDLLQuery(const char *iface, int *ret)
1.134 {
1.135 if (ret)
1.136 + {
1.137 *ret = IFACE_FAILED;
1.138 + }
1.139 +
1.140 return NULL;
1.141 }
1.142
1.143 + /**
1.144 + * @brief Called when Metamod's own factory is invoked.
1.145 + * This can be used to provide interfaces to other plugins.
1.146 + *
1.147 + * If ret is passed, you should fill it with IFACE_OK or IFACE_FAILED.
1.148 + *
1.149 + * @param iface Interface string.
1.150 + * @param ret Optional pointer to store return code.
1.151 + * @return Generic pointer to the interface, or NULL if not found.
1.152 + */
1.153 virtual void *OnMetamodQuery(const char *iface, int *ret)
1.154 {
1.155 if (ret)
1.156 + {
1.157 *ret = IFACE_FAILED;
1.158 + }
1.159 +
1.160 return NULL;
1.161 }
1.162 +
1.163 + /**
1.164 + * @brief Called when Metamod:Source acquires a valid IServerPluginCallbacks
1.165 + * pointer to be used for hooking by plugins.
1.166 + *
1.167 + * This will only be called after a call to ISmmAPI::EnableVSPListener().
1.168 + * If called before GameInit, this callback will occur before LevelInit.
1.169 + * Otherwise, it will be called on the first call after that.
1.170 + *
1.171 + * This callback is provided to all plugins regardless of which (or how many)
1.172 + * called EnableVSPListener(), but only if at least one did in fact enable it.
1.173 + *
1.174 + * This callback is only available for plugins using API v1:5 (SourceMM 1.4+).
1.175 + *
1.176 + * @param iface Interface pointer. If NULL, then the VSP listening construct
1.177 + * failed to initialize and is not available.
1.178 + */
1.179 + virtual void OnVSPListening(IServerPluginCallbacks *iface)
1.180 + {
1.181 + }
1.182 };
1.183
1.184 #define PL_EXPOSURE CreateInterface