Skip to content

Commit e801c35

Browse files
authored
Merge pull request #26 from winnerspiros/autopilot-spinner-fix-6744754247941515378
Fix Autopilot spinner spinning
2 parents 076e193 + 649332d commit e801c35

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
1+
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
22
// See the LICENCE file in the repository root for full licence text.
33

44
using System;
@@ -50,13 +50,20 @@ public void Update(Playfield playfield)
5050
// Very naive implementation of autopilot based on proximity to replay frames.
5151
// Special case for the first frame is required to ensure the mouse is in a sane position until the actual time of the first frame is hit.
5252
// TODO: this needs to be based on user interactions to better match stable (pausing until judgement is registered).
53-
if (currentFrame < 0 || Math.Abs(replayFrames[currentFrame + 1].Time - time) <= Math.Abs(replayFrames[currentFrame].Time - time))
53+
while (currentFrame < replayFrames.Count - 1)
5454
{
55-
currentFrame++;
56-
new MousePositionAbsoluteInput { Position = playfield.ToScreenSpace(replayFrames[currentFrame].Position) }.Apply(inputManager.CurrentState, inputManager);
55+
if (currentFrame < 0 || Math.Abs(replayFrames[currentFrame + 1].Time - time) <= Math.Abs(replayFrames[currentFrame].Time - time))
56+
{
57+
currentFrame++;
58+
}
59+
else
60+
{
61+
break;
62+
}
5763
}
5864

59-
// TODO: Implement the functionality to automatically spin spinners
65+
if (currentFrame >= 0)
66+
new MousePositionAbsoluteInput { Position = playfield.ToScreenSpace(replayFrames[currentFrame].Position) }.Apply(inputManager.CurrentState, inputManager);
6067
}
6168

6269
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)

osu.Game/Database/BackgroundDataStoreProcessor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Newtonsoft.Json;
1111
using osu.Framework.Allocation;
1212
using osu.Framework.Bindables;
13+
using osu.Framework.Development;
1314
using osu.Framework.Extensions;
1415
using osu.Framework.Graphics;
1516
using osu.Framework.Logging;
@@ -622,6 +623,8 @@ private void upgradeScoreRanks()
622623

623624
private void backpopulateMissingSubmissionAndRankDates()
624625
{
626+
if (DebugUtils.IsNUnitRunning) return;
627+
625628
if (!localMetadataSource.Available)
626629
{
627630
Logger.Log("Cannot backpopulate missing submission/rank dates because the local metadata cache is missing.");
@@ -725,6 +728,8 @@ protected virtual void backpopulateUserTags()
725728

726729
if (!localMetadataSource.Available || !localMetadataSource.IsAtLeastVersion(3))
727730
{
731+
if (DebugUtils.IsNUnitRunning) return;
732+
728733
Logger.Log(@"Local metadata cache has too low version to backpopulate user tags, attempting refetch...");
729734
localMetadataSource.FetchCache().WaitSafely();
730735

0 commit comments

Comments
 (0)