SourceMM::ISmmPlugin Class Reference

Callbacks that a plugin must expose.

#include <ISmmPlugin.h>

List of all members.

Public Member Functions

virtual int GetApiVersion ()
 Called to request the plugin's API version.
virtual ~ISmmPlugin ()
 Virtual destructor so GCC doesn't complain.
virtual bool Load (PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late)=0
 Called on plugin load.
virtual void AllPluginsLoaded ()
 Called when all plugins have been loaded.
virtual bool QueryRunning (char *error, size_t maxlen)
 Called when your plugin is "queried".
virtual bool Unload (char *error, size_t maxlen)
 Called on plugin unload. You can return false if you know your plugin is not capable of restoring critical states it modifies.
virtual bool Pause (char *error, size_t maxlen)
 Called on plugin pause.
virtual bool Unpause (char *error, size_t maxlen)
 Called on plugin unpause.
virtual const char * GetAuthor ()=0
 Return author as string.
virtual const char * GetName ()=0
 Return plugin name as string.
virtual const char * GetDescription ()=0
 Return a description as string.
virtual const char * GetURL ()=0
 Return a URL as string.
virtual const char * GetLicense ()=0
 Return quick license code as string.
virtual const char * GetVersion ()=0
 Return version as string.
virtual const char * GetDate ()=0
 Return author as string.
virtual const char * GetLogTag ()=0
 Return author as string.


Detailed Description

Definition at line 50 of file ISmmPlugin.h.


Member Function Documentation

virtual int SourceMM::ISmmPlugin::GetApiVersion (  )  [inline, virtual]

This is the first callback invoked, and always remains at the top of the virtual table.

Returns:
Plugin API version.

Definition at line 61 of file ISmmPlugin.h.

virtual bool SourceMM::ISmmPlugin::Load ( PluginId  id,
ISmmAPI ismm,
char *  error,
size_t  maxlength,
bool  late 
) [pure virtual]

This is called as DLLInit() executes - after the parameters are known, but before the original GameDLL function is called. Therefore, you cannot hook it, but you don't need to - Load() is basically your hook. You can override factories before the engine and gamedll exchange them. However, take care to note that if your plugin is unloaded, and the gamedll/engine have cached an interface you've passed, something will definitely crash. Be careful.

Parameters:
id Internal id of plugin. Saved globally by PLUGIN_SAVEVARS()
ismm External API for SourceMM. Saved globally by PLUGIN_SAVEVARS()
error Error message buffer
maxlength Size of error message buffer
late Set to true if your plugin was loaded late (not at server load).
Returns:
True if successful, return false to reject the load.

virtual void SourceMM::ISmmPlugin::AllPluginsLoaded (  )  [inline, virtual]

This is called after DLLInit(), and thus the mod has been mostly initialized. It is also safe to assume that all other (automatically loaded) plugins are now ready to start interacting, because they are all loaded.

Definition at line 101 of file ISmmPlugin.h.

virtual bool SourceMM::ISmmPlugin::QueryRunning ( char *  error,
size_t  maxlen 
) [inline, virtual]

This is useful for rejecting a loaded state. For example, if your plugin wants to stop operating, it can simply return false and copy an error message. This will notify other plugins or MM:S of something bad that happened. MM:S will not cache the return state, so if you return false, your plugin will not actually be paused or unloaded. This callback will be called when:

  • Another plugin requests it
  • Someone types "meta list", it will show up as "REFUSED"
  • When Metamod need to re-check the plugin's status
  • If the plugin does something like overload a factory, Metamod will make sure the Query() returns true before calling it. Also note that this query will only override Metamod when the plugin is running and not paused.

Parameters:
error Buffer for error message, or NULL if none.
maxlen Maximum length of error buffer.
Returns:
Status code - true for okay, false for badness.

Definition at line 126 of file ISmmPlugin.h.

virtual bool SourceMM::ISmmPlugin::Unload ( char *  error,
size_t  maxlen 
) [inline, virtual]

Parameters:
error Error message buffer
maxlen Size of error message buffer
Returns:
True on success, return false to request no unload.

Definition at line 139 of file ISmmPlugin.h.

virtual bool SourceMM::ISmmPlugin::Pause ( char *  error,
size_t  maxlen 
) [inline, virtual]

Parameters:
error Error message buffer
maxlen Size of error message buffer
Returns:
True on success, return false to request no pause.

Definition at line 151 of file ISmmPlugin.h.

virtual bool SourceMM::ISmmPlugin::Unpause ( char *  error,
size_t  maxlen 
) [inline, virtual]

Parameters:
error Error message buffer
maxlen Size of error message buffer
Returns:
True on success, return false to request no unpause.

Definition at line 163 of file ISmmPlugin.h.


The documentation for this class was generated from the following file:

Generated on Mon Feb 18 18:10:28 2008 for Metamod:Source by  doxygen 1.5.5