mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[OriginShift] Fixed pickup object respawn height
This commit is contained in:
parent
a03a0c4884
commit
773c651291
5 changed files with 61 additions and 9 deletions
|
@ -44,6 +44,7 @@ public class OriginShiftMod : MelonMod
|
||||||
ApplyPatches(typeof(Patches.DbJobsAvatarManagerPatches)); // dynamic bones
|
ApplyPatches(typeof(Patches.DbJobsAvatarManagerPatches)); // dynamic bones
|
||||||
ApplyPatches(typeof(Patches.CVRPortalManagerPatches)); // portals
|
ApplyPatches(typeof(Patches.CVRPortalManagerPatches)); // portals
|
||||||
ApplyPatches(typeof(Patches.RCC_SkidmarksManagerPatches)); // skidmarks
|
ApplyPatches(typeof(Patches.RCC_SkidmarksManagerPatches)); // skidmarks
|
||||||
|
ApplyPatches(typeof(Patches.CVRPickupObjectPatches)); // pickup object respawn height
|
||||||
|
|
||||||
ApplyPatches(typeof(Patches.PortableCameraPatches)); // camera occlusion culling
|
ApplyPatches(typeof(Patches.PortableCameraPatches)); // camera occlusion culling
|
||||||
ApplyPatches(typeof(Patches.PathingCameraPatches)); // camera occlusion culling
|
ApplyPatches(typeof(Patches.PathingCameraPatches)); // camera occlusion culling
|
||||||
|
|
|
@ -17,7 +17,6 @@ public class OriginShiftObjectSyncReceiver : MonoBehaviour
|
||||||
OriginShiftMod.Logger.Error("OriginShiftObjectSyncReceiver: No CVRObjectSync found on GameObject: " + gameObject.name, this);
|
OriginShiftMod.Logger.Error("OriginShiftObjectSyncReceiver: No CVRObjectSync found on GameObject: " + gameObject.name, this);
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
OriginShiftManager.OnOriginShifted += OnOriginShifted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
using ABI.CCK.Components;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NAK.OriginShift;
|
||||||
|
|
||||||
|
public class OriginShiftPickupObjectReceiver : MonoBehaviour
|
||||||
|
{
|
||||||
|
private CVRPickupObject _pickupObject;
|
||||||
|
|
||||||
|
#region Unity Events
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
_pickupObject = GetComponent<CVRPickupObject>();
|
||||||
|
if (_pickupObject == null)
|
||||||
|
{
|
||||||
|
OriginShiftMod.Logger.Error("OriginShiftPickupObjectReceiver requires a CVRPickupObject component!");
|
||||||
|
enabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
OriginShiftManager.OnOriginShifted += OnOriginShifted;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
OriginShiftManager.OnOriginShifted -= OnOriginShifted;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Unity Events
|
||||||
|
|
||||||
|
#region Origin Shift Events
|
||||||
|
|
||||||
|
private void OnOriginShifted(Vector3 shift)
|
||||||
|
{
|
||||||
|
_pickupObject._respawnHeight += shift.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Origin Shift Events
|
||||||
|
}
|
|
@ -17,7 +17,6 @@ public class OriginShiftSpawnableReceiver : MonoBehaviour
|
||||||
OriginShiftMod.Logger.Error("OriginShiftSpawnableReceiver: No CVRSpawnable found on GameObject: " + gameObject.name, this);
|
OriginShiftMod.Logger.Error("OriginShiftSpawnableReceiver: No CVRSpawnable found on GameObject: " + gameObject.name, this);
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
OriginShiftManager.OnOriginShifted += OnOriginShifted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
|
|
|
@ -63,7 +63,7 @@ internal static class CVRSpawnablePatches
|
||||||
[HarmonyPatch(typeof(CVRSpawnable), nameof(CVRSpawnable.Start))]
|
[HarmonyPatch(typeof(CVRSpawnable), nameof(CVRSpawnable.Start))]
|
||||||
private static void Postfix_CVRSpawnable_Start(ref CVRSpawnable __instance)
|
private static void Postfix_CVRSpawnable_Start(ref CVRSpawnable __instance)
|
||||||
{
|
{
|
||||||
//__instance.AddComponentIfMissing<OriginShiftSpawnableReceiver>(); //todo: investigate if this is needed
|
__instance.AddComponentIfMissing<OriginShiftSpawnableReceiver>(); //todo: investigate if this is needed
|
||||||
|
|
||||||
// test adding to the wrapper of the spawnable
|
// test adding to the wrapper of the spawnable
|
||||||
Transform wrapper = __instance.transform.parent;
|
Transform wrapper = __instance.transform.parent;
|
||||||
|
@ -216,12 +216,12 @@ internal static class CVRSyncHelperPatches
|
||||||
|
|
||||||
internal static class CVRObjectSyncPatches
|
internal static class CVRObjectSyncPatches
|
||||||
{
|
{
|
||||||
// [HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
// [HarmonyPatch(typeof(CVRObjectSync), nameof(CVRObjectSync.Start))]
|
[HarmonyPatch(typeof(CVRObjectSync), nameof(CVRObjectSync.Start))]
|
||||||
// private static void Postfix_CVRObjectSync_Start(ref CVRObjectSync __instance)
|
private static void Postfix_CVRObjectSync_Start(ref CVRObjectSync __instance)
|
||||||
// {
|
{
|
||||||
// __instance.gameObject.AddComponentIfMissing<OriginShiftObjectSyncReceiver>(); // todo: investigate if this is needed
|
__instance.gameObject.AddComponentIfMissing<OriginShiftObjectSyncReceiver>(); // todo: investigate if this is needed
|
||||||
// }
|
}
|
||||||
|
|
||||||
[HarmonyPrefix] // inbound object sync
|
[HarmonyPrefix] // inbound object sync
|
||||||
[HarmonyPatch(typeof(CVRObjectSync), nameof(CVRObjectSync.receiveNetworkData))]
|
[HarmonyPatch(typeof(CVRObjectSync), nameof(CVRObjectSync.receiveNetworkData))]
|
||||||
|
@ -282,4 +282,14 @@ internal static class CVRPortalManagerPatches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static class CVRPickupObjectPatches
|
||||||
|
{
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(CVRPickupObject), nameof(CVRPickupObject.Start))]
|
||||||
|
private static void Postfix_CVRPickupObject_Start(ref CVRPickupObject __instance)
|
||||||
|
{
|
||||||
|
__instance.gameObject.AddComponentIfMissing<OriginShiftPickupObjectReceiver>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue