From d802c429e198a7af151e8141d3c8b3ec7849ea34 Mon Sep 17 00:00:00 2001 From: Furo Date: Sat, 25 Jan 2025 15:50:00 +0100 Subject: [PATCH] TreeMenu Fix Constructor Arguments and Fallback "main" --- source/funkin/options/TreeMenu.hx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/funkin/options/TreeMenu.hx b/source/funkin/options/TreeMenu.hx index b0651fd2..3e05a4af 100644 --- a/source/funkin/options/TreeMenu.hx +++ b/source/funkin/options/TreeMenu.hx @@ -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 = 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); @@ -119,4 +120,4 @@ typedef OptionCategory = { typedef OptionTypeDef = { var type:Class; var args:Array; -} \ No newline at end of file +}