From 83cf69b4777d581d816cc0d1f4cf3c8f22254ff2 Mon Sep 17 00:00:00 2001 From: Furo Date: Sat, 30 Nov 2024 21:10:00 +0100 Subject: [PATCH] UIState Reloading Fix (#469) * Reloading UIStates does not softlock anymore * fix * Removed all prev changes and use a better method * Switch to tabs --- source/funkin/backend/MusicBeatState.hx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/MusicBeatState.hx b/source/funkin/backend/MusicBeatState.hx index 35b684e57..6ef650bc9 100644 --- a/source/funkin/backend/MusicBeatState.hx +++ b/source/funkin/backend/MusicBeatState.hx @@ -93,6 +93,9 @@ class MusicBeatState extends FlxState implements IBeatReceiver public var scriptsAllowed:Bool = true; + public static var lastScriptName:String = null; + public static var lastStateName:String = null; + public var scriptName:String = null; public static var skipTransOut:Bool = false; @@ -108,7 +111,12 @@ class MusicBeatState extends FlxState implements IBeatReceiver public function new(scriptsAllowed:Bool = true, ?scriptName:String) { super(); this.scriptsAllowed = #if SOFTCODED_STATES scriptsAllowed #else false #end; - this.scriptName = scriptName; + + if(lastStateName != (lastStateName = Type.getClassName(Type.getClass(this)))) { + lastScriptName = null; + } + this.scriptName = scriptName != null ? scriptName : lastScriptName; + lastScriptName = this.scriptName; } function loadScript() {