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_undo = "PropUndo_sfx_undo";
public const string sfx_redo = "PropUndo_sfx_redo"; public const string sfx_redo = "PropUndo_sfx_redo";
public const string sfx_warn = "PropUndo_sfx_warn"; 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 redoHistoryLimit = 20; // amount that can be in history at once
public const int redoTimeoutLimit = 120; // seconds 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 // 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) foreach (string clipName in clipNames)
{ {
string clipPath = Path.Combine(path, clipName); string clipPath = Path.Combine(path, clipName);
@ -156,6 +157,12 @@ public class PropUndoButton : MelonMod
List<CVRSyncHelper.PropData> propsList = GetAllPropsByOwnerId(); List<CVRSyncHelper.PropData> propsList = GetAllPropsByOwnerId();
if (propsList.Count == 0)
{
PlayAudioModule(sfx_warn);
return false;
}
for (int i = propsList.Count - 1; i >= 0; i--) for (int i = propsList.Count - 1; i >= 0; i--)
{ {
CVRSyncHelper.PropData propData = propsList[i]; CVRSyncHelper.PropData propData = propsList[i];
@ -247,6 +254,10 @@ public class PropUndoButton : MelonMod
{ {
propData.Spawnable.Delete(); propData.Spawnable.Delete();
} }
else
{
PlayAudioModule(sfx_deny);
}
//if an undo attempt is made right after spawning a prop, the //if an undo attempt is made right after spawning a prop, the
//spawnable & wrapper will both be null, so the delete request //spawnable & wrapper will both be null, so the delete request

View file

@ -10,6 +10,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="SFX\sfx_deny.wav" />
<None Remove="SFX\sfx_redo.wav" /> <None Remove="SFX\sfx_redo.wav" />
<None Remove="SFX\sfx_spawn.wav" /> <None Remove="SFX\sfx_spawn.wav" />
<None Remove="SFX\sfx_undo.wav" /> <None Remove="SFX\sfx_undo.wav" />
@ -17,6 +18,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="SFX\sfx_deny.wav" />
<EmbeddedResource Include="SFX\sfx_redo.wav" /> <EmbeddedResource Include="SFX\sfx_redo.wav" />
<EmbeddedResource Include="SFX\sfx_spawn.wav" /> <EmbeddedResource Include="SFX\sfx_spawn.wav" />
<EmbeddedResource Include="SFX\sfx_undo.wav" /> <EmbeddedResource Include="SFX\sfx_undo.wav" />

Binary file not shown.