public/IGameHelpers.h
author Phong Dang <teame06@gmail.com>
Wed Aug 01 07:29:40 2007 +0000 (2007-08-01)
changeset 1241 2e8046793bc9
parent 1226 478550a4d5ec
child 1330 ab94316bb52b
permissions -rw-r--r--
Added check to make sure player are alive to perform sm_slap, sm_burn, sm_slay.
     1 /**
     2  * vim: set ts=4 :
     3  * ================================================================
     4  * SourceMod
     5  * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
     6  * ================================================================
     7  *
     8  * This program is free software; you can redistribute it and/or 
     9  * modify it under the terms of the GNU General Public License, 
    10  * version 3.0, as published by the Free Software Foundation.
    11  * 
    12  * This program is distributed in the hope that it will be useful,
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15  * GNU General Public License for more details.
    16  *
    17  * You should have received a copy of the GNU General Public License
    18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    19  *
    20  * As a special exception, AlliedModders LLC gives you permission to 
    21  * link the code of this program (as well as its derivative works) to 
    22  * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any 
    23  * Game MODs that run on software by the Valve Corporation.  You must 
    24  * obey the GNU General Public License in all respects for all other 
    25  * code used. Additionally, AlliedModders LLC grants this exception 
    26  * to all derivative works. AlliedModders LLC defines further 
    27  * exceptions, found in LICENSE.txt (as of this writing, version 
    28  * JULY-31-2007), or <http://www.sourcemod.net/license.php>.
    29  *
    30  * Version: $Id$
    31  */
    32 
    33 #ifndef _INCLUDE_SOURCEMOD_GAMEHELPERS_H_
    34 #define _INCLUDE_SOURCEMOD_GAMEHELPERS_H_
    35 
    36 #include <IShareSys.h>
    37 #include <dt_send.h>
    38 #include <server_class.h>
    39 #include <datamap.h>
    40 #include <edict.h>
    41 
    42 #define SMINTERFACE_GAMEHELPERS_NAME		"IGameHelpers"
    43 #define SMINTERFACE_GAMEHELPERS_VERSION		1
    44 
    45 /**
    46  * @file IGameHelpers.h
    47  * @brief Provides Source helper functions.
    48  */
    49 
    50 namespace SourceMod
    51 {
    52 	class IGameHelpers : public SMInterface
    53 	{
    54 	public:
    55 		virtual const char *GetInterfaceName()
    56 		{
    57 			return SMINTERFACE_GAMEHELPERS_NAME;
    58 		}
    59 		virtual unsigned int GetInterfaceVersion()
    60 		{
    61 			return SMINTERFACE_GAMEHELPERS_VERSION;
    62 		}
    63 	public:
    64 		/**
    65 		 * @brief Finds a send property in a named send table.
    66 		 *
    67 		 * @param classname		Top-level sendtable name.
    68 		 * @param offset		Property name.
    69 		 * @return				SendProp pointer on success, NULL on failure.
    70 		 */
    71 		virtual SendProp *FindInSendTable(const char *classname, const char *offset) =0;
    72 
    73 		/**
    74 		 * @brief Finds a named server class.
    75 		 *
    76 		 * @return				ServerClass pointer on success, NULL on failure.
    77 		 */
    78 		virtual ServerClass *FindServerClass(const char *classname) =0;
    79 
    80 		/**
    81 		 * @brief Finds a datamap_t definition.
    82 		 *
    83 		 * @param pMap			datamap_t pointer.
    84 		 * @param offset		Property name.
    85 		 * @return				typedescription_t pointer on success, NULL 
    86 		 *						on failure.
    87 		 */
    88 		virtual typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset) =0;
    89 
    90 		/**
    91 		 * @brief Retrieves an entity's datamap_t pointer.
    92 		 *
    93 		 * @param pEntity		CBaseEntity entity.
    94 		 * @return				datamap_t pointer, or NULL on failure.
    95 		 */
    96 		virtual datamap_t *GetDataMap(CBaseEntity *pEntity) =0;
    97 
    98 		/**
    99 		 * @brief Marks an edict as state changed for an offset.
   100 		 *
   101 		 * @param pEdict		Edict pointer.
   102 		 * @param offset		Offset index.
   103 		 */
   104 		virtual void SetEdictStateChanged(edict_t *pEdict, unsigned short offset) =0;
   105 
   106 		/**
   107 		 * @brief Sends a text message to a client.
   108 		 *
   109 		 * @param client		Client index.
   110 		 * @param dest			Destination on the HUD.
   111 		 * @param msg			Message to send.
   112 		 * @return				True on success, false on failure.
   113 		 */
   114 		virtual bool TextMsg(int client, int dest, const char *msg) =0;
   115 	};
   116 }
   117 
   118 #endif //_INCLUDE_SOURCEMOD_GAMEHELPERS_H_