mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
lower volume even more, fix prop ghosts
This commit is contained in:
parent
01a336d881
commit
b6d061e740
5 changed files with 27 additions and 15 deletions
|
@ -159,14 +159,7 @@ public class PropUndoButton : MelonMod
|
||||||
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];
|
||||||
|
SafeDeleteProp(propData);
|
||||||
if (propData.Spawnable == null)
|
|
||||||
{
|
|
||||||
propData.Recycle();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
propData.Spawnable.Delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -181,13 +174,7 @@ public class PropUndoButton : MelonMod
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propData.Spawnable == null)
|
SafeDeleteProp(propData);
|
||||||
{
|
|
||||||
propData.Recycle();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
propData.Spawnable.Delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RedoProp()
|
public static void RedoProp()
|
||||||
|
@ -248,6 +235,31 @@ public class PropUndoButton : MelonMod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void SafeDeleteProp(CVRSyncHelper.PropData propData)
|
||||||
|
{
|
||||||
|
//fixes getting props stuck in limbo state if spawn & delete fast
|
||||||
|
if (propData.Spawnable == null && propData.Wrapper != null)
|
||||||
|
{
|
||||||
|
UnityEngine.Object.DestroyImmediate(propData.Wrapper);
|
||||||
|
propData.Recycle();
|
||||||
|
}
|
||||||
|
else if (propData.Spawnable != null)
|
||||||
|
{
|
||||||
|
propData.Spawnable.Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
//if an undo attempt is made right after spawning a prop, the
|
||||||
|
//spawnable & wrapper will both be null, so the delete request
|
||||||
|
//will be ignored- same with Delete All button in Menu now
|
||||||
|
|
||||||
|
//so the bug causing props to get stuck is due to the propData
|
||||||
|
//being wiped before the prop spawnable & wrapper were created
|
||||||
|
|
||||||
|
//i am unsure if i should attempt an undo of second in line prop,
|
||||||
|
//just in case some issue happens and causes the mod to lock up here.
|
||||||
|
//It should be fine though, as reloading world should clear propData...?
|
||||||
|
}
|
||||||
|
|
||||||
private static bool IsPropSpawnAllowed()
|
private static bool IsPropSpawnAllowed()
|
||||||
{
|
{
|
||||||
return MetaPort.Instance.worldAllowProps
|
return MetaPort.Instance.worldAllowProps
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue