plugins/include/tf2.inc
author Powerlord <rbemrose@gmail.com>
Tue Aug 21 00:44:44 2012 -0400 (2012-08-21)
changeset 3620 bb36770ded54
parent 3576 4fe204b17032
child 3699 360b90d451c7
permissions -rw-r--r--
Updated TFHoliday enum (bug 5436, r=asherkin).
pred@1964
     1
/**
pred@1964
     2
 * vim: set ts=4 :
pred@1964
     3
 * =============================================================================
pred@1964
     4
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
pred@1964
     5
 * =============================================================================
pred@1964
     6
 *
pred@1964
     7
 * This file is part of the SourceMod/SourcePawn SDK.
pred@1964
     8
 *
pred@1964
     9
 * This program is free software; you can redistribute it and/or modify it under
pred@1964
    10
 * the terms of the GNU General Public License, version 3.0, as published by the
pred@1964
    11
 * Free Software Foundation.
pred@1964
    12
 * 
pred@1964
    13
 * This program is distributed in the hope that it will be useful, but WITHOUT
pred@1964
    14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
pred@1964
    15
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
pred@1964
    16
 * details.
pred@1964
    17
 *
pred@1964
    18
 * You should have received a copy of the GNU General Public License along with
pred@1964
    19
 * this program.  If not, see <http://www.gnu.org/licenses/>.
pred@1964
    20
 *
pred@1964
    21
 * As a special exception, AlliedModders LLC gives you permission to link the
pred@1964
    22
 * code of this program (as well as its derivative works) to "Half-Life 2," the
pred@1964
    23
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
pred@1964
    24
 * by the Valve Corporation.  You must obey the GNU General Public License in
pred@1964
    25
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
pred@1964
    26
 * this exception to all derivative works.  AlliedModders LLC defines further
pred@1964
    27
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
pred@1964
    28
 * or <http://www.sourcemod.net/license.php>.
pred@1964
    29
 *
ds@1987
    30
 * Version: $Id$
pred@1964
    31
 */
pred@1964
    32
pred@1963
    33
#if defined _tf2_included
pred@1963
    34
 #endinput
pred@1963
    35
#endif
pred@1963
    36
#define _tf2_included
pred@1963
    37
skamonkey@2943
    38
#define TF_STUNFLAG_SLOWDOWN        (1 << 0)	// activates slowdown modifier
skamonkey@2943
    39
#define TF_STUNFLAG_BONKSTUCK       (1 << 1)	// bonk sound, stuck
skamonkey@2943
    40
#define TF_STUNFLAG_LIMITMOVEMENT   (1 << 2)	// disable forward/backward movement
skamonkey@2943
    41
#define TF_STUNFLAG_CHEERSOUND      (1 << 3)	// cheering sound
skamonkey@2943
    42
#define TF_STUNFLAG_NOSOUNDOREFFECT (1 << 5)	// no sound or particle
skamonkey@2943
    43
#define TF_STUNFLAG_THIRDPERSON     (1 << 6)	// panic animation
skamonkey@2943
    44
#define TF_STUNFLAG_GHOSTEFFECT     (1 << 7)	// ghost particles
skamonkey@2943
    45
skamonkey@2943
    46
#define TF_STUNFLAGS_LOSERSTATE     TF_STUNFLAG_SLOWDOWN|TF_STUNFLAG_NOSOUNDOREFFECT|TF_STUNFLAG_THIRDPERSON
skamonkey@2943
    47
#define TF_STUNFLAGS_GHOSTSCARE     TF_STUNFLAG_GHOSTEFFECT|TF_STUNFLAG_THIRDPERSON
skamonkey@2943
    48
#define TF_STUNFLAGS_SMALLBONK      TF_STUNFLAG_THIRDPERSON|TF_STUNFLAG_SLOWDOWN
skamonkey@2943
    49
#define TF_STUNFLAGS_NORMALBONK     TF_STUNFLAG_BONKSTUCK
skamonkey@2943
    50
