mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
clear redo list on world change
This commit is contained in:
parent
2c029b1452
commit
92a5991ff9
2 changed files with 19 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
|||
using ABI_RC.Core.AudioEffects;
|
||||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.AudioEffects;
|
||||
using ABI_RC.Core.Networking;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Core.UI;
|
||||
|
@ -37,7 +38,7 @@ public class PropUndoButton : MelonMod
|
|||
typeof(CVRSyncHelper).GetMethod(nameof(CVRSyncHelper.SpawnProp)),
|
||||
postfix: new HarmonyLib.HarmonyMethod(typeof(PropUndoButton).GetMethod(nameof(OnSpawnProp), BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
HarmonyInstance.Patch( // prop delete sfx
|
||||
HarmonyInstance.Patch( // prop delete sfx, log for possible redo
|
||||
typeof(CVRSyncHelper).GetMethod(nameof(CVRSyncHelper.DeletePropByInstanceId)),
|
||||
postfix: new HarmonyLib.HarmonyMethod(typeof(PropUndoButton).GetMethod(nameof(OnDeletePropByInstanceId), BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
|
@ -45,6 +46,10 @@ public class PropUndoButton : MelonMod
|
|||
typeof(InputModuleMouseKeyboard).GetMethod(nameof(InputModuleMouseKeyboard.UpdateInput)),
|
||||
postfix: new HarmonyLib.HarmonyMethod(typeof(PropUndoButton).GetMethod(nameof(OnUpdateInput), BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
HarmonyInstance.Patch( // clear redo list on world change
|
||||
typeof(CVRWorld).GetMethod(nameof(CVRWorld.ConfigureWorld)),
|
||||
postfix: new HarmonyLib.HarmonyMethod(typeof(PropUndoButton).GetMethod(nameof(OnWorldLoad), BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
SetupDefaultAudioClips();
|
||||
}
|
||||
|
||||
|
@ -135,6 +140,11 @@ public class PropUndoButton : MelonMod
|
|||
PlayAudioModule(sfx_undo);
|
||||
}
|
||||
|
||||
private static void OnWorldLoad()
|
||||
{
|
||||
deletedProps.Clear();
|
||||
}
|
||||
|
||||
private static void UndoProp()
|
||||
{
|
||||
if (!EntryEnabled.Value) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue