diff options
author | /dev/humancontroller <devhc@example.com> | 2017-04-06 20:35:54 +0200 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-04-06 20:35:54 +0200 |
commit | c9f934736945acab1822e3956950c63b9743df98 (patch) | |
tree | 8e00a1cba2bfe1d2f6b82f008b9b085a6033749a /src | |
parent | 236c5db600ca7710cd63505e1c4fd758686294d4 (diff) |
implement setdisabled: a command to change the set of disabled buildables, classes or equipment during a game
use of this command does not update the client UI lists (eg. which weapons r allowed)
the current design of disabled elements is a big fucking piece of shit anyway
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_admin.c | 60 | ||||
-rw-r--r-- | src/game/g_admin.h | 1 |
2 files changed, 61 insertions, 0 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 2f92d5c2..49aa46da 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -189,6 +189,11 @@ g_admin_cmd_t g_admin_cmds[ ] = "[^3on|off^7]" }, + {"setdisabled", G_admin_setdisabled, qfalse, "setdisabled", + "set disabled buildables, classes or equipment", + "[^3buildables|classese|equipment^7] (^5list^7)" + }, + {"setivo", G_admin_setivo, qfalse, "setivo", "set an intermission view override", "[^3s|a|h^7]" @@ -1609,6 +1614,61 @@ qboolean G_admin_setdevmode( gentity_t *ent ) } } +qboolean G_admin_setdisabled( gentity_t *ent ) +{ + const char *name; + vmCvar_t *cvar; + char value[ MAX_STRING_CHARS ]; + + if( trap_Argc() < 2 ) + { + usage: + ADMP( "^3setdisabled: ^7usage: setdisabled [buildables|classes|equipment] (list)\n" ); + return qfalse; + } + else if( trap_Argc() > 3 ) + { + ADMP( "^3setdisabled: ^7excessive arguments\n" ); + goto usage; + } + + trap_Argv( 1, value, sizeof( value ) ); + if( !Q_stricmp( value, "buildables" ) ) + { + name = "buildables"; + cvar = &g_disabledBuildables; + } + else if( !Q_stricmp( value, "classes" ) ) + { + name = "classes"; + cvar = &g_disabledClasses; + } + else if( !Q_stricmp( value, "equipment" ) ) + { + name = "equipment"; + cvar = &g_disabledEquipment; + } + else + { + ADMP( "^3setdisabled: ^7invalid set\n" ); + goto usage; + } + + if( trap_Argc() >= 3 ) + trap_Argv( 2, value, sizeof( value ) ); + else + value[ 0 ] = '\0'; + + trap_Cvar_Set( va( "g_disabled%s", name ), value ); + trap_Cvar_Update( cvar ); + BG_InitAllowedGameElements(); + + AP( va( "print \"^3setdisabled: ^7%s ^7has changed the set of disabled %s to: %s\n\"", + ent ? ent->client->pers.netname : "console", name, value ) ); + + return qtrue; +} + qboolean G_admin_kick( gentity_t *ent ) { int pid; diff --git a/src/game/g_admin.h b/src/game/g_admin.h index a018ea81..10727bd3 100644 --- a/src/game/g_admin.h +++ b/src/game/g_admin.h @@ -186,6 +186,7 @@ qboolean G_admin_builder( gentity_t *ent ); qboolean G_admin_buildlog( gentity_t *ent ); qboolean G_admin_revert( gentity_t *ent ); qboolean G_admin_setdevmode( gentity_t *ent ); +qboolean G_admin_setdisabled( gentity_t *ent ); void G_admin_print( gentity_t *ent, char *m ); void G_admin_buffer_print( gentity_t *ent, char *m ); |