Skip to content

Commit

Permalink
Merge pull request #120 from dennis/bugfix-duplicated-pit-entry
Browse files Browse the repository at this point in the history
Bugfix: Duplicated PitEntry
  • Loading branch information
dennis committed Aug 4, 2021
2 parents f9d9151 + d4f9555 commit 2bc2876
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Components/IRacing/Trackers/PitUsageTracker.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Slipstream.Components.IRacing.Models;
using Slipstream.Shared;

using System;

#nullable enable
Expand Down Expand Up @@ -29,7 +30,10 @@ public void Handle(GameState.IState currentState, IRacingDataTrackerState state,
state.CarsTracked.Add(car.CarIdx, carState);
}

if (carState.LastOnPitRoad != onPitRoad)
// Ignore car data if the location is NotInWord. In team events when changing drivers, it seems that the
// car is NotInWorld before returning to pits - and that will give two PitEnter events. To avoid this, we
// ignore data with NotInWorld.. NotInWorld also happens when you blink, but we can also ignore these.
if (carState.LastOnPitRoad != onPitRoad && car.Location != IIRacingEventFactory.CarLocation.NotInWorld)
{
var localUser = currentState.DriverCarIdx == car.CarIdx;
var now = currentState.SessionTime;
Expand All @@ -54,7 +58,7 @@ public void Handle(GameState.IState currentState, IRacingDataTrackerState state,
{
float? fuelLeft = null;

if(localUser)
if (localUser)
{
fuelLeft = currentState.FuelLevel;
}
Expand Down

0 comments on commit 2bc2876

Please sign in to comment.