Skip to content

Commit

Permalink
add changeskill command
Browse files Browse the repository at this point in the history
  • Loading branch information
Macil authored and coelckers committed May 14, 2023
1 parent 9ca3082 commit 6f964e8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/console.html
Original file line number Diff line number Diff line change
Expand Up @@ -2361,6 +2361,11 @@ <h2>Other commands and cvars</h2>
of a music lump or file on disk (which need not have been specified with the
-file parameter).
</div>
<div class="c" id="changeskill">changeskill <i>skill</i></div>
<div class="b">Changes the current skill of the game. The skill change will take
effect at the next map change. The skill must be a number. The default skill
levels range from 0 to 4 inclusive.
</div>
<div class="c" id="chase">chase</div>
<div class="b">Turns the chasecom on and off. This command also works while
watching demos, so you can bind it to a key and watch demos in the third
Expand Down Expand Up @@ -3177,6 +3182,7 @@ <h4>C</h4>
<a href="#centerview">centerview</a><br />
<a href="#changemap">changemap</a><br />
<a href="#changemus">changemus</a><br />
<a href="#changeskill">changeskill</a><br />
<a href="#chase">chase</a><br />
<a href="#chase_dist">chase_dist</a><br />
<a href="#chase_height">chase_height</a><br />
Expand Down
33 changes: 33 additions & 0 deletions src/console/c_cmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,39 @@ CCMD (changemap)
}
}

CCMD (changeskill)
{
if (!players[consoleplayer].mo || !usergame)
{
Printf ("Use the skill command when not in a game.\n");
return;
}

if (!players[consoleplayer].settings_controller && netgame)
{
Printf ("Only setting controllers can change the skill.\n");
return;
}

if (argv.argc() == 2)
{
int skill = atoi(argv[1]);
if (skill < 0 || skill >= AllSkills.Size())
{
Printf ("Skill %d is out of range.\n", skill);
}
else
{
NextSkill = skill;
Printf ("Skill %d will take effect on the next map.\n", skill);
}
}
else
{
Printf ("Usage: changeskill <skill>\n");
}
}

CCMD (give)
{
if (CheckCheatmode () || argv.argc() < 2)
Expand Down

0 comments on commit 6f964e8

Please sign in to comment.