plugins/include/core.inc
author David Anderson <dvander@alliedmods.net>
Tue Jan 08 03:06:33 2008 +0000 (2008-01-08)
changeset 1839 1f3aaf8fbd12
parent 1735 d6966e3316e9
child 1947 e73a1e51833b
permissions -rw-r--r--
- added amb1332, new cvar protection mechanism for rcon_password
- removed FCVAR_PROTECTED from Core cvars
     1 /**
     2  * vim: set ts=4 :
     3  * =============================================================================
     4  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * =============================================================================
     6  *
     7  * This file is part of the SourceMod/SourcePawn SDK.
     8  *
     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.
    12  * 
    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
    16  * details.
    17  *
    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/>.
    20  *
    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>.
    29  *
    30  * Version: $Id$
    31  */
    32 
    33 #if defined _core_included
    34  #endinput
    35 #endif
    36 #define _core_included
    37 
    38 #include <version>
    39 
    40 #define SOURCEMOD_PLUGINAPI_VERSION		2
    41 struct PlVers
    42 {
    43 	version,
    44 	String:filevers[],
    45 };
    46 
    47 /**
    48  * Function helper values.
    49  */
    50 enum Function
    51 {
    52      INVALID_FUNCTION = -1,
    53 };
    54 
    55 /**
    56  * Specifies what to do after a hook completes.
    57  */
    58 enum Action
    59 {
    60 	Plugin_Continue = 0,	/**< Continue with the original action */
    61 	Plugin_Changed = 1,		/**< Inputs or outputs have been overridden with new values */
    62 	Plugin_Handled = 3,		/**< Handle the action at the end (don't call it) */
    63 	Plugin_Stop = 4,		/**< Immediately stop the hook chain and handle the original */
    64 };
    65 
    66 /**
    67  * Specifies identity types.
    68  */
    69 enum Identity
    70 {
    71 	Identity_Core = 0,
    72 	Identity_Extension = 1,
    73 	Identity_Plugin = 2
    74 };
    75 
    76 public PlVers:__version = 
    77 {
    78 	version = SOURCEMOD_PLUGINAPI_VERSION,
    79 	filevers = SOURCEMOD_VERSION
    80 };
    81 
    82 /**
    83  * Plugin status values.
    84  */
    85 enum PluginStatus
    86 {
    87 	Plugin_Running=0,		/**< Plugin is running */
    88 	/* All states below are "temporarily" unexecutable */
    89 	Plugin_Paused,			/**< Plugin is loaded but paused */
    90 	Plugin_Error,			/**< Plugin is loaded but errored/locked */
    91 	/* All states below do not have all natives */
    92 	Plugin_Loaded,			/**< Plugin has passed loading and can be finalized */
    93 	Plugin_Failed,			/**< Plugin has a fatal failure */
    94 	Plugin_Created,			/**< Plugin is created but not initialized */
    95 	Plugin_Uncompiled,		/**< Plugin is not yet compiled by the JIT */
    96 	Plugin_BadLoad,			/**< Plugin failed to load */
    97 };
    98 
    99 /**
   100  * Plugin information properties.
   101  */
   102 enum PluginInfo
   103 {
   104 	PlInfo_Name,			/**< Plugin name */
   105 	PlInfo_Author,			/**< Plugin author */
   106 	PlInfo_Description,		/**< Plugin description */
   107 	PlInfo_Version,			/**< Plugin verison */
   108 	PlInfo_URL,				/**< Plugin URL */
   109 };
   110 
   111 /**
   112  * Defines how an extension must expose itself for autoloading.
   113  */
   114 struct Extension
   115 {
   116 	const String:name[],	/**< Short name */
   117 	const String:file[],	/**< Default file name */
   118 	bool:autoload,			/**< Whether or not to auto-load */
   119 	bool:required,			/**< Whether or not to require */
   120 };
   121 
   122 /**
   123  * Defines how a plugin must expose itself for native requiring.
   124  */
   125 struct SharedPlugin
   126 {
   127 	const String:name[],	/**< Short name */
   128 	const String:file[],	/**< File name */
   129 	bool:required,			/**< Whether or not to require */
   130 };
   131 
   132 public Float:NULL_VECTOR[3];		/**< Pass this into certain functions to act as a C++ NULL */
   133 public const String:NULL_STRING[1];	/**< pass this into certain functions to act as a C++ NULL */
   134 
   135 #define AUTOLOAD_EXTENSIONS
   136 #define REQUIRE_EXTENSIONS
   137 #define REQUIRE_PLUGIN