#define TF_STUNFLAGS_BIGBONK        TF_STUNFLAG_CHEERSOUND|TF_STUNFLAG_BONKSTUCK
skamonkey@2943
    51
pred@1963
    52
enum TFClassType
pred@1963
    53
{
pred@1963
    54
	TFClass_Unknown = 0,
pred@1963
    55
	TFClass_Scout,
pred@1963
    56
	TFClass_Sniper,
pred@1963
    57
	TFClass_Soldier,
pred@1963
    58
	TFClass_DemoMan,
pred@1963
    59
	TFClass_Medic,
pred@1963
    60
	TFClass_Heavy,
pred@1963
    61
	TFClass_Pyro,
pred@1963
    62
	TFClass_Spy,
pred@1963
    63
	TFClass_Engineer
pred@2018
    64
};
pred@1963
    65
pred@1963
    66
enum TFTeam
pred@1963
    67
{
pred@1963
    68
	TFTeam_Unassigned = 0,
pred@1963
    69
	TFTeam_Spectator = 1,
pred@1963
    70
	TFTeam_Red = 2,
pred@1963
    71
	TFTeam_Blue = 3	
pred@2018
    72
};
pred@1963
    73
skamonkey@2939
    74
enum TFCond
skamonkey@2939
    75
{
skamonkey@2939
    76
	TFCond_Slowed = 0,
skamonkey@2939
    77
	TFCond_Zoomed,
skamonkey@2939
    78
	TFCond_Disguising,
skamonkey@2939
    79
	TFCond_Disguised,
skamonkey@2939
    80
	TFCond_Cloaked,
skamonkey@2939
    81
	TFCond_Ubercharged,
skamonkey@2939
    82
	TFCond_TeleportedGlow,
skamonkey@2939
    83
	TFCond_Taunting,
skamonkey@2939
    84
	TFCond_UberchargeFading,
skamonkey@3174
    85
	TFCond_Unknown1, //9
skamonkey@3174
    86
	TFCond_CloakFlicker = 9,
skamonkey@2939
    87
	TFCond_Teleporting,
skamonkey@2939
    88
	TFCond_Kritzkrieged,
skamonkey@3397
    89
	TFCond_Unknown2, //12
skamonkey@3397
    90
	TFCond_TmpDamageBonus = 12,
skamonkey@2939
    91
	TFCond_DeadRingered,
skamonkey@2939
    92
	TFCond_Bonked,
skamonkey@2939
    93
	TFCond_Dazed,
skamonkey@2939
    94
	TFCond_Buffed,
skamonkey@2939
    95
	TFCond_Charging,
skamonkey@2939
    96
	TFCond_DemoBuff,
skamonkey@3035
    97
	TFCond_CritCola,
skamonkey@3198
    98
	TFCond_InHealRadius,
skamonkey@2939
    99
	TFCond_Healing,
skamonkey@3198
   100
	TFCond_OnFire,
skamonkey@2939
   101
	TFCond_Overhealed,
skamonkey@3087
   102
	TFCond_Jarated,
skamonkey@3125
   103
	TFCond_Bleeding,
skamonkey@3125
   104
	TFCond_DefenseBuffed,
skamonkey@3215
   105
	TFCond_Milked,
laftrykung@3269
   106
	TFCond_MegaHeal,
skamonkey@3215
   107
	TFCond_RegenBuffed,
skamonkey@3308
   108
	TFCond_MarkedForDeath,
skamonkey@3397
   109
	TFCond_NoHealingDamageBuff,
skamonkey@3397
   110
	TFCond_SpeedBuffAlly,
skamonkey@3317
   111
	TFCond_HalloweenCritCandy,
skamonkey@3317
   112
	
laftrykung@3358
   113
	TFCond_CritHype = 36,
laftrykung@3358
   114
	TFCond_CritOnFirstBlood,
laftrykung@3358
   115
	TFCond_CritOnWin,
laftrykung@3358
   116
	TFCond_CritOnFlagCapture,
laftrykung@3358
   117
	TFCond_CritOnKill,
laftrykung@3506
   118
	TFCond_RestrictToMelee,
laftrykung@3506
   119
	
laftrykung@3506
   120
	TFCond_CritMmmph = 44,
laftrykung@3506
   121
	TFCond_DefenseBuffMmmph,
skamonkey@2942
   122
};
skamonkey@2939
   123
