Add step console command to advance n ticks

Cherry-picked from https://github.com/citymania-org/cmclient
Commit: 5ce2d21223a96934a83b8da43434c7a81f001ef0
This commit is contained in:
dP
2020-06-05 17:11:09 +01:00
committed by Jonathan G Rennison
parent 50965bbce7
commit ca23e8abcf
7 changed files with 26 additions and 1 deletions

View File

@@ -807,6 +807,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) {
@@ -3651,6 +3664,7 @@ void IConsoleStdLibRegister()
IConsole::CmdRegister("pause", ConPauseGame, ConHookServerOrNoNetwork);
IConsole::CmdRegister("unpause", ConUnpauseGame, ConHookServerOrNoNetwork);
IConsole::CmdRegister("step", ConStepGame, ConHookNoNetwork);
IConsole::CmdRegister("company_pw", ConCompanyPassword, ConHookNeedNetwork);
IConsole::AliasRegister("company_password", "company_pw %+");