Skip to content

Commit b2df3c7

Browse files
committed
Use FlxG.game.lostFocus instead and check if autoPause enabled
1 parent c2ff07a commit b2df3c7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

source/funkin/play/PlayState.hx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,8 @@ class PlayState extends MusicBeatSubState
902902
if (isInCountdown)
903903
{
904904
// Do NOT apply offsets at this point, because they already got applied the previous frame!
905-
if (focus) Conductor.instance.update(Conductor.instance.songPosition + elapsed * 1000, false);
905+
@:privateAccess
906+
if (FlxG.game._lostFocus && Preferences.autoPause) Conductor.instance.update(Conductor.instance.songPosition + elapsed * 1000, false);
906907
if (Conductor.instance.songPosition >= (startTimestamp + Conductor.instance.combinedOffset))
907908
{
908909
trace("started song at " + Conductor.instance.songPosition);
@@ -921,9 +922,9 @@ class PlayState extends MusicBeatSubState
921922
Conductor.instance.formatOffset = 0.0;
922923
}
923924

924-
if (focus) Conductor.instance.update((FlxG.sound.music.pitch != 1) ? FlxG.sound.music.time + elapsed * 1000 : (Conductor.instance.songPosition
925-
+ elapsed * 1000),
926-
false); // Normal conductor update.
925+
@:privateAccess
926+
if (FlxG.game._lostFocus && Preferences.autoPause) Conductor.instance.update((FlxG.sound.music.pitch != 1) ? FlxG.sound.music.time + elapsed * 1000
927+
: (Conductor.instance.songPosition + elapsed * 1000), false); // Normal conductor update.
927928

928929
// If, after updating the conductor, the instrumental has finished, end the song immediately.
929930
// This helps prevent a major bug where the level suddenly loops back to the start or middle.

0 commit comments

Comments
 (0)