Use requiresRestart: false directly, remove Default() options factory
Now, without an additional CanModifyCallback setup, Default is just a pointless overhead.
This commit is contained in:
		
							parent
							
								
									1ec8275831
								
							
						
					
					
						commit
						049a14e440
					
				|  | @ -2238,11 +2238,11 @@ namespace MuzikaGromche | |||
| 
 | ||||
|             SkipExplicitTracks = configFile.Bind("General", "Skip Explicit Tracks", false, | ||||
|                 new ConfigDescription("When choosing tracks at random, skip the ones with Explicit Content/Lyrics.")); | ||||
|             LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(SkipExplicitTracks, Default(new BoolCheckBoxOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(SkipExplicitTracks, requiresRestart: false)); | ||||
| 
 | ||||
|             OverrideSpawnRates = configFile.Bind("General", "Override Spawn Rates", true, | ||||
|                 new ConfigDescription("Deviate from vanilla spawn rates to experience content of this mod more often.")); | ||||
|             LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(OverrideSpawnRates, Default(new BoolCheckBoxOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(OverrideSpawnRates, requiresRestart: false)); | ||||
| 
 | ||||
| #if DEBUG | ||||
|             SetupEntriesForGameOverText(configFile); | ||||
|  | @ -2290,7 +2290,7 @@ namespace MuzikaGromche | |||
|                     50, | ||||
|                     new ConfigDescription(description, chanceRange, track)); | ||||
| 
 | ||||
|                 LethalConfigManager.AddConfigItem(new IntSliderConfigItem(track.Weight, Default(new IntSliderOptions()))); | ||||
|                 LethalConfigManager.AddConfigItem(new IntSliderConfigItem(track.Weight, requiresRestart: false)); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | @ -2309,7 +2309,7 @@ namespace MuzikaGromche | |||
|         { | ||||
|             var entry = configFile.Bind("General", "Extrapolate Audio Playback Time", true, | ||||
|                 new ConfigDescription("AudioSource only updates its playback position about 20 times per second.\n\nUse extrapolation technique to predict playback time between updates for smoother color animations.")); | ||||
|             LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(entry, Default(new BoolCheckBoxOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(entry, requiresRestart: false)); | ||||
|             entry.SettingChanged += (sender, args) => apply(); | ||||
|             apply(); | ||||
| 
 | ||||
|  | @ -2323,7 +2323,7 @@ namespace MuzikaGromche | |||
|         { | ||||
|             var entry = configFile.Bind("General", "Skip Winding Phase", false, | ||||
|                 new ConfigDescription("Skip most of the wind-up/intro music.\n\nUse this option to test your Loop audio segment.")); | ||||
|             LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(entry, Default(new BoolCheckBoxOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(entry, requiresRestart: false)); | ||||
|             entry.SettingChanged += (sender, args) => apply(); | ||||
|             apply(); | ||||
| 
 | ||||
|  | @ -2355,7 +2355,7 @@ namespace MuzikaGromche | |||
|             customPaletteSizeEntry = configFile.Bind(section, "Palette Size", 0, new ConfigDescription( | ||||
|                 "Number of colors in the custom palette.\n\nIf set to non-zero, custom palette overrides track's own built-in palette.", | ||||
|                 new AcceptableValueRange<int>(0, maxCustomPaletteSize))); | ||||
|             LethalConfigManager.AddConfigItem(new IntSliderConfigItem(customPaletteSizeEntry, Default(new IntSliderOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new IntSliderConfigItem(customPaletteSizeEntry, requiresRestart: false)); | ||||
|             customPaletteSizeEntry.SettingChanged += (sender, args) => apply(); | ||||
| 
 | ||||
|             for (int i = 0; i < maxCustomPaletteSize; i++) | ||||
|  | @ -2363,7 +2363,7 @@ namespace MuzikaGromche | |||
|                 string entryName = $"Custom Color {i + 1}"; | ||||
|                 var customColorEntry = configFile.Bind(section, entryName, "#FFFFFF", "Choose color for the custom palette"); | ||||
|                 customPaletteEntries[i] = customColorEntry; | ||||
|                 LethalConfigManager.AddConfigItem(new HexColorInputFieldConfigItem(customColorEntry, Default(new HexColorInputFieldOptions()))); | ||||
|                 LethalConfigManager.AddConfigItem(new HexColorInputFieldConfigItem(customColorEntry, requiresRestart: false)); | ||||
|                 customColorEntry.SettingChanged += (sender, args) => apply(); | ||||
|             } | ||||
| 
 | ||||
|  | @ -2423,7 +2423,7 @@ namespace MuzikaGromche | |||
| 
 | ||||
|             overrideTimingsEntry = configFile.Bind(section, "Override Timings", false, | ||||
|                 new ConfigDescription("If checked, custom timings override track's own built-in timings.")); | ||||
|             LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(overrideTimingsEntry, Default(new BoolCheckBoxOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(overrideTimingsEntry, requiresRestart: false)); | ||||
|             overrideTimingsEntry.SettingChanged += (sender, args) => apply(); | ||||
| 
 | ||||
|             fadeOutBeatEntry = configFile.Bind(section, "Fade Out Beat", 0f, | ||||
|  | @ -2447,17 +2447,16 @@ namespace MuzikaGromche | |||
|             colorTransitionEasingEntry = configFile.Bind(section, "Color Transition Easing", Easing.Linear.Name, | ||||
|                 new ConfigDescription("Interpolation/easing method to use for color transitions", new AcceptableValueList<string>(Easing.AllNames))); | ||||
| 
 | ||||
|             var floatSliderOptions = Default(new FloatSliderOptions()); | ||||
|             LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(fadeOutBeatEntry, floatSliderOptions)); | ||||
|             LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(fadeOutDurationEntry, floatSliderOptions)); | ||||
|             LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(flickerLightsTimeSeriesEntry, Default(new TextInputFieldOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(lyricsTimeSeriesEntry, Default(new TextInputFieldOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(drunknessTimeSeriesEntry, Default(new TextInputFieldOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(condensationTimeSeriesEntry, Default(new TextInputFieldOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(beatsOffsetEntry, floatSliderOptions)); | ||||
|             LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(colorTransitionInEntry, floatSliderOptions)); | ||||
|             LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(colorTransitionOutEntry, floatSliderOptions)); | ||||
|             LethalConfigManager.AddConfigItem(new TextDropDownConfigItem(colorTransitionEasingEntry, Default(new TextDropDownOptions()))); | ||||
|             LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(fadeOutBeatEntry, requiresRestart: false)); | ||||
|             LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(fadeOutDurationEntry, requiresRestart: false)); | ||||
|             LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(flickerLightsTimeSeriesEntry, requiresRestart: false)); | ||||
|             LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(lyricsTimeSeriesEntry, requiresRestart: false)); | ||||
|             LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(drunknessTimeSeriesEntry, requiresRestart: false)); | ||||
|             LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(condensationTimeSeriesEntry, requiresRestart: false)); | ||||
|             LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(beatsOffsetEntry, requiresRestart: false)); | ||||
|             LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(colorTransitionInEntry, requiresRestart: false)); | ||||
|             LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(colorTransitionOutEntry, requiresRestart: false)); | ||||
|             LethalConfigManager.AddConfigItem(new TextDropDownConfigItem(colorTransitionEasingEntry, requiresRestart: false)); | ||||
| 
 | ||||
|             registerStruct(fadeOutBeatEntry, t => t.FadeOutBeat, x => FadeOutBeatOverride = x); | ||||
|             registerStruct(fadeOutDurationEntry, t => t.FadeOutDuration, x => FadeOutDurationOverride = x); | ||||
|  | @ -2653,12 +2652,6 @@ namespace MuzikaGromche | |||
|             }; | ||||
|         } | ||||
| #endif | ||||
| 
 | ||||
|         private T Default<T>(T options) where T : BaseOptions | ||||
|         { | ||||
|             options.RequiresRestart = false; | ||||
|             return options; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     [HarmonyPatch(typeof(GameNetworkManager))] | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue