Skip to content

Commit

Permalink
spawn looping replay bots on different ticks
Browse files Browse the repository at this point in the history
  • Loading branch information
rtldg committed Jul 20, 2022
1 parent cec7805 commit f703aca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions addons/sourcemod/scripting/shavit-replay-playback.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,9 @@ void AddReplayBots()
UpdateReplayClient(bot);
}

// try not to spawn all the bots on the same tick... maybe it'll help with the occasional script execution timeout
bool do_request_frame = false;

// Load all bots from looping config...
for (int i = 0; i < MAX_LOOPING_BOT_CONFIGS; i++)
{
Expand All @@ -1850,6 +1853,14 @@ void AddReplayBots()
continue;
}

if (do_request_frame)
{
RequestFrame(AddReplayBots);
return;
}

do_request_frame = true;

int bot = CreateReplayEntity(track, style, -1.0, 0, -1, Replay_Looping, false, cache, i);

if (bot == 0)
Expand Down

0 comments on commit f703aca

Please sign in to comment.