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