Skip to content

Commit 1ae84a8

Browse files
committed
Add cvar to set maximum gas grens
If 0 it will block them entirely, except from give ammo/give all or a forced give ammo from map entity which isn't respecting maximum.
1 parent 75b5569 commit 1ae84a8

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

code/game/g_cvar.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ G_CVAR( g_newStunGren, "g_newStunGren", "1", CVAR_ARCHIVE, qfalse )
262262
// Sets init/max nailbombs per player
263263
G_CVAR( g_maxNailBombs, "g_maxNailBombs", "1", CVAR_SERVERINFO | CVAR_ARCHIVE, qfalse )
264264

265+
G_CVAR( g_maxGasGrens, "g_maxGasGrens", "2", CVAR_SERVERINFO | CVAR_ARCHIVE, qfalse )
266+
265267
#undef G_NULLCVAR
266268
#undef G_NULLEXTCVAR
267269
#undef G_EXTCVAR

code/game/g_q3f_mapents.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ static qboolean G_Q3F_EvalStat( const int value, const evaltype_t eval, const in
16091609

16101610
#define EVALCLIENTSTAT(v,e,c,o) if( G_Q3F_EvalStat( v, e, c ) ) { if( o ) return( qtrue ); else continue; } else { if( o ) continue; else return( qfalse ); }
16111611

1612-
#define gren2max(x) ( ((x)->client->ps.persistant[PERS_CURRCLASS] == Q3F_CLASS_SOLDIER ? g_maxNailBombs.integer : cls->gren2max) )
1612+
#define gren2max(x) ( ((x)->client->ps.persistant[PERS_CURRCLASS] == Q3F_CLASS_SOLDIER ? g_maxNailBombs.integer : (x)->client->ps.persistant[PERS_CURRCLASS] == Q3F_CLASS_AGENT ? g_maxGasGrens.integer : cls->gren2max) )
16131613

16141614
qboolean G_Q3F_CheckClientStats( gentity_t *activator, q3f_keypairarray_t *array, qboolean or )
16151615
{

code/game/g_q3f_playerclass.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,8 @@ void Q3F_SetupClass(struct gentity_s *ent)
788788

789789
if ( ent->client->ps.persistant[PERS_CURRCLASS] == Q3F_CLASS_SOLDIER && g_maxNailBombs.integer == 0 )
790790
gren2 = 0;
791+
else if ( ent->client->ps.persistant[PERS_CURRCLASS] == Q3F_CLASS_AGENT && g_maxGasGrens.integer == 0 )
792+
gren2 = 0;
791793
else
792794
gren2 = cls->gren2init;
793795

0 commit comments

Comments
 (0)