Skip to content

Commit

Permalink
Added "randomclass" cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
IgeNiaI committed Nov 29, 2022
1 parent 5a5ba70 commit 94aa27e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/menu/multiplayermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#include "duel.h"
#include "invasion.h"
#include "lastmanstanding.h"
#include "i_system.h"
#include <cl_commands.h>

static void M_StartSkirmishGame();
Expand Down Expand Up @@ -868,6 +869,28 @@ CCMD ( menu_joingamewithclass )
}
}

static FRandom pr_randomclass ("RandomClass");
static int lastRandomTic;

CCMD ( randomclass )
{
if ( NETWORK_GetState( ) == NETSTATE_SERVER )
return;

if (gametic - lastRandomTic < 35)
{
Printf( "You can only random your class once per second\n" );
return;
}

pr_randomclass.Init(I_MakeRNGSeed());
int classNum = pr_randomclass( PlayerClasses.Size() );

playerclass = GetPrintableDisplayName( PlayerClasses[classNum].Type );
Printf( "Your respawn class is now \"%s\"\n", *playerclass );
lastRandomTic = gametic;
}

CCMD ( menu_ignore )
{
M_ExecuteIgnore();
Expand Down

0 comments on commit 94aa27e

Please sign in to comment.