diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_buildable.c | 3 | ||||
-rw-r--r-- | src/game/g_cmds.c | 57 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/g_main.c | 6 |
4 files changed, 54 insertions, 14 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index f6a98f6..3586a3b 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -3400,6 +3400,9 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance playerState_t *ps = &ent->client->ps; itemBuildError_t tempReason; + if( g_clusterfuck.integer ) + return IBE_NONE; + // Stop all buildables from interacting with traces G_SetBuildableLinkState( qfalse ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index bcd51de..2c13fd4 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -3080,6 +3080,9 @@ void Cmd_Class_f( gentity_t *ent ) if( ent->client->pers.teamSelection == PTE_ALIENS ) { + if( g_clusterfuck.integer ) + goto just_spawn_alien; + if( newClass != PCL_ALIEN_BUILDER0 && newClass != PCL_ALIEN_BUILDER0_UPG && newClass != PCL_ALIEN_LEVEL0 ) @@ -3110,6 +3113,7 @@ void Cmd_Class_f( gentity_t *ent ) return; } + just_spawn_alien: // spawn from an egg if( G_PushSpawnQueue( &level.alienSpawnQueue, clientNum ) ) { @@ -3117,31 +3121,40 @@ void Cmd_Class_f( gentity_t *ent ) ent->client->ps.stats[ STAT_PCLASS ] = newClass; } } + + else if( ent->client->pers.teamSelection == PTE_HUMANS ) { + int weapon; + + weapon = BG_FindWeaponNumForName( s ); + + if( g_clusterfuck.integer && weapon != WP_NONE) + { + ent->client->pers.humanItemSelection = weapon; + goto just_spawn_human; + } + //set the item to spawn with - if( !Q_stricmp( s, BG_FindNameForWeapon( WP_MACHINEGUN ) ) && - BG_WeaponIsAllowed( WP_MACHINEGUN ) ) + if( weapon == WP_MACHINEGUN && BG_WeaponIsAllowed( WP_MACHINEGUN ) ) { ent->client->pers.humanItemSelection = WP_MACHINEGUN; } - else if( !Q_stricmp( s, BG_FindNameForWeapon( WP_HBUILD ) ) && - BG_WeaponIsAllowed( WP_HBUILD ) ) + else if( weapon == WP_HBUILD && BG_WeaponIsAllowed( WP_HBUILD ) ) { ent->client->pers.humanItemSelection = WP_HBUILD; } - else if( !Q_stricmp( s, BG_FindNameForWeapon( WP_HBUILD2 ) ) && - BG_WeaponIsAllowed( WP_HBUILD2 ) && + else if( weapon == WP_HBUILD2 && BG_WeaponIsAllowed( WP_HBUILD2 ) && BG_FindStagesForWeapon( WP_HBUILD2, g_humanStage.integer ) ) { ent->client->pers.humanItemSelection = WP_HBUILD2; } else { - trap_SendServerCommand( ent-g_entities, - "print \"Unknown starting item\n\"" ); + trap_SendServerCommand( ent-g_entities, "print \"Unknown starting item\n\"" ); return; } + just_spawn_human: // spawn from a telenode G_LogOnlyPrintf("ClientTeamClass: %i human %s\n", clientNum, s); if( G_PushSpawnQueue( &level.humanSpawnQueue, clientNum ) ) @@ -3177,6 +3190,9 @@ void Cmd_Class_f( gentity_t *ent ) return; } + if( g_clusterfuck.integer ) + goto just_evolve; + //check there are no humans nearby VectorAdd( ent->client->ps.origin, range, maxs ); VectorSubtract( ent->client->ps.origin, range, mins ); @@ -3230,6 +3246,7 @@ void Cmd_Class_f( gentity_t *ent ) BG_FindStagesForClass( newClass, g_alienStage.integer ) && BG_ClassIsAllowed( newClass ) ) { + just_evolve: G_LogOnlyPrintf("ClientTeamClass: %i alien %s\n", clientNum, s); ent->client->pers.evolveHealthFraction = (float)ent->client->ps.stats[ STAT_HEALTH ] / @@ -3398,10 +3415,12 @@ void Cmd_Destroy_f( gentity_t *ent ) if( tr.fraction < 1.0f && ( traceEnt->s.eType == ET_BUILDABLE ) && - ( traceEnt->biteam == ent->client->pers.teamSelection ) && + ( g_clusterfuck.integer || traceEnt->biteam == ent->client->pers.teamSelection ) && ( ( ent->client->ps.weapon >= WP_ABUILD ) && ( ent->client->ps.weapon <= WP_HBUILD ) ) ) { + if( g_clusterfuck.integer ) + goto just_decon; // Cancel deconstruction if( g_markDeconstruct.integer == 1 && traceEnt->deconstruct ) { @@ -3469,6 +3488,7 @@ void Cmd_Destroy_f( gentity_t *ent ) } else { + just_decon: if( traceEnt->health > 0 ) { buildHistory_t *new; @@ -3819,6 +3839,13 @@ void Cmd_Buy_f( gentity_t *ent ) buyingEnergyAmmo = hasEnergyWeapon; } + if( g_clusterfuck.integer ) { + if ( weapon != WP_NONE ) + goto just_buy_weapon; + else + goto just_buy_upgrade; + } + if( buyingEnergyAmmo ) { //no armoury nearby @@ -3892,7 +3919,7 @@ void Cmd_Buy_f( gentity_t *ent ) trap_SendServerCommand( ent-g_entities, va( "print \"You can't buy this item\n\"" ) ); return; } - + just_buy_weapon: //add to inventory BG_AddWeaponToInventory( weapon, ent->client->ps.stats ); BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips ); @@ -3970,7 +3997,7 @@ void Cmd_Buy_f( gentity_t *ent ) va( "print \"You can't buy this item while crouching\n\"" ) ); return; } - + just_buy_upgrade: if( upgrade == UP_AMMO ) G_GiveClientMaxAmmo( ent, buyingEnergyAmmo ); else @@ -4018,7 +4045,7 @@ void Cmd_Sell_f( gentity_t *ent ) trap_Argv( 1, s, sizeof( s ) ); //no armoury nearby - if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) ) + if( !g_clusterfuck.integer && !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) ) { trap_SendServerCommand( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) ); return; @@ -5473,6 +5500,7 @@ void ClientCommand( int clientNum ) return; } + // do tests here to reduce the amount of repeated code if( !( cmds[ i ].cmdFlags & CMD_INTERMISSION ) && ( level.intermissiontime || level.paused ) ) @@ -5492,6 +5520,9 @@ void ClientCommand( int clientNum ) return; } + if( g_clusterfuck.integer ) + goto just_execute; + if( cmds[ i ].cmdFlags & CMD_TEAM && ent->client->pers.teamSelection == PTE_NONE ) { @@ -5531,7 +5562,7 @@ void ClientCommand( int clientNum ) "print \"Must be living to use this command\n\"" ); return; } - +just_execute: // Disallow a large class of commands if a player is restricted. if( G_admin_is_restricted( ent, qtrue ) && ( !Q_stricmp( cmd, "team" ) || diff --git a/src/game/g_local.h b/src/game/g_local.h index a3c02c8..da3a85a 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1551,6 +1551,8 @@ extern vmCvar_t g_scrimMode; extern vmCvar_t g_revertCooldownTime; +extern vmCvar_t g_clusterfuck; + void trap_Printf( const char *fmt ); void trap_Error( const char *fmt ); int trap_Milliseconds( void ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 55508be..9e6bf20 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -291,6 +291,8 @@ vmCvar_t g_scrimMode; vmCvar_t g_revertCooldownTime; +vmCvar_t g_clusterfuck; + static cvarTable_t gameCvarTable[ ] = { // don't override the cheat state set by the system @@ -558,7 +560,9 @@ static cvarTable_t gameCvarTable[ ] = { &g_schachtmeisterAutobahnThreshold, "g_schachtmeisterAutobahnThreshold", "-30", CVAR_ARCHIVE, 0, qfalse }, { &g_schachtmeisterAutobahnMessage, "g_schachtmeisterAutobahnMessage", "Your host is blacklisted.", CVAR_ARCHIVE, 0, qfalse }, - { &g_revertCooldownTime, "g_revertCooldownTime", "30", CVAR_ARCHIVE, 0, qfalse } + { &g_revertCooldownTime, "g_revertCooldownTime", "30", CVAR_ARCHIVE, 0, qfalse }, + + { &g_clusterfuck, "g_clusterfuck", "0", 0, 0, qtrue } }; static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] ); |