Skip to content

Commit

Permalink
feat: sar_auto_voidclip_pause
Browse files Browse the repository at this point in the history
very very cheaty
  • Loading branch information
ThisAMJ committed Jul 22, 2024
1 parent eaed233 commit 613050e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/cvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
|sar_alias_run|cmd|sar_alias_run \<name> [args]... - run a SAR alias, passing on any additional arguments|
|sar_allow_resizing_window|0|EXPERIMENTAL! Forces resizing on game's window.|
|sar_always_transmit_heavy_ents|0|Always transmit large but seldom changing edicts to clients to prevent lag spikes.|
|sar_auto_voidclip_pause|cmd|sar_auto_voidclip_pause \<command> - runs the specified command, and automatically voidclip-pauses on the next load|
|sar_autojump|0|Enables automatic jumping on the server.|
|sar_autorecord|0|Enables or disables automatic demo recording.|
|sar_autostrafe|0|Automatically strafes in your current wishdir.|
Expand Down
26 changes: 26 additions & 0 deletions src/Features/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ Variable sar_load_delay("sar_load_delay", "0", 0, "Delay for this number of mill

Variable sar_patch_viewcontrol("sar_patch_viewcontrol", "1", "Disable camera controllers before changing levels to prevent visual glitches.\n");

static int g_autovoidclip = 0;
CON_COMMAND(sar_auto_voidclip_pause, "sar_auto_voidclip_pause <command> - runs the specified command, and automatically voidclip-pauses on the next load\n") {
if (!sv_cheats.GetBool()) {
console->Print("sar_auto_voidclip_pause requires sv_cheats 1.\n");
return;
}

if (args.ArgC() < 2) {
console->Print(sar_auto_voidclip_pause.ThisPtr()->m_pszHelpString);
return;
}

g_autovoidclip = 1;
engine->ExecuteCommand("sar_fast_load_preset sla");
engine->ExecuteCommand(args.m_pArgSBuffer + args.m_nArgv0Size);
}

Session *session;

Session::Session()
Expand Down Expand Up @@ -203,6 +220,15 @@ void Session::Changed(int state) {
console->DevMsg("state = %i\n", state);
this->signonState = state;

if (sv_cheats.GetBool() && g_autovoidclip == 1) {
if (state == SIGNONSTATE_NEW) {
engine->ExecuteCommand("showconsole");
} else if (state == SIGNONSTATE_SPAWN) {
engine->ExecuteCommand("showconsole; seq nop toggleconsole toggleconsole");
g_autovoidclip = 0;
}
}

// Ghosts are in saves, and just sorta stay there unless we kill
// them. We have to do this in prespawn - if we do it at session
// start, it kills ghosts that were just spawned and hence
Expand Down

0 comments on commit 613050e

Please sign in to comment.