plugins/include/sdktools_gamerules.inc
author FlaminSarge <laftrykung@yahoo.com>
Sat May 26 19:17:49 2012 -0400 (2012-05-26)
changeset 3506 210bbfb16156
parent 3333 e247490894a1
child 3608 afa46954ccac
permissions -rw-r--r--
Updated TF2 condition defines (bug 5259, r=psychonic).
skamonkey@3333
     1
/**
skamonkey@3333
     2
 * vim: set ts=4 :
skamonkey@3333
     3
 * =============================================================================
skamonkey@3333
     4
 * SourceMod (C)2004-2011 AlliedModders LLC.  All rights reserved.
skamonkey@3333
     5
 * =============================================================================
skamonkey@3333
     6
 *
skamonkey@3333
     7
 * This file is part of the SourceMod/SourcePawn SDK.
skamonkey@3333
     8
 *
skamonkey@3333
     9
 * This program is free software; you can redistribute it and/or modify it under
skamonkey@3333
    10
 * the terms of the GNU General Public License, version 3.0, as published by the
skamonkey@3333
    11
 * Free Software Foundation.
skamonkey@3333
    12
 * 
skamonkey@3333
    13
 * This program is distributed in the hope that it will be useful, but WITHOUT
skamonkey@3333
    14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
skamonkey@3333
    15
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
skamonkey@3333
    16
 * details.
skamonkey@3333
    17
 *
skamonkey@3333
    18
 * You should have received a copy of the GNU General Public License along with
skamonkey@3333
    19
 * this program.  If not, see <http://www.gnu.org/licenses/>.
skamonkey@3333
    20
 *
skamonkey@3333
    21
 * As a special exception, AlliedModders LLC gives you permission to link the
skamonkey@3333
    22
 * code of this program (as well as its derivative works) to "Half-Life 2," the
skamonkey@3333
    23
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
skamonkey@3333
    24
 * by the Valve Corporation.  You must obey the GNU General Public License in
skamonkey@3333
    25
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
skamonkey@3333
    26
 * this exception to all derivative works.  AlliedModders LLC defines further
skamonkey@3333
    27
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
skamonkey@3333
    28
 * or <http://www.sourcemod.net/license.php>.
skamonkey@3333
    29
 *
skamonkey@3333
    30
 * Version: $Id$
skamonkey@3333
    31
 */
skamonkey@3333
    32
skamonkey@3333
    33
#if defined _sdktools_gamerules_included
skamonkey@3333
    34
  #endinput
skamonkey@3333
    35
#endif
skamonkey@3333
    36
#define _sdktools_gamerules_included
skamonkey@3333
    37
skamonkey@3333
    38
enum RoundState {
skamonkey@3333
    39
	// initialize the game, create teams
skamonkey@3333
    40
	RoundState_Init,
skamonkey@3333
    41
	
skamonkey@3333
    42
	//Before players have joined the game. Periodically checks to see if enough players are ready
skamonkey@3333
    43
	//to start a game. Also reverts to this when there are no active players
skamonkey@3333
    44
	RoundState_Pregame,
skamonkey@3333
    45
	
skamonkey@3333
    46
	//The game is about to start, wait a bit and spawn everyone
skamonkey@3333
    47
	RoundState_StartGame,
skamonkey@3333
    48
	
skamonkey@3333
    49
	//All players are respawned, frozen in place
skamonkey@3333
    50
	RoundState_Preround,
skamonkey@3333
    51
	
skamonkey@3333
    52
	//Round is on, playing normally
skamonkey@3333
    53
	RoundState_RoundRunning,
skamonkey@3333
    54
	
skamonkey@3333
    55
	//Someone has won the round
skamonkey@3333
    56
	RoundState_TeamWin,
skamonkey@3333
    57
	
skamonkey@3333
    58
	//Noone has won, manually restart the game, reset scores
skamonkey@3333
    59
	RoundState_Restart,
skamonkey@3333
    60
	
skamonkey@3333
    61
	//Noone has won, restart the game
skamonkey@3333
    62
	RoundState_Stalemate,
skamonkey@3333
    63
	
skamonkey@3333
    64
	//Game is over, showing the scoreboard etc
skamonkey@3333
    65
	RoundState_GameOver,
skamonkey@3333
    66
	
skamonkey@3333
    67
	//Game is over, doing bonus round stuff
skamonkey@3333
    68
	RoundState_Bonus,
skamonkey@3333
    69
};
skamonkey@3333
    70
skamonkey@3333
    71
/**
skamonkey@3333
    72
 * Retrieves an integer value from a property of the gamerules entity.
skamonkey@3333
    73
 * 
skamonkey@3333
    74
 * @param prop			Property name.
skamonkey@3333
    75
 * @param size			Number of bytes to read (valid values are 1, 2, or 4).
skamonkey@3333
    76
 *						This value is auto-detected, and the size parameter is 
skamonkey@3333
    77
 *						only used as a fallback in case detection fails.
skamonkey@3333
    78
 * @param element		Element # (starting from 0) if property is an array.
skamonkey@3333
    79
 * @return				Value at the given property offset.
skamonkey@3333
    80
 * @error				Not supported.
skamonkey@3333
    81
 */
skamonkey@3333
    82
native GameRules_GetProp(const String:prop[], size=4, element=0);
skamonkey@3333
    83
skamonkey@3333
    84
/**
skamonkey@3333
    85
 * Sets an integer value for a property of the gamerules entity.
skamonkey@3333
    86
 *
skamonkey@3333
    87
 * @param prop			Property name.
skamonkey@3333
    88
 * @param value			Value to set.
skamonkey@3333
    89
 * @param size			Number of bytes to write (valid values are 1, 2, or 4).
skamonkey@3333
    90
 *						This value is auto-detected, and the size parameter is 
skamonkey@3333
    91
 *						only used as a fallback in case detection fails.
skamonkey@3333
    92
 * @param element		Element # (starting from 0) if property is an array.
skamonkey@3333
    93
 * @error				Not supported.
skamonkey@3333
    94
 * @noreturn
skamonkey@3333
    95
 */
skamonkey@3333
    96
native GameRules_SetProp(const String:prop[], any:value, size=4, element=0, bool:changeState=false);
skamonkey@3333
    97
skamonkey@3333
    98
/**
skamonkey@3333
    99
 * Retrieves a float value from a property of the gamerules entity.
skamonkey@3333
   100
 * 
skamonkey@3333
   101
 * @param prop			Property name.
skamonkey@3333
   102
 * @param element		Element # (starting from 0) if property is an array.
skamonkey@3333
   103
 * @return				Value at the given property offset.
skamonkey@3333
   104
 * @error				Not supported.
skamonkey@3333
   105
 */
skamonkey@3333
   106
native Float:GameRules_GetPropFloat(const String:prop[], element=0);
skamonkey@3333
   107
skamonkey@3333
   108
/**
skamonkey@3333
   109
 * Sets a float value for a property of the gamerules entity.
skamonkey@3333
   110
 * 
skamonkey@3333
   111
 * @param prop			Property name.
skamonkey@3333
   112
 * @param value			Value to set.
skamonkey@3333
   113
 * @param element		Element # (starting from 0) if property is an array.
skamonkey@3333
   114
 * @noreturn
skamonkey@3333
   115
 * @error				Not supported.
skamonkey@3333
   116
 */
skamonkey@3333
   117
native GameRules_SetPropFloat(const String:prop[], Float:value, element=0, bool:changeState=false);
skamonkey@3333
   118
skamonkey@3333
   119
/**
skamonkey@3333
   120
 * Retrieves a entity index from a property of the gamerules entity.
skamonkey@3333
   121
 * 
skamonkey@3333
   122
 * @param prop			Property name.
skamonkey@3333
   123
 * @param element		Element # (starting from 0) if property is an array.
skamonkey@3333
   124
 * @return				Entity index at the given property.
skamonkey@3333
   125
 *						If there is no entity, or the entity is not valid, 
skamonkey@3333
   126
 *						then -1 is returned.
skamonkey@3333
   127
 * @error				Not supported.
skamonkey@3333
   128
 */
