1
1
package states ;
2
2
3
+ import haxe .Json ;
3
4
import flixel .text .FlxText ;
4
5
import flixel .util .FlxColor ;
5
6
import utilities .MusicUtilities ;
@@ -21,6 +22,9 @@ class OptionsMenu extends MusicBeatState {
21
22
new PageOption (" Gameplay" , " Gameplay" , " Change gameplay-related options,\n such as downscroll and ghost tapping." ),
22
23
new PageOption (" Graphics" , " Graphics" , " Change graphical-related options,\n such as max FPS." ),
23
24
new PageOption (" Misc" , " Misc" , " Change miscellaneous options that\n don't fit in the other categories." ),
25
+ #if MODDING_ALLOWED
26
+ new PageOption (" Mod Options" , " Mod Options" , " Change options for specific mods." ),
27
+ #end
24
28
new PageOption (" Developer Options" , " Developer Options" , " Change options for developing mods." )
25
29
],
26
30
" Gameplay" => [
@@ -40,7 +44,7 @@ class OptionsMenu extends MusicBeatState {
40
44
new StringSaveOption (" Hitsound" , CoolUtil .coolTextFile (Paths .txt (" hitsoundList" )), " hitsound" , " Change the hitsound used when hitting a note." )
41
45
],
42
46
" Graphics" => [
43
- new PageOption (" Back" , " Categories" , " Go back to the main menu." ),
47
+ new PageOption (" Back" , " Categories" , " Go back to the main menu." ),
44
48
new PageOption (" Note Options" , " Note Options" , " Change note-related options." ),
45
49
new PageOption (" Info Display" , " Info Display" , " Change optiosn related to the info display.\n (FPS counter, memory display, etc)." ),
46
50
new PageOption (" Optimizations" , " Optimizations" , " Change optimization options, such as anitaliasing." ),
@@ -155,12 +159,16 @@ class OptionsMenu extends MusicBeatState {
155
159
" Developer Options" => [
156
160
new PageOption (" Back" , " Categories" , " Go back to the main menu." ),
157
161
new BoolOption (" Developer Mode" , " developer" , " When toggled, enables developer tools.\n (traced lines display, toolbox, etc)" ),
158
- new DeveloperOption (" Throw Exception On Error" , " throwExceptionOnError" , " When toggled, the game will throw an\n exception when an error is thrown." ),
162
+ new DeveloperOption (" Throw Exception On Error" , " throwExceptionOnError" ,
163
+ " When toggled, the game will throw an\n exception when an error is thrown." ),
159
164
new DeveloperOption (" Auto Open Charter" , " autoOpenCharter" ,
160
165
" When toggled, the game will automatically\n open the chart editor when no chart is found." ),
161
166
new StepperSaveDeveloperOption (" Chart Backup Interval" , 1 , 10 , " backupDuration" , 1 ,
162
167
" Change how long the game will wait\n before creating a chart backup.\n (in minutes.)" ),
163
- ]
168
+ ],
169
+ #if MODDING_ALLOWED
170
+ " Mod Options" => [new PageOption (" Back" , " Categories" , " Go back to the main menu." ),]
171
+ #end
164
172
];
165
173
166
174
public var page : FlxTypedGroup <Option > = new FlxTypedGroup <Option >();
@@ -185,6 +193,31 @@ class OptionsMenu extends MusicBeatState {
185
193
}
186
194
187
195
public override function create (): Void {
196
+ #if MODDING_ALLOWED
197
+ for (mod in modding. ModList .getActiveMods (modding. PolymodHandler .metadataArrays )) {
198
+ pages .get (" Mod Options" ).push (new PageOption (mod , mod , modding. ModList .modMetadatas .get (mod ).description ));
199
+ pages .set (mod , [new PageOption (" Back" , " Mod Options" , " Go back to mod options." )]);
200
+ if (sys. FileSystem .exists (' mods/ $mod /data/options.json' )) {
201
+ var modOptions : modding. ModOptions = cast Json .parse (sys.io. File .getContent (' mods/ $mod /data/options.json' ));
202
+ for (option in modOptions .options ) {
203
+ switch (StringTools .trim (option .type ).toLowerCase ()) { // thank you haxe for not wanting to cast it to a string.
204
+ case " bool" :
205
+ pages .get (mod ).push (new BoolOption (option .name , option .save , option .description , mod ));
206
+ case " string" :
207
+ pages .get (mod ).push (new StringSaveOption (option .name , option .values , option .save , option .description , mod ));
208
+ #if HSCRIPT_ALLOWED
209
+ case " state" :
210
+ pages .get (mod ).push (new GameStateOption (option .name , new modding.custom. CustomState (option .script ), option .description ));
211
+ case " substate" :
212
+ pages .get (mod ).push (new GameSubStateOption (option .name , new modding.custom. CustomSubstate (option .script ), option .description ));
213
+ #end
214
+ default :
215
+ throw ' Option type \' ${option .type }\' is not a valid option type!' ;
216
+ }
217
+ }
218
+ }
219
+ }
220
+ #end
188
221
MusicBeatState .windowNameSuffix = " " ;
189
222
instance = this ;
190
223
0 commit comments