plugins/include/core.inc
author David Anderson <dvander@alliedmods.net>
Mon Aug 27 02:00:37 2007 +0000 (2007-08-27)
changeset 1378 115ba755bcdf
parent 1330 ab94316bb52b
child 1735 d6966e3316e9
permissions -rw-r--r--
- implemented amb855 - LogAction()
- changed base plugins to use LogAction() where appropriate
dvander@374
     1
/**
ds@475
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
dvander@374
     4
 * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
ds@1330
     5
 * =============================================================================
ds@1330
     6
 *
ds@1330
     7
 * This file is part of the SourceMod/SourcePawn SDK.
dvander@374
     8
 *
ds@1330
     9
 * This program is free software; you can redistribute it and/or modify it under
ds@1330
    10
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330
    11
 * Free Software Foundation.
ds@1330
    12
 * 
ds@1330
    13
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330
    14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330
    15
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1330
    16
 * details.
ds@1330
    17
 *
ds@1330
    18
 * You should have received a copy of the GNU General Public License along with
ds@1330
    19
 * this program.  If not, see <http://www.gnu.org/licenses/>.
ds@1330
    20
 *
ds@1330
    21
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330
    22
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330
    23
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330
    24
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1330
    25
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1330
    26
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1330
    27
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330
    28
 * or <http://www.sourcemod.net/license.php>.
dvander@374
    29
 *
dvander@374
    30
 * Version: $Id$
dvander@374
    31
 */
dvander@374
    32
dvander@298
    33
#if defined _core_included
dvander@298
    34
 #endinput
dvander@298
    35
#endif
dvander@298
    36
#define _core_included
dvander@298
    37
dvander@572
    38
#include <version>
dvander@572
    39
dvander@572
    40
#define SOURCEMOD_PLUGINAPI_VERSION		2
dvander@298
    41
struct PlVers
dvander@298
    42
{
dvander@298
    43
	version,
dvander@572
    44
	String:filevers[],
dvander@298
    45
};
dvander@298
    46
dvander@483
    47
/**
ds@696
    48
 * Function helper values.
ds@621
    49
 */
ds@621
    50
enum Function
ds@621
    51
{
ds@621
    52
     INVALID_FUNCTION = -1,
ds@621
    53
};
ds@621
    54
ds@621
    55
/**
dvander@483
    56
 * Specifies what to do after a hook completes.
dvander@483
    57
 */
dvander@497
    58
enum Action
dvander@483
    59
{
dvander@483
    60
	Plugin_Continue = 0,	/**< Continue with the original action */
dvander@483
    61
	Plugin_Handled = 3,		/**< Handle the action at the end (don't call it) */
dvander@483
    62
	Plugin_Stop = 4,		/**< Immediately stop the hook chain and handle the original */
dvander@815
    63
};
dvander@483
    64
dvander@1378
    65
/**
dvander@1378
    66
 * Specifies identity types.
dvander@1378
    67
 */
dvander@1378
    68
enum Identity
dvander@1378
    69
{
dvander@1378
    70
	Identity_Core = 0,
dvander@1378
    71
	Identity_Extension = 1,
dvander@1378
    72
	Identity_Plugin = 2
dvander@1378
    73
};
dvander@1378
    74
dvander@298
    75
public PlVers:__version = 
dvander@298
    76
{
dvander@298
    77
	version = SOURCEMOD_PLUGINAPI_VERSION,
dvander@572
    78
	filevers = SOURCEMOD_VERSION
dvander@298
    79
};
dvander@298
    80
dvander@618
    81
/**
dvander@618
    82
 * Plugin status values.
dvander@618
    83
 */
dvander@618
    84
enum PluginStatus
dvander@618
    85
{
dvander@618
    86
	Plugin_Running=0,		/**< Plugin is running */
dvander@618
    87
	/* All states below are "temporarily" unexecutable */
dvander@618
    88
	Plugin_Paused,			/**< Plugin is loaded but paused */
dvander@618
    89
	Plugin_Error,			/**< Plugin is loaded but errored/locked */
dvander@618
    90
	/* All states below do not have all natives */
dvander@618
    91
	Plugin_Loaded,			/**< Plugin has passed loading and can be finalized */
dvander@618
    92
	Plugin_Failed,			/**< Plugin has a fatal failure */
dvander@618
    93
	Plugin_Created,			/**< Plugin is created but not initialized */
dvander@618
    94
	Plugin_Uncompiled,		/**< Plugin is not yet compiled by the JIT */
dvander@618
    95
	Plugin_BadLoad,			/**< Plugin failed to load */
dvander@618
    96
};
dvander@618
    97
dvander@618
    98
/**
dvander@618
    99
 * Plugin information properties.
dvander@618
   100
 */
dvander@618
   101
enum PluginInfo
dvander@618
   102
{
dvander@618
   103
	PlInfo_Name,			/**< Plugin name */
dvander@618
   104
	PlInfo_Author,			/**< Plugin author */
dvander@618
   105
	PlInfo_Description,		/**< Plugin description */
dvander@618
   106
	PlInfo_Version,			/**< Plugin verison */
dvander@618
   107
	PlInfo_URL,				/**< Plugin URL */
dvander@618
   108
};
dvander@618
   109
dvander@619
   110
/**
dvander@619
   111
 * Defines how an extension must expose itself for autoloading.
dvander@619
   112
 */
dvander@298
   113
struct Extension
dvander@298
   114
{
dvander@938
   115
	const String:name[],	/**< Short name */
dvander@938
   116
	const String:file[],	/**< Default file name */
dvander@938
   117
	bool:autoload,			/**< Whether or not to auto-load */
dvander@938
   118
	bool:required,			/**< Whether or not to require */
dvander@298
   119
};
dvander@298
   120
dvander@1092
   121
/**
dvander@1092
   122
 * Defines how a plugin must expose itself for native requiring.
dvander@1092
   123
 */
dvander@1092
   124
struct SharedPlugin
dvander@1092
   125
{
dvander@1092
   126
	const String:name[],	/**< Short name */
dvander@1093
   127
	const String:file[],	/**< File name */
dvander@1092
   128
	bool:required,			/**< Whether or not to require */
dvander@1092
   129
};
dvander@1092
   130
dvander@1000
   131
public Float:NULL_VECTOR[3];		/**< Pass this into certain functions to act as a C++ NULL */
dvander@1000
   132
public const String:NULL_STRING[1];	/**< pass this into certain functions to act as a C++ NULL */
dvander@938
   133
dvander@298
   134
#define AUTOLOAD_EXTENSIONS
dvander@298
   135
#define REQUIRE_EXTENSIONS
dvander@1092
   136
#define REQUIRE_PLUGIN