[OriginShift] Fix Spawnable & Object Sync cached net pos

This commit is contained in:
NotAKidoS 2024-06-18 15:47:03 -05:00
parent ab8ccbb67f
commit 512ffe38b8
3 changed files with 100 additions and 1 deletions

View file

@ -63,9 +63,10 @@ internal static class CVRSpawnablePatches
[HarmonyPatch(typeof(CVRSpawnable), nameof(CVRSpawnable.Start))]
private static void Postfix_CVRSpawnable_Start(ref CVRSpawnable __instance)
{
Transform wrapper = __instance.transform.parent;
__instance.AddComponentIfMissing<OriginShiftSpawnableReceiver>();
// test adding to the wrapper of the spawnable
Transform wrapper = __instance.transform.parent;
wrapper.AddComponentIfMissing<OriginShiftTransformReceiver>();
wrapper.AddComponentIfMissing<OriginShiftParticleSystemReceiver>();
wrapper.AddComponentIfMissing<OriginShiftTrailRendererReceiver>();
@ -215,6 +216,13 @@ internal static class CVRSyncHelperPatches
internal static class CVRObjectSyncPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(CVRObjectSync), nameof(CVRObjectSync.Start))]
private static void Postfix_CVRObjectSync_Start(ref CVRObjectSync __instance)
{
__instance.gameObject.AddComponentIfMissing<OriginShiftObjectSyncReceiver>();
}
[HarmonyPrefix] // inbound object sync
[HarmonyPatch(typeof(CVRObjectSync), nameof(CVRObjectSync.receiveNetworkData))]
[HarmonyPatch(typeof(CVRObjectSync), nameof(CVRObjectSync.receiveNetworkDataJoin))]