diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2009-10-25 02:09:12 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:04 +0000 |
commit | af6fd4fa5aaa4dc7c59ae54ead20d5ef0fbcc946 (patch) | |
tree | 31b03b8fb1fdbd070076b8b609526cfdbe8c1161 | |
parent | 608ca46db22407342f56c7491c51de230eee05ce (diff) |
* Fix ability to mark the last spawn for deconstruction (Rezyn)
* Notify everyone if g_markDeconstruct or g_unlagged are changed during a game
-rw-r--r-- | src/game/g_cmds.c | 45 | ||||
-rw-r--r-- | src/game/g_main.c | 4 |
2 files changed, 25 insertions, 24 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 6315ca2e..2265aaa9 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1671,6 +1671,7 @@ void Cmd_Destroy_f( gentity_t *ent ) gentity_t *traceEnt; char cmd[ 12 ]; qboolean deconstruct = qtrue; + qboolean lastSpawn = qfalse; if( ent->client->pers.denyBuild ) { @@ -1705,7 +1706,7 @@ void Cmd_Destroy_f( gentity_t *ent ) return; } - // Cancel deconstruction + // Cancel deconstruction (unmark) if( deconstruct && g_markDeconstruct.integer && traceEnt->deconstruct ) { traceEnt->deconstruct = qfalse; @@ -1713,27 +1714,24 @@ void Cmd_Destroy_f( gentity_t *ent ) } // Prevent destruction of the last spawn - if( !g_cheats.integer && - ( !g_markDeconstruct.integer || !G_FindPower( traceEnt ) ) ) + if( ent->client->pers.teamSelection == TEAM_ALIENS && + traceEnt->s.modelindex == BA_A_SPAWN ) { - if( ent->client->pers.teamSelection == TEAM_ALIENS && - traceEnt->s.modelindex == BA_A_SPAWN ) - { - if( level.numAlienSpawns <= 1 ) - { - G_TriggerMenu( ent->client->ps.clientNum, MN_B_LASTSPAWN ); - return; - } - } - else if( ent->client->pers.teamSelection == TEAM_HUMANS && - traceEnt->s.modelindex == BA_H_SPAWN ) - { - if( level.numHumanSpawns <= 1 ) - { - G_TriggerMenu( ent->client->ps.clientNum, MN_B_LASTSPAWN ); - return; - } - } + if( level.numAlienSpawns <= 1 ) + lastSpawn = qtrue; + } + else if( ent->client->pers.teamSelection == TEAM_HUMANS && + traceEnt->s.modelindex == BA_H_SPAWN ) + { + if( level.numHumanSpawns <= 1 ) + lastSpawn = qtrue; + } + + if( lastSpawn && !g_cheats.integer && + !g_markDeconstruct.integer ) + { + G_TriggerMenu( ent->client->ps.clientNum, MN_B_LASTSPAWN ); + return; } // Don't allow destruction of hovel with granger inside @@ -1742,7 +1740,10 @@ void Cmd_Destroy_f( gentity_t *ent ) // Don't allow destruction of buildables that cannot be rebuilt if( G_TimeTilSuddenDeath( ) <= 0 ) + { + G_TriggerMenu( ent->client->ps.clientNum, MN_B_SUDDENDEATH ); return; + } if( !g_markDeconstruct.integer || ( ent->client->pers.teamSelection == TEAM_HUMANS && @@ -1764,7 +1765,7 @@ void Cmd_Destroy_f( gentity_t *ent ) } else if( g_markDeconstruct.integer && ( ent->client->pers.teamSelection != TEAM_HUMANS || - G_FindPower( traceEnt ) ) ) + G_FindPower( traceEnt ) || lastSpawn ) ) { traceEnt->deconstruct = qtrue; // Mark buildable for deconstruction traceEnt->deconstructTime = level.time; diff --git a/src/game/g_main.c b/src/game/g_main.c index 2fa41c1d..141404ad 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -225,7 +225,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_alienStage3Threshold, "g_alienStage3Threshold", DEFAULT_ALIEN_STAGE3_THRESH, 0, 0, qfalse }, { &g_freeFundPeriod, "g_freeFundPeriod", DEFAULT_FREEKILL_PERIOD, CVAR_ARCHIVE, 0, qtrue }, - { &g_unlagged, "g_unlagged", "1", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qfalse }, + { &g_unlagged, "g_unlagged", "1", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, { &g_disabledEquipment, "g_disabledEquipment", "", CVAR_ROM, 0, qfalse }, { &g_disabledClasses, "g_disabledClasses", "", CVAR_ROM, 0, qfalse }, @@ -236,7 +236,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_floodMaxDemerits, "g_floodMaxDemerits", "5000", CVAR_ARCHIVE, 0, qfalse }, { &g_floodMinTime, "g_floodMinTime", "2000", CVAR_ARCHIVE, 0, qfalse }, - { &g_markDeconstruct, "g_markDeconstruct", "3", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qfalse }, + { &g_markDeconstruct, "g_markDeconstruct", "3", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, { &g_debugMapRotation, "g_debugMapRotation", "0", 0, 0, qfalse }, { &g_currentMapRotation, "g_currentMapRotation", "-1", 0, 0, qfalse }, // -1 = NOT_ROTATING |