mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-01 13:59:22 +00:00
mmm
This commit is contained in:
parent
df51d421aa
commit
e990a8581e
1 changed files with 23 additions and 4 deletions
|
@ -191,9 +191,9 @@ public class PropUndoButton : MelonMod
|
|||
for (int i = propsList.Length - 1; i >= 0; i--)
|
||||
{
|
||||
CVRSyncHelper.PropData propData = propsList[i];
|
||||
SafeDeleteProp(propData);
|
||||
DeleteProp(propData);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -229,10 +229,15 @@ public class PropUndoButton : MelonMod
|
|||
if (Time.time - deletedProp.timeDeleted <= redoTimeoutLimit)
|
||||
{
|
||||
SendRedoProp(deletedProp.propGuid, deletedProp.position, deletedProp.rotation);
|
||||
deletedProps.RemoveAt(index);
|
||||
PlayAudioModule(sfx_redo);
|
||||
}
|
||||
|
||||
deletedProps.RemoveAt(index);
|
||||
else
|
||||
{
|
||||
// if latest prop is too old, same with rest
|
||||
deletedProps.Clear();
|
||||
PlayAudioModule(sfx_warn);
|
||||
}
|
||||
}
|
||||
|
||||
// original spawn prop method does not let you specify rotation
|
||||
|
@ -266,6 +271,20 @@ public class PropUndoButton : MelonMod
|
|||
}
|
||||
}
|
||||
|
||||
private static void DeleteProp(CVRSyncHelper.PropData propData)
|
||||
{
|
||||
if (propData.Spawnable != null)
|
||||
{
|
||||
propData.Spawnable.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (propData.Wrapper != null)
|
||||
UnityEngine.Object.DestroyImmediate(propData.Wrapper);
|
||||
propData.Recycle();
|
||||
}
|
||||
}
|
||||
|
||||
private static void SafeDeleteProp(CVRSyncHelper.PropData propData)
|
||||
{
|
||||
//fixes getting props stuck in limbo state if spawn & delete fast
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue