From 8b968da4f32ba2dbc85e462456e02312b3d02513 Mon Sep 17 00:00:00 2001 From: Paradox460 Date: Mon, 23 Jun 2008 15:11:41 +0000 Subject: [PATCH] Updated teamstatus, adds g_teamStatusTime control to adjust how fast it can be repeated. --- src/game/g_cmds.c | 59 +++++++++++++++++++++++++++++++++++++++++++--- src/game/g_local.h | 2 ++ src/game/g_main.c | 4 +++- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 6669ed6..622de6a 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -4079,6 +4079,7 @@ void Cmd_TeamStatus_f( gentity_t *ent ) { int i; int builders = 0; + int arm = 0, medi = 0, boost = 0; char *omrc; gentity_t *tmp; qboolean found = qfalse; @@ -4086,8 +4087,24 @@ void Cmd_TeamStatus_f( gentity_t *ent ) if( !g_teamStatus.integer ) return; + if( ent->client->pers.muted ) + { + trap_SendServerCommand( ent - g_entities, + "print \"You are muted and cannot use message commands.\n\"" ); + return; + } + + if( g_teamStatusTime.integer && ent->client->pers.lastTeamStatus && (level.time - ent->client->pers.lastTeamStatus) < g_teamStatusTime.integer * 1000 ) + { + ADMP( va("You may only check your team's status once every %i seconds.\n", g_teamStatusTime.integer )); + return; + } + + ent->client->pers.lastTeamStatus = level.time; + if( ent->client->pers.teamSelection == PTE_ALIENS ){ + //OM detection for ( i = 1, tmp = g_entities + i; i < level.num_entities; i++, tmp++ ) { if( tmp->s.eType != ET_BUILDABLE ) @@ -4099,6 +4116,7 @@ void Cmd_TeamStatus_f( gentity_t *ent ) } } + //Builder detection for( i = 0; i < level.maxclients; i++ ) { tmp = &g_entities[ i ]; @@ -4113,13 +4131,26 @@ void Cmd_TeamStatus_f( gentity_t *ent ) builders++; } } + + //Booster detection + for ( i = 1, tmp = g_entities + i; i < level.num_entities; i++, tmp++ ) + { + if( tmp->s.eType != ET_BUILDABLE ) + continue; + if( tmp->s.modelindex == BA_A_BOOSTER ){ + boost++; + } + } + if( found == qfalse ) omrc = "^3OM: ^1Down(0)^3"; - G_Say( ent, NULL, SAY_TEAM, va("%s ^3Eggs: ^6%i^3 Builders: ^6%i^7", omrc, level.numAlienSpawns, builders )); + + G_Say( ent, NULL, SAY_TEAM, va("%s ^3Eggs: ^6%i^3 Builders: ^6%i^3 Boosters: ^6%i^7", omrc, level.numAlienSpawns, builders, boost )); } if( ent->client->pers.teamSelection == PTE_HUMANS ){ + //RC detection for ( i = 1, tmp = g_entities + i; i < level.num_entities; i++, tmp++ ) { if( tmp->s.eType != ET_BUILDABLE ) @@ -4130,7 +4161,8 @@ void Cmd_TeamStatus_f( gentity_t *ent ) break; } } - + + //Builder detection for( i = 0; i < level.maxclients; i++ ) { tmp = &g_entities[ i ]; @@ -4144,10 +4176,31 @@ void Cmd_TeamStatus_f( gentity_t *ent ) BG_InventoryContainsWeapon( WP_HBUILD2, tmp->client->ps.stats ) ) ){ builders++; } + } + + //Arm detection + for ( i = 1, tmp = g_entities + i; i < level.num_entities; i++, tmp++ ) + { + if( tmp->s.eType != ET_BUILDABLE ) + continue; + if( tmp->s.modelindex == BA_H_ARMOURY ){ + arm++; + } + } + + //Medi detection + for ( i = 1, tmp = g_entities + i; i < level.num_entities; i++, tmp++ ) + { + if( tmp->s.eType != ET_BUILDABLE ) + continue; + if( tmp->s.modelindex == BA_H_MEDISTAT ){ + medi++; + } } if( found == qfalse ) omrc = "^3RC: ^1Down(0)^3"; - G_Say( ent, NULL, SAY_TEAM, va("%s ^3Telenodes: ^6%i^3 Builders: ^6%i^7", omrc, level.numHumanSpawns, builders )); + + G_Say( ent, NULL, SAY_TEAM, va("%s ^3Telenodes: ^6%i^3 Builders: ^6%i^3 Armouries: ^6%i^3 Medistations: ^6%i^7", omrc, level.numHumanSpawns, builders, arm, medi )); } return; diff --git a/src/game/g_local.h b/src/game/g_local.h index 2cebd99..e2345a1 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -404,6 +404,7 @@ typedef struct qboolean healing; char chat[ CHAT_MAXCHAN ][ CHAT_MAXPASS ]; qboolean ignoreAdminWarnings; + int lastTeamStatus; qboolean firstConnect; } clientPersistant_t; @@ -1432,6 +1433,7 @@ extern vmCvar_t g_modTurretAngle; // Allow high turret build angles extern vmCvar_t g_instantBuild; // Enable instant building outside of devmap mode extern vmCvar_t g_teamStatus; // Allow the use of /teamstatus +extern vmCvar_t g_teamStatusTime; // Allow the use of /teamstatus void trap_Printf( const char *fmt ); void trap_Error( const char *fmt ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 1babf7e..8a5be93 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "g_local.h" #define QVM_VARIANT "P-G-QVM" -#define QVM_VERSION "SVN r65" +#define QVM_VERSION "SVN r66" level_locals_t level; @@ -243,6 +243,7 @@ vmCvar_t g_modWeaponReload; vmCvar_t g_modTurretAngle; vmCvar_t g_teamStatus; +vmCvar_t g_teamStatusTime; vmCvar_t g_instantBuild; @@ -302,6 +303,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_modWeaponReload, "g_modWeaponReload", "0", CVAR_ARCHIVE, 0, qfalse }, { &g_modTurretAngle, "g_modTurretAngle", "0", CVAR_ARCHIVE, 0, qfalse }, { &g_teamStatus, "g_teamStatus", "0", CVAR_ARCHIVE, 0, qfalse }, + { &g_teamStatusTime, "g_teamStatusTime", "10", CVAR_ARCHIVE, 0, qfalse }, { &g_instantBuild, "g_instantBuild", "0", CVAR_ARCHIVE, 0, qfalse }, { &g_proximityMines, "g_proximityMines", "0", 0, 0, qtrue },