Add step console command to advance n ticks

This commit is contained in:
dP
2020-06-05 19:11:09 +03:00
parent f2b6576d8f
commit 5ce2d21223
9 changed files with 29 additions and 3 deletions

View File

@@ -649,6 +649,19 @@ DEF_CONSOLE_CMD(ConUnpauseGame)
return true;
}
DEF_CONSOLE_CMD(ConStepGame)
{
if (argc == 0 || argc > 2) {
IConsoleHelp("Advances the game for a certain amount of ticks (default 1). Usage: 'step [n]'");
return true;
}
auto n = (argc > 1 ? atoi(argv[1]) : 1);
DoCommandP(0, PM_PAUSED_NORMAL, 0 | (n << 1), CMD_PAUSE);
return true;
}
DEF_CONSOLE_CMD(ConRcon)
{
if (argc == 0) {
@@ -2171,6 +2184,7 @@ void IConsoleStdLibRegister()
IConsoleCmdRegister("pause", ConPauseGame, ConHookServerOnly);
IConsoleCmdRegister("unpause", ConUnpauseGame, ConHookServerOnly);
IConsoleCmdRegister("step", ConStepGame, ConHookNoNetwork);
IConsoleCmdRegister("company_pw", ConCompanyPassword, ConHookNeedNetwork);
IConsoleAliasRegister("company_password", "company_pw %+");