1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-04 13:54:22 +00:00

Fix a bug where beatState sometimes gets called before create

This commit is contained in:
EliteMasterEric 2023-08-09 00:28:09 -04:00
parent 7ee86f37af
commit 3e02f7fca9

View file

@ -275,6 +275,11 @@ class PlayState extends MusicBeatState
*/
var startingSong:Bool = false;
/**
* False until `create()` has completed.
*/
var initialized:Bool = false;
/**
* A group of audio tracks, used to play the song's vocals.
*/
@ -592,6 +597,8 @@ class PlayState extends MusicBeatState
FlxG.console.registerObject('playState', this);
#end
initialized = true;
}
public override function update(elapsed:Float):Void
@ -1029,7 +1036,7 @@ class PlayState extends MusicBeatState
override function stepHit():Bool
{
if (criticalFailure) return false;
if (criticalFailure || !initialized) return false;
// super.stepHit() returns false if a module cancelled the event.
if (!super.stepHit()) return false;
@ -1052,7 +1059,7 @@ class PlayState extends MusicBeatState
override function beatHit():Bool
{
if (criticalFailure) return false;
if (criticalFailure || !initialized) return false;
// super.beatHit() returns false if a module cancelled the event.
if (!super.beatHit()) return false;