diff --git a/PropUndoButton/Main.cs b/PropUndoButton/Main.cs index c831b1a..5ab8ddc 100644 --- a/PropUndoButton/Main.cs +++ b/PropUndoButton/Main.cs @@ -30,6 +30,7 @@ public class PropUndoButton : MelonMod public const string sfx_undo = "PropUndo_sfx_undo"; public const string sfx_redo = "PropUndo_sfx_redo"; public const string sfx_warn = "PropUndo_sfx_warn"; + public const string sfx_deny = "PropUndo_sfx_deny"; public const int redoHistoryLimit = 20; // amount that can be in history at once public const int redoTimeoutLimit = 120; // seconds @@ -71,7 +72,7 @@ public class PropUndoButton : MelonMod } // copy embedded resources to this folder if they do not exist - string[] clipNames = { "sfx_spawn.wav", "sfx_undo.wav", "sfx_redo.wav", "sfx_warn.wav" }; + string[] clipNames = { "sfx_spawn.wav", "sfx_undo.wav", "sfx_redo.wav", "sfx_warn.wav", "sfx_deny.wav" }; foreach (string clipName in clipNames) { string clipPath = Path.Combine(path, clipName); @@ -156,6 +157,12 @@ public class PropUndoButton : MelonMod List propsList = GetAllPropsByOwnerId(); + if (propsList.Count == 0) + { + PlayAudioModule(sfx_warn); + return false; + } + for (int i = propsList.Count - 1; i >= 0; i--) { CVRSyncHelper.PropData propData = propsList[i]; @@ -247,6 +254,10 @@ public class PropUndoButton : MelonMod { propData.Spawnable.Delete(); } + else + { + PlayAudioModule(sfx_deny); + } //if an undo attempt is made right after spawning a prop, the //spawnable & wrapper will both be null, so the delete request diff --git a/PropUndoButton/PropUndoButton.csproj b/PropUndoButton/PropUndoButton.csproj index 3b1889c..76fb8b1 100644 --- a/PropUndoButton/PropUndoButton.csproj +++ b/PropUndoButton/PropUndoButton.csproj @@ -10,6 +10,7 @@ + @@ -17,6 +18,7 @@ + diff --git a/PropUndoButton/SFX/sfx_deny.wav b/PropUndoButton/SFX/sfx_deny.wav new file mode 100644 index 0000000..0a8b4ba Binary files /dev/null and b/PropUndoButton/SFX/sfx_deny.wav differ