diff --git a/Craftimizer/Configuration.cs b/Craftimizer/Configuration.cs index f03b0bc..d88d579 100644 --- a/Craftimizer/Configuration.cs +++ b/Craftimizer/Configuration.cs @@ -59,6 +59,7 @@ public class MacroCopyConfiguration public bool AddNotification { get; set; } = true; // Requires AddNotification + public bool ForceNotification { get; set; } public bool AddNotificationSound { get; set; } = true; public int IntermediateNotificationSound { get; set; } = 10; public int EndNotificationSound { get; set; } = 6; diff --git a/Craftimizer/Utils/MacroCopy.cs b/Craftimizer/Utils/MacroCopy.cs index 85ed9fe..e9f7df8 100644 --- a/Craftimizer/Utils/MacroCopy.cs +++ b/Craftimizer/Utils/MacroCopy.cs @@ -37,24 +37,30 @@ public static class MacroCopy s.Add(GetActionCommand(actions[i], config)); - if (i != actions.Count - 1 && (config.Type == MacroCopyConfiguration.CopyType.CopyToMacro || !config.CombineMacro)) + if (config.Type == MacroCopyConfiguration.CopyType.CopyToMacro || !config.CombineMacro) { - if (s.Count == MacroSize - 1) + if (i != actions.Count - 1 && (i != actions.Count - 2 || config.ForceNotification)) { - if (GetEndCommand(macros.Count, false, config) is { } endCommand) - s.Add(endCommand); - } - if (s.Count == MacroSize) - { - macros.Add(string.Join(Environment.NewLine, s)); - s.Clear(); + if (s.Count == MacroSize - 1) + { + if (GetEndCommand(macros.Count, false, config) is { } endCommand) + s.Add(endCommand); + } + if (s.Count == MacroSize) + { + macros.Add(string.Join(Environment.NewLine, s)); + s.Clear(); + } } } } if (s.Count > 0) { - if (GetEndCommand(macros.Count, true, config) is { } endCommand) - s.Add(endCommand); + if (s.Count < MacroSize) + { + if (GetEndCommand(macros.Count, true, config) is { } endCommand) + s.Add(endCommand); + } macros.Add(string.Join(Environment.NewLine, s)); } diff --git a/Craftimizer/Windows/Settings.cs b/Craftimizer/Windows/Settings.cs index 1f341b2..03deb24 100644 --- a/Craftimizer/Windows/Settings.cs +++ b/Craftimizer/Windows/Settings.cs @@ -280,6 +280,15 @@ public sealed class Settings : Window, IDisposable if (Config.MacroCopy.AddNotification) { + DrawOption( + "Force Notification", + "Prioritize always having a notification sound at the end of\n" + + "every macro. Keeping this off prevents macros with only 1 action.", + Config.MacroCopy.ForceNotification, + v => Config.MacroCopy.ForceNotification = v, + ref isDirty + ); + DrawOption( "Add Notification Sound", "Adds a sound to the end of every macro.",