skamonkey@3056
   124
enum TFHoliday
skamonkey@3056
   125
{
skamonkey@3434
   126
	TFHoliday_Birthday = 1,
skamonkey@3056
   127
	TFHoliday_Halloween,
skamonkey@3456
   128
	TFHoliday_Christmas,
rbemrose@3576
   129
	TFHoliday_MeetThePyro,
rbemrose@3620
   130
	TFHoliday_MannVsMachine,
skamonkey@3426
   131
	TFHoliday_FullMoon,
skamonkey@3426
   132
	TFHoliday_HalloweenOrFullMoon,
skamonkey@3056
   133
};
skamonkey@3056
   134
erik@3093
   135
enum TFObjectType
erik@3093
   136
{
erik@3093
   137
	TFObject_CartDispenser = 0,
erik@3093
   138
	TFObject_Dispenser = 0,
erik@3093
   139
	TFObject_Teleporter = 1,
erik@3093
   140
	TFObject_Sentry = 2,
erik@3093
   141
	TFObject_Sapper = 3
erik@3093
   142
};
erik@3093
   143
erik@3093
   144
enum TFObjectMode
erik@3093
   145
{
erik@3093
   146
	TFObjectMode_None = 0,
erik@3093
   147
	TFObjectMode_Entrance = 0,
erik@3093
   148
	TFObjectMode_Exit = 1
erik@3093
   149
};
erik@3093
   150
fyrenmoo@2673
   151
/**
fyrenmoo@2673
   152
 * Sets a client on fire for 10 seconds.
fyrenmoo@2673
   153
 *
fyrenmoo@2673
   154
 * @param client		Player's index.
fyrenmoo@2673
   155
 * @noreturn
fyrenmoo@2673
   156
 * @error				Invalid client index, client not in game, or no mod support.
fyrenmoo@2673
   157
 */
fyrenmoo@2673
   158
native TF2_IgnitePlayer(client, target);
pred@1963
   159
pred@1963
   160
/**
pred@1963
   161
 * Respawns a client
pred@1963
   162
 *
pred@1963
   163
 * @param client		Player's index.
pred@1963
   164
 * @noreturn
pred@1963
   165
 * @error				Invalid client index, client not in game, or no mod support.
pred@1963
   166
 */
pred@1963
   167
native TF2_RespawnPlayer(client);
pred@1963
   168
pred@1963
   169
/**
skamonkey@2939
   170
 * Regenerates a client's health and ammunition
skamonkey@2939
   171
 *
skamonkey@2939
   172
 * @param client		Player's index.
skamonkey@2939
   173
 * @noreturn
skamonkey@2939
   174
 * @error				Invalid client index, client not in game, or no mod support.
skamonkey@2939
   175
 */
skamonkey@2939
   176
native TF2_RegeneratePlayer(client);
skamonkey@2939
   177
skamonkey@2939
   178
/**
skamonkey@2939
   179
 * Adds a condition to a player
skamonkey@2939
   180
 *
skamonkey@2939
   181
 * @param client		Player's index.
skamonkey@2939
   182
 * @param condition		Integer identifier of condition to apply.
skamonkey@2939
   183
 * @param duration		Duration of condition (does not apply to all conditions).
skamonkey@2939
   184
 * @noreturn
skamonkey@2939
   185
 * @error				Invalid client index, client not in game, or no mod support.
skamonkey@2939
   186
 */
skamonkey@2939
   187
native TF2_AddCondition(client, TFCond:condition, Float:duration);
skamonkey@2939
   188
skamonkey@2939
   189
/**
skamonkey@2939
   190
 * Removes a condition from a player
skamonkey@2939
   191
 *
skamonkey@2939
   192
 * @param client		Player's index.
skamonkey@2939
   193
 * @param condition		Integer identifier of condition to remove.
skamonkey@2939
   194
 * @noreturn
skamonkey@2939
   195
 * @error				Invalid client index, client not in game, or no mod support.
skamonkey@2939
   196
 */
skamonkey@2939
   197
native TF2_RemoveCondition(client, TFCond:condition);
skamonkey@2939
   198
skamonkey@2939
   199
/**
skamonkey@2939
   200
 * Enables/disables PowerPlay mode on a player.
skamonkey@2939
   201
 *
skamonkey@2939
   202
 * @param client		Player's index.
skamonkey@2939
   203
 * @param enabled		Whether to enable or disable PowerPlay on player.
skamonkey@2939
   204
 * @noreturn
skamonkey@2939
   205
 * @error				Invalid client index, client not in game, or no mod support.
skamonkey@2939
   206
 */
skamonkey@2939
   207
native TF2_SetPlayerPowerPlay(client, bool:enabled);
skamonkey@2939
   208
skamonkey@2939
   209
/**
pred@1963
   210
 * Disguises a client to the given model and team. Only has an effect on spies.
pred@1963
   211
 *
pred@1963
   212
 * Note: This only starts the disguise process and a delay occurs before the spy is fully disguised
pred@1963
   213
 *
pred@1963
   214
 * @param client		Player's index.
pred@1963
   215
 * @param team			Team to disguise the player as (only TFTeam_Red and TFTeam_Blue have an effect)
pred@1963
   216
 * @param class			TFClassType class to disguise the player as
skamonkey@3128
   217
 * @param target		Specific target player to disguise as (0 for any)
pred@1963
   218
 * @noreturn
pred@1963
   219
 * @error				Invalid client index, client not in game, or no mod support.
pred@1963
   220
 */
skamonkey@3128
   221
native TF2_DisguisePlayer(client, TFTeam:team, TFClassType:class, target=0);
pred@1963
   222
pred@1963
   223
/**
pred@1963
   224
 * Removes the current disguise from a client. Only has an effect on spies.
pred@1963
   225
 *
pred@1963
   226
 * @param client		Player's index.
pred@1963
   227
 * @noreturn
pred@1963
   228
 * @error				Invalid client index, client not in game, or no mod support.
pred@1963
   229
 */
pred@1963
   230
native TF2_RemovePlayerDisguise(client);
pred@1963
   231
pred@1963
   232
/**
skamonkey@2943
   233
 * Stuns a client
skamonkey@2943
   234
 *
skamonkey@2943
   235
 * @param client		Player's index.
skamonkey@2943
   236
 * @param float			Duration of stun.
skamonkey@2943
   237
 * @param float			Slowdown percent (as decimal, 0.00-1.00)
skamonkey@2943
   238
 *						(ignored if TF_STUNFLAG_SLOWDOWN is not set.
skamonkey@2943
   239
 * @param int			Stun flags.
skamonkey@2943
   240
 * @param attacker		Attacker's index (0 is allowed for world).
skamonkey@2943
   241
 * @noreturn
skamonkey@2943
   242
 */
skamonkey@2943
   243
native TF2_StunPlayer(client, Float:duration, Float:slowdown=0.0, stunflags, attacker=0);
skamonkey@2943
   244
skamonkey@2943
   245
/**
abkowald@3096
   246
 * Induces the bleed effect on a client
abkowald@3096
   247
 *
abkowald@3096
   248
 * @param client		Player's index.
skamonkey@3272
   249
 * @param attacker		Attacker's index.
abkowald@3096
   250
 * @param float			Duration of bleeding (in seconds).
abkowald@3096
   251
 * @noreturn
abkowald@3096
   252
 */
skamonkey@3272
   253
native TF2_MakeBleed(client, attacker, Float:duration);
abkowald@3096
   254
abkowald@3096
   255
/**
pred@1963
   256
 * Retrieves the entity index of the CPlayerResource entity
pred@1963
   257
 *
pred@1963
   258
 * @return				The current resource entity index.
pred@1963
   259
 */