skamonkey@3333
   129
native GameRules_GetPropEnt(const String:prop[], element=0);
skamonkey@3333
   130
skamonkey@3333
   131
/**
skamonkey@3333
   132
 * Sets an entity index for a property of the gamerules entity.
skamonkey@3333
   133
 * 
skamonkey@3333
   134
 * @param prop			Property name.
skamonkey@3333
   135
 * @param other			Entity index to set, or -1 to unset.
skamonkey@3333
   136
 * @param element		Element # (starting from 0) if property is an array.
skamonkey@3333
   137
 * @noreturn
skamonkey@3333
   138
 * @error				Not supported.
skamonkey@3333
   139
 */
skamonkey@3333
   140
native GameRules_SetPropEnt(const String:prop[], other, element=0, bool:changeState=false);
skamonkey@3333
   141
skamonkey@3333
   142
/**
skamonkey@3333
   143
 * Retrieves a vector of floats from the gamerules entity, given a named network property.
skamonkey@3333
   144
 * 
skamonkey@3333
   145
 * @param prop			Property name.
skamonkey@3333
   146
 * @param vec			Vector buffer to store data in.
skamonkey@3333
   147
 * @param element		Element # (starting from 0) if property is an array.
skamonkey@3333
   148
 * @noreturn
skamonkey@3333
   149
 * @error				Not supported.
skamonkey@3333
   150
 */
skamonkey@3333
   151
native GameRules_GetPropVector(const String:prop[], Float:vec[3], element=0);
skamonkey@3333
   152
skamonkey@3333
   153
/**
skamonkey@3333
   154
 * Sets a vector of floats in the gamerules entity, given a named network property.
skamonkey@3333
   155
 *
skamonkey@3333
   156
 * @param prop			Property name.
skamonkey@3333
   157
 * @param vec			Vector to set.
skamonkey@3333
   158
 * @param element		Element # (starting from 0) if property is an array.
skamonkey@3333
   159
 * @noreturn
skamonkey@3333
   160
 * @error				Not supported.
skamonkey@3333
   161
 */
skamonkey@3333
   162
native GameRules_SetPropVector(const String:prop[], const Float:vec[3], element=0, bool:changeState=false);
skamonkey@3333
   163
skamonkey@3333
   164
/**
skamonkey@3333
   165
 * Gets a gamerules property as a string.
skamonkey@3333
   166
 * 
skamonkey@3333
   167
 * @param prop			Property to use.
skamonkey@3333
   168
 * @param buffer		Destination string buffer.
skamonkey@3333
   169
 * @param maxlen		Maximum length of output string buffer.
skamonkey@3333
   170
 * @return				Number of non-null bytes written.
skamonkey@3333
   171
 * @error				Not supported.
skamonkey@3333
   172
 */
skamonkey@3333
   173
native GameRules_GetPropString(const String:prop[], String:buffer[], maxlen);
skamonkey@3333
   174
skamonkey@3333
   175
/**
skamonkey@3333
   176
 * Sets a gamerules property as a string.
skamonkey@3333
   177
 *
skamonkey@3333
   178
 * @param prop			Property to use.
skamonkey@3333
   179
 * @param buffer		String to set.		
skamonkey@3333
   180
 * @return				Number of non-null bytes written.
skamonkey@3333
   181
 * @error				Not supported.
skamonkey@3333
   182
 */
skamonkey@3333
   183
native GameRules_SetPropString(const String:prop[], const String:buffer[], bool:changeState=false);
skamonkey@3333
   184
skamonkey@3333
   185
/**
skamonkey@3333
   186
 * Gets the current round state.
skamonkey@3333
   187
 *
skamonkey@3333
   188
 * @return				Round state.
skamonkey@3333
   189
 * @error				Game doesn't support round state.
skamonkey@3333
   190
 */
skamonkey@3333
   191
stock RoundState:GameRules_GetRoundState()
skamonkey@3333
   192
{
skamonkey@3333
   193
	return RoundState:GameRules_GetProp("m_iRoundState");
skamonkey@3333
   194
}