diff --git a/FuckMetrics/FuckMetrics.cs b/FuckMetrics/FuckMetrics.cs index 0a91127..01593e9 100644 --- a/FuckMetrics/FuckMetrics.cs +++ b/FuckMetrics/FuckMetrics.cs @@ -10,7 +10,7 @@ namespace NAK.Melons.FuckMetrics var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "UpdateMetrics").Job; if (enable && job == null) { - SchedulerSystem.AddJob(new SchedulerSystem.Job(ViewManager.Instance.UpdateMetrics), 0f, 0.5f, -1); + SchedulerSystem.AddJob(new SchedulerSystem.Job(ViewManager.Instance.UpdateMetrics), 0f, FuckMetricsMod.EntryMetricsUpdateRate.Value, -1); } else if (!enable && job != null) { @@ -23,7 +23,7 @@ namespace NAK.Melons.FuckMetrics var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "SendCoreUpdate").Job; if (enable && job == null) { - SchedulerSystem.AddJob(new SchedulerSystem.Job(CVR_MenuManager.Instance.SendCoreUpdate), 0f, 0.1f, -1); + SchedulerSystem.AddJob(new SchedulerSystem.Job(CVR_MenuManager.Instance.SendCoreUpdate), 0f, FuckMetricsMod.EntryCoreUpdateRate.Value, -1); } else if (!enable && job != null) { diff --git a/FuckMetrics/Main.cs b/FuckMetrics/Main.cs index b1647f8..457b211 100644 --- a/FuckMetrics/Main.cs +++ b/FuckMetrics/Main.cs @@ -15,6 +15,12 @@ public class FuckMetricsMod : MelonMod public static readonly MelonPreferences_Entry EntryDisableCoreUpdates = CategoryFuckMetrics.CreateEntry("Menu Core Updates", SettingState.MenuOnly, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); + public static readonly MelonPreferences_Entry EntryMetricsUpdateRate = + CategoryFuckMetrics.CreateEntry("Metrics Update Rate", 1f, description: "Sets the update rate for the menu metrics. Default is 0.5f. Recommended to be 1f or higher."); + + public static readonly MelonPreferences_Entry EntryCoreUpdateRate = + CategoryFuckMetrics.CreateEntry("Core Update Rate", 2f, description: "Sets the update rate for the menu core updates. Default is 0.1f. Recommended to be 2f or higher."); + public enum SettingState { Always, @@ -33,7 +39,8 @@ public class FuckMetricsMod : MelonMod IEnumerator WaitForLocalPlayer() { - yield return PlayerSetup.Instance != null; + while (PlayerSetup.Instance == null) + yield return null; UpdateSettings(); }