From 2dc72d7c4851c355f493081febf62fb5b040ccbf Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Sun, 4 Dec 2022 23:03:04 +0100 Subject: [PATCH] some fixes... again --- buildnumber.txt | 2 +- source/funkin/game/PlayState.hx | 39 ++++++++++++------------- source/funkin/menus/FreeplayState.hx | 2 ++ source/funkin/scripting/GlobalScript.hx | 1 + 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index d31692da..aede7734 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1381 \ No newline at end of file +1384 \ No newline at end of file diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index d0a856f8..6184a2b6 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -108,6 +108,7 @@ class PlayState extends MusicBeatState public var cpuStrums:FlxTypedGroup; public var muteVocalsOnMiss:Bool = true; + public var canAccessDebugMenus:Bool = true; public var camZooming:Bool = false; public var camZoomingInterval:Int = 4; @@ -898,18 +899,24 @@ class PlayState extends MusicBeatState if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause) pauseGame(); - if (FlxG.keys.justPressed.SEVEN) - { - FlxG.switchState(new ChartingState()); - - #if desktop - DiscordClient.changePresence("Chart Editor", null, null, true); - #end - } - if (FlxG.keys.justPressed.F5) { - Logs.trace('Reloading scripts...', WARNING, YELLOW); - scripts.reload(); - Logs.trace('Song scripts successfully reloaded.', WARNING, GREEN); + if (canAccessDebugMenus) { + if (FlxG.keys.justPressed.SEVEN) + { + FlxG.switchState(new ChartingState()); + + #if desktop + DiscordClient.changePresence("Chart Editor", null, null, true); + #end + } + if (FlxG.keys.justPressed.F5) { + Logs.trace('Reloading scripts...', WARNING, YELLOW); + scripts.reload(); + Logs.trace('Song scripts successfully reloaded.', WARNING, GREEN); + } + if (FlxG.keys.justPressed.EIGHT) + FlxG.switchState(new CharacterEditor(SONG.player2)); + if (FlxG.keys.justPressed.NINE) + FlxG.switchState(new CharacterEditor(SONG.player1)); } // FlxG.watch.addQuick('VOL', vocals.amplitudeLeft); @@ -931,14 +938,6 @@ class PlayState extends MusicBeatState iconP1.health = healthBar.percent / 100; iconP2.health = 1 - (healthBar.percent / 100); - - /* if (FlxG.keys.justPressed.NINE) - FlxG.switchState(new Charting()); */ - - if (FlxG.keys.justPressed.EIGHT) - FlxG.switchState(new CharacterEditor(SONG.player2)); - if (FlxG.keys.justPressed.NINE) - FlxG.switchState(new CharacterEditor(SONG.player1)); if (startingSong) { diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index 99935d75..34f62b60 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -320,5 +320,7 @@ class SongMetadata } } } + if (this.difficulties.length <= 0) + this.difficulties.push("NORMAL"); } } diff --git a/source/funkin/scripting/GlobalScript.hx b/source/funkin/scripting/GlobalScript.hx index d27f2c84..957b24eb 100644 --- a/source/funkin/scripting/GlobalScript.hx +++ b/source/funkin/scripting/GlobalScript.hx @@ -85,6 +85,7 @@ class GlobalScript { script.call(name, args); } public static function onModSwitch(newMod:String) { + call("onDestroy"); if (script != null) { script.destroy(); script = null;