Skip to content

Commit d802c42

Browse files
authored
TreeMenu Fix Constructor Arguments and Fallback "main"
1 parent 94db415 commit d802c42

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

source/funkin/options/TreeMenu.hx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import flixel.tweens.FlxTween;
77
import funkin.menus.MainMenuState;
88
import flixel.util.typeLimit.OneOfTwo;
99
import funkin.options.type.OptionType;
10+
import funkin.options.type.TextOption;
1011
import funkin.backend.system.framerate.Framerate;
1112

1213
class TreeMenu extends UIState {
@@ -18,13 +19,13 @@ class TreeMenu extends UIState {
1819

1920
public static var lastState:Class<FlxState> = null; // Static for fixing the softlock bugs when resetting the state - Nex
2021

21-
public function new() {
22+
public function new(scriptsAllowed:Bool = true, ?scriptName:String) {
2223
if(lastState == null) lastState = Type.getClass(FlxG.state);
23-
super();
24+
super(scriptsAllowed, scriptName);
2425
}
2526

2627
public override function createPost() {
27-
if (main == null) throw "\"main\" variable has not been set in extended class!";
28+
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() ) ]);
2829

2930
FlxG.camera.scroll.set(-FlxG.width, 0);
3031

@@ -119,4 +120,4 @@ typedef OptionCategory = {
119120
typedef OptionTypeDef = {
120121
var type:Class<OptionType>;
121122
var args:Array<Dynamic>;
122-
}
123+
}

0 commit comments

Comments
 (0)