1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-27 09:13:18 +00:00

tighten main menu security to prevent weird crashes during transitions

This commit is contained in:
MtH 2021-03-30 20:52:24 +02:00
parent b7a76bdc8e
commit 9085eed598
2 changed files with 7 additions and 2 deletions

View file

@ -218,6 +218,7 @@ class MainMenuState extends MusicBeatState
function startExitState(state:FlxState)
{
menuItems.enabled = false; // disable for exit
var duration = 0.4;
menuItems.forEach(function(item)
{
@ -241,7 +242,10 @@ class MainMenuState extends MusicBeatState
FlxG.sound.music.volume += 0.5 * FlxG.elapsed;
}
if (menuItems.enabled && controls.BACK)
if (_exiting)
menuItems.enabled = false;
if (controls.BACK && menuItems.enabled && !menuItems.busy)
FlxG.switchState(new TitleState());
super.update(elapsed);

View file

@ -24,7 +24,8 @@ class MenuTypedList<T:MenuItem> extends FlxTypedGroup<T>
var byName = new Map<String, T>();
/** Set to true, internally to disable controls, without affecting vars like `enabled` */
var busy:Bool = false;
public var busy(default, null):Bool = false;
// bit awkward because BACK is also a menu control and this doesn't affect that
public function new (navControls:NavControls = Vertical, ?wrapMode:WrapMode)
{