Skip to content

Commit

Permalink
Portal vault save auto-start
Browse files Browse the repository at this point in the history
  • Loading branch information
fatalis committed Sep 11, 2015
1 parent a78d731 commit 107c066
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions GameSpecific/Portal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ public override void OnSessionStart(GameState state)
public override GameSupportResult OnUpdate(GameState state)
{
if (this.IsFirstMap)
{
// vault save
if (state.TickBase == 4261 && !_onceFlag)
{
_onceFlag = true;
this.StartOffsetTicks = -3534; // 53.01 seconds
return GameSupportResult.PlayerGainedControl;
}

this.StartOffsetTicks = 1;
return base.OnUpdate(state);
}
else if (!this.IsLastMap || _onceFlag)
return GameSupportResult.DoNothing;

Expand Down
8 changes: 8 additions & 0 deletions SourceSplitComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ void state_OnStart(object sender, EventArgs e)
_totalMapTicks = 0;
_gamePauseTime = null;

// hack to make sure Portal players aren't using manual offset. we handle offset automatically now.
// remove this eventually
if (_timer.CurrentState.PauseTime.Seconds == 53 && _timer.CurrentState.PauseTime.Milliseconds == 10)
{
_timer.CurrentState.PauseTime = TimeSpan.Zero;
_timer.CurrentState.Run.Offset = TimeSpan.Zero;
}

if (_timer.CurrentState.PauseTime >= TimeSpan.Zero)
_sessionTicksOffset = _sessionTicks - (int)(_timer.CurrentState.PauseTime.TotalSeconds / _intervalPerTick);
else
Expand Down

0 comments on commit 107c066

Please sign in to comment.