pred@1963
   260
native TF2_GetResourceEntity();
pred@1963
   261
pred@1963
   262
/**
pred@1963
   263
 * Finds the TFClassType for a given class name.
pred@1963
   264
 *
pred@1963
   265
 * @param classname		A classname string such as "sniper" or "demoman"
pred@1963
   266
 * @return				A TFClassType constant.
pred@1963
   267
 */
pred@1963
   268
native TFClassType:TF2_GetClass(const String:classname[]);
pred@1963
   269
pred@1963
   270
/**
pred@1979
   271
 * Called on weapon fire to decide if the current shot should be critical.
pred@1979
   272
 * Return Plugin_Continue to let the original calculation or return a higher
pred@1979
   273
 * action to override the decision with the value of 'result'
pred@1979
   274
 *
pred@1979
   275
 * @note Since critical shots are also calculated client side any changes made with
pred@1979
   276
 *		 this will not show for the shooter. Projectile weapons such as the rocketlauncher
pred@1979
   277
 *		 and demoman weapons will show a critical bullet but no critical sound effect.
pred@1979
   278
 *		 Bullet hits should appear as expected.
pred@1979
   279
 *
pred@1979
   280
 * @param client		Client Index.
pred@1979
   281
 * @param weapon		Weapon entity Index.
pred@1979
   282
 * @param weaponname	Classname of the weapon.
pred@1979
   283
 * @param result		Buffer param for the result of the decision.
pred@1979
   284
 */
pred@1981
   285
forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result);
pred@1979
   286
pred@1979
   287
/**
skamonkey@3426
   288
 * @deprecated		No longer called. Use TF2_OnIsHolidayActive.
skamonkey@3426
   289
 */
skamonkey@3426
   290
#pragma deprecated No longer called. Use TF2_OnIsHolidayActive.
skamonkey@3426
   291
forward Action:TF2_OnGetHoliday(&TFHoliday:holiday);
skamonkey@3426
   292
skamonkey@3426
   293
/**
skamonkey@3426
   294
 * Called at various times when the game checks to see if the given holiday is active.
skamonkey@3426
   295
 * Return Plugin_Continue to let the original calculation or return a higher
skamonkey@3426
   296
 * action to override the decision with the value of 'result'
skamonkey@3056
   297
 *
skamonkey@3426
   298
 * @param holiday		Holiday being checked.
skamonkey@3426
   299
 * @param result		Buffer param for the result of the decision.
skamonkey@3426
   300
 * @return				Plugin_Continue for original calculation, higher value to use 'result'.
skamonkey@3056
   301
 */
skamonkey@3426
   302
forward Action:TF2_OnIsHolidayActive(TFHoliday:holiday, &bool:result);
skamonkey@3056
   303
skamonkey@3056
   304
/**
tf2@3147
   305
 * Returns whether or not a client (Player) is in a duel.
tf2@3147
   306
 *
tf2@3147
   307
 * @param client    Client Index.
tf2@3147
   308
 * @return          Boolean of whether or not the client/player is dueling.
tf2@3147
   309
 */
tf2@3147
   310
native bool:TF2_IsPlayerInDuel(client);
tf2@3147
   311
tf2@3147
   312
/**
skamonkey@3233
   313
 * Called after a condition is added to a player
skamonkey@3233
   314
 *
skamonkey@3233
   315
 * @param client		Index of the client to which the conditon is being added.
skamonkey@3233
   316
 * @param condition     Condition that is being added.
skamonkey@3233
   317
 * @noreturn
skamonkey@3233
   318
 */
skamonkey@3332
   319
forward TF2_OnConditionAdded(client, TFCond:condition);
skamonkey@3233
   320
skamonkey@3233
   321
/**
skamonkey@3233
   322
 * Called after a condition is removed from a player
skamonkey@3233
   323
 *
skamonkey@3233
   324
 * @param client		Index of the client to which the condition is being removed.
skamonkey@3233
   325
 * @param condition		Condition that is being removed.
skamonkey@3233
   326
 * @noreturn
skamonkey@3233
   327
 */
skamonkey@3233
   328
forward TF2_OnConditionRemoved(client, TFCond:condition);
skamonkey@3233
   329
skamonkey@3233
   330
/**
crimson@3151
   331
 * Called when the server enters the Waiting for Players round state
crimson@3151
   332
 *
crimson@3151
   333
 * @noreturn
crimson@3151
   334
 */
crimson@3151
   335
forward TF2_OnWaitingForPlayersStart();
crimson@3151
   336
crimson@3151
   337
/**
crimson@3151
   338
 * Called when the server exits the Waiting for Players round state
crimson@3151
   339
 *
crimson@3151
   340
 * @noreturn
crimson@3151
   341
 */
crimson@3151
   342
forward TF2_OnWaitingForPlayersEnd();
crimson@3151
   343
crimson@3151
   344
/**
voidedweasel@3533
   345
 * Called when a player attempts to use a teleporter to decide if the player should be allowed to teleport.
voidedweasel@3533
   346
 * Return Plugin_Continue to let the original calculation or return a higher
voidedweasel@3533
   347
 * action to override the decision with the value of 'result'
voidedweasel@3533
   348
 *
voidedweasel@3533
   349
 * @param client		Client index.
voidedweasel@3533
   350
 * @param teleporter	Teleporter entity index.
voidedweasel@3533
   351
 * @param result		Buffer param for the result of the decision.
voidedweasel@3533
   352
 *						This is prepopulated with the game's original decision to let a player teleport.
voidedweasel@3533
   353
 * @return				Plugin_Continue for original calculation, higher value to use 'result'.
voidedweasel@3533
   354
 */
voidedweasel@3533
   355
forward Action:TF2_OnPlayerTeleport(client, teleporter, &bool:result);
voidedweasel@3533
   356
 
voidedweasel@3533
   357
/**
pred@1963
   358
 * Do not edit below this line!
pred@1963
   359
 */
pred@1963
   360
public Extension:__ext_tf2 = 
pred@1963
   361
{
pred@1963
   362
	name = "TF2 Tools",
pred@1963
   363
	file = "game.tf2.ext",
skamonkey@3028
   364
	autoload = 0,
pred@1963
   365
#if defined REQUIRE_EXTENSIONS
pred@1963
   366
	required = 1,
pred@1963
   367
#else
pred@1963
   368
	required = 0,
pred@1963
   369
#endif
pred@1963
   370
};
skamonkey@2976
   371
skamonkey@2976
   372
#if !defined REQUIRE_EXTENSIONS
skamonkey@2976
   373
public __ext_tf2_SetNTVOptional()
skamonkey@2976
   374
{
skamonkey@2976
   375
	MarkNativeAsOptional("TF2_IgnitePlayer");
skamonkey@2976
   376
	MarkNativeAsOptional("TF2_RespawnPlayer");
skamonkey@2976
   377
	MarkNativeAsOptional("TF2_RegeneratePlayer");
skamonkey@2976
   378
	MarkNativeAsOptional("TF2_AddCondition");
skamonkey@2976
   379
	MarkNativeAsOptional("TF2_RemoveCondition");
skamonkey@2976
   380
	MarkNativeAsOptional("TF2_SetPlayerPowerPlay");
skamonkey@2976
   381
	MarkNativeAsOptional("TF2_DisguisePlayer");
skamonkey@2976
   382
	MarkNativeAsOptional("TF2_RemovePlayerDisguise");
skamonkey@2976
   383
	MarkNativeAsOptional("TF2_StunPlayer");
skamonkey@3110
   384
	MarkNativeAsOptional("TF2_MakeBleed");
skamonkey@2976
   385
	MarkNativeAsOptional("TF2_GetResourceEntity");
skamonkey@2976
   386
	MarkNativeAsOptional("TF2_GetClass");
tf2@3147
   387
	MarkNativeAsOptional("TF2_IsPlayerInDuel");
skamonkey@2976
   388
}
skamonkey@2976
   389
#endif