add more sound queues

This commit is contained in:
NotAKidoS 2023-04-13 18:00:43 -05:00
parent b6d061e740
commit e94cc78dfa
3 changed files with 14 additions and 1 deletions

View file

@ -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<CVRSyncHelper.PropData> 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