Skip to content

Commit

Permalink
Handle starting and saving bonus replays
Browse files Browse the repository at this point in the history
  • Loading branch information
1zc committed Mar 10, 2024
1 parent bc8114c commit c3ba3a1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ST-Events/TriggerStartTouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ internal HookResult OnTriggerStartTouch(CEntityIOOutput output, string name, CEn
// We only want this working if they're in bonus mode, ignore otherwise.
if (player.Timer.IsBonusMode)
{
player.ReplayRecorder.Start(); // Start replay recording

player.Timer.Reset();
player.Timer.IsBonusMode = true;
int bonus = Int32.Parse(Regex.Match(trigger.Entity.Name, "[0-9][0-9]?").Value);
Expand Down Expand Up @@ -259,7 +261,9 @@ internal HookResult OnTriggerStartTouch(CEntityIOOutput output, string name, CEn
}

player.Timer.Stop();
// To-do: bonus replays
player.ReplayRecorder.CurrentSituation = ReplayFrameSituation.END_RUN;

// To-do: Bonus prespeeds

string PracticeString = "";
if (player.Timer.IsPracticeMode)
Expand All @@ -284,8 +288,8 @@ internal HookResult OnTriggerStartTouch(CEntityIOOutput output, string name, CEn
throw new Exception("CS2 Surf ERROR >> OnTriggerStartTouch (Bonus end zone) -> DB object is null, this shouldn't happen.");

player.Stats.BonusPB[bonus][style].Ticks = player.Timer.Ticks; // Reload the run_time for the HUD and also assign for the DB query

// To-do: save to DB

if (!player.Timer.IsPracticeMode)
{
AddTimer(1.5f, () => {
Expand Down

0 comments on commit c3ba3a1

Please sign in to comment.