Skip to content

Commit

Permalink
Added toggle console server command
Browse files Browse the repository at this point in the history
  • Loading branch information
TriForceX committed Jun 5, 2022
1 parent 2dbd6a3 commit e02ec41
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The version control structure on this project is `<mayor>.<minor>.<patch>` where
- Added new emotes & updated checks
- Added extra checks for item spawn
- Added custom door map entity
- Added toggle console server command

## 0.18.2
- Fix death count on scoreboard
Expand Down
11 changes: 11 additions & 0 deletions code/cgame/cg_servercmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,17 @@ static void CG_ServerCommand( void ) {
return;
}

// Tr!Force: [JKMod] Toggle console from server
if ( !strcmp(cmd, "jk_cg_toggleConsole") )
{
if (trap_Key_GetCatcher() & KEYCATCH_CONSOLE) {
trap_Key_SetCatcher(0);
} else {
trap_Key_SetCatcher(KEYCATCH_CONSOLE);
}
return;
}

CG_Printf( "Unknown client game command: %s\n", cmd );
}

Expand Down
5 changes: 3 additions & 2 deletions code/game/g_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -2030,9 +2030,10 @@ void G_SpawnItem (gentity_t *ent, gitem_t *item) {
// Register the item even if we're going to remove it, as unpatched clients
// don't update their item registration on map_restart and we might enable
// weapons after a map_restart.
if (!itemRegistered[item - bg_itemlist]) { // Tr!Force: [GameGeneral] Save item registered
if (!itemRegistered[item - bg_itemlist]) // Tr!Force: [GameGeneral] Save item registered
{
RegisterItem(item);
SaveRegisteredItems();
if (level.numConnectedClients) SaveRegisteredItems();
}

if (g_gametype.integer == GT_TOURNAMENT)
Expand Down
13 changes: 13 additions & 0 deletions jkmod/game/jk_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,18 @@ static void JKMod_Cmd_EngageAuto(gentity_t* ent)
return;
}

/*
=====================================================================
Send toggle console function
=====================================================================
*/
void JKMod_Cmd_ToggleConsole(gentity_t *ent)
{
if (ent->client->pers.jkmodPers.clientPlugin) {
trap_SendServerCommand(ent - g_entities, "jk_cg_toggleConsole");
}
}

/*
=====================================================================
Who is / status function
Expand Down Expand Up @@ -1878,6 +1890,7 @@ void JKMod_Say(gentity_t *ent, int mode, qboolean arg0)
else if (Q_stricmp(p, "!where") == 0)
{
JKMod_Cmd_WhoIs(ent);
JKMod_Cmd_ToggleConsole(ent);
}
// Player stats
else if (Q_stricmp(p, "!status") == 0)
Expand Down
1 change: 1 addition & 0 deletions jkmod/game/jk_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ void JKMod_ClientCleanName(const char *in, char *out, int outSize, gentity_t *e
// jk_cmds.c
qboolean JKMod_IgnoreClientCheck(int option, int ignorer, int ignored);
void JKMod_IgnoreClientClear(int ignored);
void JKMod_Cmd_ToggleConsole(gentity_t *ent);
void JKMod_Cmd_WhoIs(gentity_t *ent);
void JKMod_CallVote(gentity_t *ent);
void JKMod_EngageDuel(gentity_t *ent, int type);
Expand Down

0 comments on commit e02ec41

Please sign in to comment.