diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs index ef3bb75..919db15 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs @@ -95,7 +95,8 @@ public abstract class ModdedOption : IModdedOption /// Sets the value of the option. /// /// The new value. - public void SetValue(T newValue) + /// Whether to send the value to other players. + public void SetValue(T newValue, bool sendRpc = true) { var oldVal = Value; Value = newValue; @@ -105,7 +106,7 @@ public abstract class ModdedOption : IModdedOption ChangedEvent?.Invoke(Value); } - if (AmongUsClient.Instance.AmHost) + if (sendRpc && AmongUsClient.Instance.AmHost) { if (ParentMod?.GetConfigFile().TryGetEntry(ConfigDefinition, out var entry) == true) { @@ -141,7 +142,7 @@ public abstract class ModdedOption : IModdedOption { if (presetConfig.TryGetEntry(ConfigDefinition, out ConfigEntry entry)) { - SetValue(entry.Value); + SetValue(entry.Value, false); } else { diff --git a/MiraAPI/Presets/OptionPreset.cs b/MiraAPI/Presets/OptionPreset.cs index 7e07df5..06e3f8a 100644 --- a/MiraAPI/Presets/OptionPreset.cs +++ b/MiraAPI/Presets/OptionPreset.cs @@ -1,5 +1,6 @@ using System.Linq; using BepInEx.Configuration; +using MiraAPI.GameOptions; using MiraAPI.PluginLoading; using MiraAPI.Roles; using UnityEngine; @@ -61,9 +62,13 @@ public class OptionPreset option.LoadFromPreset(PresetConfig); } + ModdedOptionsManager.SyncAllOptions(); + foreach (var role in Plugin.InternalRoles.Values.OfType()) { role.LoadFromPreset(PresetConfig); } + + CustomRoleManager.SyncAllRoleSettings(); } }