plugins/include/tf2.inc
author Nicholas Hastings <skamonkey@gmail.com>
Fri Nov 04 10:01:33 2011 -0400 (2011-11-04)
changeset 3438 07a1b8a8a2ba
parent 3434 2552e4578863
child 3456 78b3766d8029
permissions -rw-r--r--
Updated TF2_OnIsHolidayActive ret behavior to match doc (bug 5155, r=fyren).
     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 
   121 enum TFHoliday
   122 {
   123 	TFHoliday_Birthday = 1,
   124 	TFHoliday_Halloween,
   125 	TFHoliday_FullMoon,
   126 	TFHoliday_HalloweenOrFullMoon,
   127 };
   128 
   129 enum TFObjectType
   130 {
   131 	TFObject_CartDispenser = 0,
   132 	TFObject_Dispenser = 0,
   133 	TFObject_Teleporter = 1,
   134 	TFObject_Sentry = 2,
   135 	TFObject_Sapper = 3
   136 };
   137 
   138 enum TFObjectMode
   139 {
   140 	TFObjectMode_None = 0,
   141 	TFObjectMode_Entrance = 0,
   142 	TFObjectMode_Exit = 1
   143 };
   144 
   145 /**
   146  * Sets a client on fire for 10 seconds.
   147  *
   148  * @param client		Player's index.
   149  * @noreturn
   150  * @error				Invalid client index, client not in game, or no mod support.
   151  */
   152 native TF2_IgnitePlayer(client, target);
   153 
   154 /**
   155  * Respawns a client
   156  *
   157  * @param client		Player's index.
   158  * @noreturn
   159  * @error				Invalid client index, client not in game, or no mod support.
   160  */
   161 native TF2_RespawnPlayer(client);
   162 
   163 /**
   164  * Regenerates a client's health and ammunition
   165  *
   166  * @param client		Player's index.
   167  * @noreturn
   168  * @error				Invalid client index, client not in game, or no mod support.
   169  */
   170 native TF2_RegeneratePlayer(client);
   171 
   172 /**
   173  * Adds a condition to a player
   174  *
   175  * @param client		Player's index.
   176  * @param condition		Integer identifier of condition to apply.
   177  * @param duration		Duration of condition (does not apply to all conditions).
   178  * @noreturn
   179  * @error				Invalid client index, client not in game, or no mod support.
   180  */
   181 native TF2_AddCondition(client, TFCond:condition, Float:duration);
   182 
   183 /**
   184  * Removes a condition from a player
   185  *
   186  * @param client		Player's index.
   187  * @param condition		Integer identifier of condition to remove.
   188  * @noreturn
   189  * @error				Invalid client index, client not in game, or no mod support.
   190  */
   191 native TF2_RemoveCondition(client, TFCond:condition);
   192 
   193 /**
   194  * Enables/disables PowerPlay mode on a player.
   195  *
   196  * @param client		Player's index.
   197  * @param enabled		Whether to enable or disable PowerPlay on player.
   198  * @noreturn
   199  * @error				Invalid client index, client not in game, or no mod support.
   200  */
   201 native TF2_SetPlayerPowerPlay(client, bool:enabled);
   202 
   203 /**
   204  * Disguises a client to the given model and team. Only has an effect on spies.
   205  *
   206  * Note: This only starts the disguise process and a delay occurs before the spy is fully disguised
   207  *
   208  * @param client		Player's index.
   209  * @param team			Team to disguise the player as (only TFTeam_Red and TFTeam_Blue have an effect)
   210  * @param class			TFClassType class to disguise the player as
   211  * @param target		Specific target player to disguise as (0 for any)
   212  * @noreturn
   213  * @error				Invalid client index, client not in game, or no mod support.
   214  */
   215 native TF2_DisguisePlayer(client, TFTeam:team, TFClassType:class, target=0);
   216 
   217 /**
   218  * Removes the current disguise from a client. Only has an effect on spies.
   219  *
   220  * @param client		Player's index.
   221  * @noreturn
   222  * @error				Invalid client index, client not in game, or no mod support.
   223  */
   224 native TF2_RemovePlayerDisguise(client);
   225 
   226 /**
   227  * Stuns a client
   228  *
   229  * @param client		Player's index.
   230  * @param float			Duration of stun.
   231  * @param float			Slowdown percent (as decimal, 0.00-1.00)
   232  *						(ignored if TF_STUNFLAG_SLOWDOWN is not set.
   233  * @param int			Stun flags.
   234  * @param attacker		Attacker's index (0 is allowed for world).
   235  * @noreturn
   236  */
   237 native TF2_StunPlayer(client, Float:duration, Float:slowdown=0.0, stunflags, attacker=0);
   238 
   239 /**
   240  * Induces the bleed effect on a client
   241  *
   242  * @param client		Player's index.
   243  * @param attacker		Attacker's index.
   244  * @param float			Duration of bleeding (in seconds).
   245  * @noreturn
   246  */
   247 native TF2_MakeBleed(client, attacker, Float:duration);
   248 
   249 /**
   250  * Retrieves the entity index of the CPlayerResource entity
   251  *
   252  * @return				The current resource entity index.
   253  */
   254 native TF2_GetResourceEntity();
   255 
   256 /**
   257  * Finds the TFClassType for a given class name.
   258  *
   259  * @param classname		A classname string such as "sniper" or "demoman"
   260  * @return				A TFClassType constant.
   261  */
   262 native TFClassType:TF2_GetClass(const String:classname[]);
   263 
   264 /**
   265  * Called on weapon fire to decide if the current shot should be critical.
   266  * Return Plugin_Continue to let the original calculation or return a higher
   267  * action to override the decision with the value of 'result'
   268  *
   269  * @note Since critical shots are also calculated client side any changes made with
   270  *		 this will not show for the shooter. Projectile weapons such as the rocketlauncher
   271  *		 and demoman weapons will show a critical bullet but no critical sound effect.
   272  *		 Bullet hits should appear as expected.
   273  *
   274  * @param client		Client Index.
   275  * @param weapon		Weapon entity Index.
   276  * @param weaponname	Classname of the weapon.
   277  * @param result		Buffer param for the result of the decision.
   278  */
   279 forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result);
   280 
   281 /**
   282  * @deprecated		No longer called. Use TF2_OnIsHolidayActive.
   283  */
   284 #pragma deprecated No longer called. Use TF2_OnIsHolidayActive.
   285 forward Action:TF2_OnGetHoliday(&TFHoliday:holiday);
   286 
   287 /**
   288  * Called at various times when the game checks to see if the given holiday is active.
   289  * Return Plugin_Continue to let the original calculation or return a higher
   290  * action to override the decision with the value of 'result'
   291  *
   292  * @param holiday		Holiday being checked.
   293  * @param result		Buffer param for the result of the decision.
   294  * @return				Plugin_Continue for original calculation, higher value to use 'result'.
   295  */
   296 forward Action:TF2_OnIsHolidayActive(TFHoliday:holiday, &bool:result);
   297 
   298 /**
   299  * Returns whether or not a client (Player) is in a duel.
   300  *
   301  * @param client    Client Index.
   302  * @return          Boolean of whether or not the client/player is dueling.
   303  */
   304 native bool:TF2_IsPlayerInDuel(client);
   305 
   306 /**
   307  * Called after a condition is added to a player
   308  *
   309  * @param client		Index of the client to which the conditon is being added.
   310  * @param condition     Condition that is being added.
   311  * @noreturn
   312  */
   313 forward TF2_OnConditionAdded(client, TFCond:condition);
   314 
   315 /**
   316  * Called after a condition is removed from a player
   317  *
   318  * @param client		Index of the client to which the condition is being removed.
   319  * @param condition		Condition that is being removed.
   320  * @noreturn
   321  */
   322 forward TF2_OnConditionRemoved(client, TFCond:condition);
   323 
   324 /**
   325  * Called when the server enters the Waiting for Players round state
   326  *
   327  * @noreturn
   328  */
   329 forward TF2_OnWaitingForPlayersStart();
   330 
   331 /**
   332  * Called when the server exits the Waiting for Players round state
   333  *
   334  * @noreturn
   335  */
   336 forward TF2_OnWaitingForPlayersEnd();
   337 
   338 /**
   339  * Do not edit below this line!
   340  */
   341 public Extension:__ext_tf2 = 
   342 {
   343 	name = "TF2 Tools",
   344 	file = "game.tf2.ext",
   345 	autoload = 0,
   346 #if defined REQUIRE_EXTENSIONS
   347 	required = 1,
   348 #else
   349 	required = 0,
   350 #endif
   351 };
   352 
   353 #if !defined REQUIRE_EXTENSIONS
   354 public __ext_tf2_SetNTVOptional()
   355 {
   356 	MarkNativeAsOptional("TF2_IgnitePlayer");
   357 	MarkNativeAsOptional("TF2_RespawnPlayer");
   358 	MarkNativeAsOptional("TF2_RegeneratePlayer");
   359 	MarkNativeAsOptional("TF2_AddCondition");
   360 	MarkNativeAsOptional("TF2_RemoveCondition");
   361 	MarkNativeAsOptional("TF2_SetPlayerPowerPlay");
   362 	MarkNativeAsOptional("TF2_DisguisePlayer");
   363 	MarkNativeAsOptional("TF2_RemovePlayerDisguise");
   364 	MarkNativeAsOptional("TF2_StunPlayer");
   365 	MarkNativeAsOptional("TF2_MakeBleed");
   366 	MarkNativeAsOptional("TF2_GetResourceEntity");
   367 	MarkNativeAsOptional("TF2_GetClass");
   368 	MarkNativeAsOptional("TF2_IsPlayerInDuel");
   369 }
   370 #endif