@@ -16,6 +16,10 @@ import flixel.math.FlxMath;
1616import flixel .tweens .FlxEase ;
1717import flixel .tweens .FlxTween ;
1818import flixel .util .FlxColor ;
19+ #if MODS_ALLOWED
20+ import sys .FileSystem ;
21+ import sys .io .File ;
22+ #end
1923import lime .app .Application ;
2024import Achievements ;
2125import editors .MasterEditorMenu ;
@@ -43,6 +47,11 @@ class MainMenuState extends MusicBeatState
4347 ' options'
4448 ];
4549
50+ #if MODS_ALLOWED
51+ var customOption : String ;
52+ var customOptionLink : String ;
53+ #end
54+
4655 var magenta : FlxSprite ;
4756 var camFollow : FlxObject ;
4857 var camFollowPos : FlxObject ;
@@ -75,35 +84,46 @@ class MainMenuState extends MusicBeatState
7584 persistentUpdate = persistentDraw = true ;
7685
7786 var yScroll : Float = Math .max (0.25 - (0.05 * (optionShit .length - 4 )), 0.1 );
78- var bg : FlxSprite = new FlxSprite (- 80 ).loadGraphic (Paths .image (' menuBG' ));
79- bg .scrollFactor .set (0 , yScroll );
80- bg .setGraphicSize (Std .int (bg .width * 1.175 ));
81- bg .updateHitbox ();
82- bg .screenCenter ();
83- bg .antialiasing = ClientPrefs .globalAntialiasing ;
84- add (bg );
85-
86- if (ClientPrefs .themedmainmenubg == true ) {
87- var hours : Int = Date .now ().getHours ();
88- if (hours > 18 ) {
89- bg .color = 0x4d39ff ; // 0x6939ff
90- } else if (hours < 18 ) null ;
91- }
92-
93- camFollow = new FlxObject (0 , 0 , 1 , 1 );
94- camFollowPos = new FlxObject (0 , 0 , 1 , 1 );
95- add (camFollow );
96- add (camFollowPos );
97-
98- magenta = new FlxSprite (- 80 ).loadGraphic (Paths .image (' menuDesat' ));
99- magenta .scrollFactor .set (0 , yScroll );
100- magenta .setGraphicSize (Std .int (magenta .width * 1.175 ));
101- magenta .updateHitbox ();
102- magenta .screenCenter ();
103- magenta .visible = false ;
104- magenta .antialiasing = ClientPrefs .globalAntialiasing ;
105- magenta .color = 0xFFfd719b ;
106- add (magenta );
87+ var bg : FlxSprite = new FlxSprite (- 80 ).loadGraphic (Paths .image (' menuBG' ));
88+ bg .scrollFactor .set (0 , yScroll );
89+ bg .setGraphicSize (Std .int (bg .width * 1.175 ));
90+ bg .updateHitbox ();
91+ bg .screenCenter ();
92+ bg .antialiasing = ClientPrefs .globalAntialiasing ;
93+ add (bg );
94+
95+ if (ClientPrefs .themedmainmenubg == true ) {
96+
97+ var themedBg : FlxSprite = new FlxSprite (- 80 ).loadGraphic (Paths .image (' menuDesat' ));
98+ themedBg .scrollFactor .set (0 , yScroll );
99+ themedBg .setGraphicSize (Std .int (bg .width ));
100+ themedBg .updateHitbox ();
101+ themedBg .screenCenter ();
102+ themedBg .antialiasing = ClientPrefs .globalAntialiasing ;
103+ add (themedBg );
104+
105+ var hours : Int = Date .now ().getHours ();
106+ if (hours > 18 ) {
107+ themedBg .color = 0x545f8a ; // 0x6939ff
108+ } else if (hours > 8 ) {
109+ themedBg .loadGraphic (Paths .image (' menuBG' ));
110+ }
111+ }
112+
113+ camFollow = new FlxObject (0 , 0 , 1 , 1 );
114+ camFollowPos = new FlxObject (0 , 0 , 1 , 1 );
115+ add (camFollow );
116+ add (camFollowPos );
117+
118+ magenta = new FlxSprite (- 80 ).loadGraphic (Paths .image (' menuDesat' ));
119+ magenta .scrollFactor .set (0 , yScroll );
120+ magenta .setGraphicSize (Std .int (magenta .width * 1.175 ));
121+ magenta .updateHitbox ();
122+ magenta .screenCenter ();
123+ magenta .visible = false ;
124+ magenta .antialiasing = ClientPrefs .globalAntialiasing ;
125+ magenta .color = 0xFFfd719b ;
126+ add (magenta );
107127
108128 // magenta.scrollFactor.set();
109129
@@ -116,6 +136,9 @@ class MainMenuState extends MusicBeatState
116136 }*/
117137
118138 var curoffset : Float = 100 ;
139+ #if MODS_ALLOWED
140+ pushModMenuItemsToList (Paths .currentModDirectory );
141+ #end
119142
120143 for (i in 0 ... optionShit .length )
121144 {
@@ -170,6 +193,32 @@ class MainMenuState extends MusicBeatState
170193 super .create ();
171194 }
172195
196+ #if MODS_ALLOWED
197+ private var modsAdded : Array <String > = [];
198+ function pushModMenuItemsToList (folder : String )
199+ {
200+ if (modsAdded .contains (folder )) return ;
201+
202+ var menuitemsFile : String = null ;
203+ if (folder != null && folder .trim ().length > 0 ) menuitemsFile = Paths .mods (folder + ' /data/menuitems.txt' );
204+ else menuitemsFile = Paths .mods (' data/menuitems.txt' );
205+
206+ if (FileSystem .exists (menuitemsFile ))
207+ {
208+ var firstarray : Array <String > = File .getContent (menuitemsFile ).split (' \n ' );
209+ if (firstarray [0 ].length > 0 ) {
210+ var arr : Array <String > = firstarray [0 ].split (' ||' );
211+ // if(arr.length == 1) arr.push(folder);
212+ optionShit .push (arr [0 ]);
213+ customOption = arr [0 ];
214+ customOptionLink = arr [1 ];
215+ }
216+ }
217+ modsAdded .push (folder );
218+ }
219+ #end
220+
221+
173222 #if ACHIEVEMENTS_ALLOWED
174223 // Unlocks "Freaky on a Friday Night" achievement
175224 function giveAchievement () {
@@ -219,6 +268,8 @@ class MainMenuState extends MusicBeatState
219268 if (optionShit [curSelected ] == ' donate' )
220269 {
221270 CoolUtil .browserLoad (' https://www.youtube.com/watch?v=dQw4w9WgXcQ' ); // WHOEVER DELETES THIS IS GAY
271+ } else if (optionShit [curSelected ] == customOption ) {
272+ CoolUtil .browserLoad (customOptionLink );
222273 }
223274 else
224275 {
0 commit comments