Added ISDKHooks interface with entity listeners (
bug 5602, r=psychonic).
3 * =============================================================================
4 * Source SDK Hooks Extension
5 * Copyright (C) 2010-2012 Nicholas Hastings
6 * Copyright (C) 2009-2010 Erik Minekus
7 * =============================================================================
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, version 3.0, as published by the
11 * Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 * You should have received a copy of the GNU General Public License along with
19 * this program. If not, see <http://www.gnu.org/licenses/>.
21 * As a special exception, AlliedModders LLC gives you permission to link the
22 * code of this program (as well as its derivative works) to "Half-Life 2," the
23 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
24 * by the Valve Corporation. You must obey the GNU General Public License in
25 * all respects for all other code used. Additionally, AlliedModders LLC grants
26 * this exception to all derivative works. AlliedModders LLC defines further
27 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
28 * or <http://www.sourcemod.net/license.php>.
33 #ifndef _INCLUDE_SMEXT_I_SDKHOOKS_H_
34 #define _INCLUDE_SMEXT_I_SDKHOOKS_H_
36 #include <IShareSys.h>
38 #define SMINTERFACE_SDKHOOKS_NAME "ISDKHooks"
39 #define SMINTERFACE_SDKHOOKS_VERSION 1
44 * @brief SDKHooks shared API
51 * @brief Provides callbacks for entity events.
53 class ISMEntityListener
57 * @brief When an entity is created
59 * @param pEntity CBaseEntity entity.
60 * @param classname Entity classname.
62 virtual void OnEntityCreated(CBaseEntity *pEntity, const char *classname)
67 * @brief When an entity is destroyed
69 * @param pEntity CBaseEntity entity.
71 virtual void OnEntityDestroyed(CBaseEntity *pEntity)
77 * @brief SDKHooks API.
79 class ISDKHooks : public SMInterface
82 virtual const char *GetInterfaceName()
84 return SMINTERFACE_SDKHOOKS_NAME;
86 virtual unsigned int GetInterfaceVersion()
88 return SMINTERFACE_SDKHOOKS_VERSION;
92 * @brief Adds an entity listener.
94 * @param listener Pointer to an ISMEntityListener.
96 virtual void AddEntityListener(ISMEntityListener *listener) =0;
99 * @brief Removes an entity listener.
101 * @param listener Pointer to an ISMEntityListener.
103 virtual void RemoveEntityListener(ISMEntityListener *listener) =0;
107 #endif /* _INCLUDE_SMEXT_I_SDKHOOKS_H_ */