Skip to content

Commit

Permalink
fix alt fire swapping issue from previous commit
Browse files Browse the repository at this point in the history
Allow the "setAltSwap" command to be handled for clients who are still in connecting state.
  • Loading branch information
Chomenor committed Jul 24, 2022
1 parent 73b29ae commit 882b750
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
10 changes: 5 additions & 5 deletions code/game/g_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1198,14 +1198,14 @@ void ClientCommand( int clientNum ) {

trap_Argv( 0, cmd, sizeof( cmd ) );

// Team command can be called for connecting client when starting game from UI,
// but there shouldn't be a need for any other commands
if ( ent->client->pers.connected == CON_CONNECTING && Q_stricmp( cmd, "team" ) ) {
// Check if any mods have special handling of this command
if ( modfn.ModClientCommand( clientNum, cmd ) ) {
return;
}

// Check if any mods have special handling of this command
if ( modfn.ModClientCommand( clientNum, cmd ) ) {
// Team command can be called for connecting client when starting game from UI,
// but there shouldn't be a need for any other commands
if ( ent->client->pers.connected == CON_CONNECTING && Q_stricmp( cmd, "team" ) ) {
return;
}

Expand Down
1 change: 1 addition & 0 deletions code/game/mods/g_mod_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ MOD_FUNCTION_DEF( AdjustGeneralConstant, int, ( generalConstant_t gcType, int de
MOD_FUNCTION_DEF( ModConsoleCommand, qboolean, ( const char *cmd ) )

// Allows mods to handle client commands. Returns qtrue to suppress normal handling of command.
// Can be called for connecting clients and during intermission.
MOD_FUNCTION_DEF( ModClientCommand, qboolean, ( int clientNum, const char *cmd ) )

// Allows mods to add values to the mod config configstring.
Expand Down
5 changes: 4 additions & 1 deletion code/game/mods/modes/assimilation/assim_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,10 @@ Handle class command for borg (which can't change class directly).
*/
LOGFUNCTION_SRET( qboolean, PREFIX(ModClientCommand), ( int clientNum, const char *cmd ),
( clientNum, cmd ), "G_MODFN_MODCLIENTCOMMAND" ) {
if ( !Q_stricmp( cmd, "class" ) && !level.intermissiontime && level.clients[clientNum].sess.sessionClass == PC_BORG ) {
gclient_t *client = &level.clients[clientNum];

if ( !Q_stricmp( cmd, "class" ) && !level.intermissiontime &&
client->pers.connected == CON_CONNECTED && client->sess.sessionClass == PC_BORG ) {
if ( trap_Argc() != 2 ) {
trap_SendServerCommand( clientNum, "print \"class: Borg\n\"" );
} else {
Expand Down
4 changes: 3 additions & 1 deletion code/game/mods/modes/specialties/specs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ Handle class command.
*/
LOGFUNCTION_SRET( qboolean, PREFIX(ModClientCommand), ( int clientNum, const char *cmd ),
( clientNum, cmd ), "G_MODFN_MODCLIENTCOMMAND" ) {
if ( !Q_stricmp( cmd, "class" ) && !level.intermissiontime ) {
gclient_t *client = &level.clients[clientNum];

if ( !Q_stricmp( cmd, "class" ) && !level.intermissiontime && client->pers.connected == CON_CONNECTED ) {
if ( trap_Argc() != 2 ) {
ModSpecialties_TellClassCmd( clientNum );
} else {
Expand Down

0 comments on commit 882b750

Please sign in to comment.