TreeMenu Fix Constructor Arguments and Fallback "main"

This commit is contained in:
Furo
2025-01-25 15:50:00 +01:00
committed by GitHub
parent 94db415e34
commit d802c429e1
+4 -3
View File
@@ -7,6 +7,7 @@ import flixel.tweens.FlxTween;
import funkin.menus.MainMenuState;
import flixel.util.typeLimit.OneOfTwo;
import funkin.options.type.OptionType;
import funkin.options.type.TextOption;
import funkin.backend.system.framerate.Framerate;
class TreeMenu extends UIState {
@@ -18,13 +19,13 @@ class TreeMenu extends UIState {
public static var lastState:Class<FlxState> = null; // Static for fixing the softlock bugs when resetting the state - Nex
public function new() {
public function new(scriptsAllowed:Bool = true, ?scriptName:String) {
if(lastState == null) lastState = Type.getClass(FlxG.state);
super();
super(scriptsAllowed, scriptName);
}
public override function createPost() {
if (main == null) throw "\"main\" variable has not been set in extended class!";
if (main == null) main = new OptionsScreen("Fallback Treemenu", "Please set the \"main\" variable in your extended class before createPost", [new TextOption("Oops! No Options", "This doesn't look like it was supposed to happen...", () -> FlxG.resetState() ) ]);
FlxG.camera.scroll.set(-FlxG.width, 0);