[OriginShift] Fixed for 2025r181-hf2

This commit is contained in:
NotAKidoS 2025-12-30 03:14:32 -06:00
parent ce30784789
commit 0da225b05c
2 changed files with 10 additions and 6 deletions

View file

@ -37,7 +37,7 @@ public class OriginShiftMod : MelonMod
ApplyPatches(typeof(Patches.CVRObjectSyncPatches)); // remote object pos ApplyPatches(typeof(Patches.CVRObjectSyncPatches)); // remote object pos
ApplyPatches(typeof(Patches.DbJobsAvatarManagerPatches)); // dynamic bones ApplyPatches(typeof(Patches.DbJobsAvatarManagerPatches)); // dynamic bones
ApplyPatches(typeof(Patches.CVRPortalManagerPatches)); // portals ApplyPatches(typeof(Patches.AbstractPortalControllerPatches)); // portals
ApplyPatches(typeof(Patches.RCC_SkidmarksManagerPatches)); // skidmarks ApplyPatches(typeof(Patches.RCC_SkidmarksManagerPatches)); // skidmarks
ApplyPatches(typeof(Patches.CVRPickupObjectPatches)); // pickup object respawn height ApplyPatches(typeof(Patches.CVRPickupObjectPatches)); // pickup object respawn height

View file

@ -7,6 +7,7 @@ using ABI_RC.Core.Util;
using ABI_RC.Systems.Camera; using ABI_RC.Systems.Camera;
using ABI_RC.Systems.Communications.Networking; using ABI_RC.Systems.Communications.Networking;
using ABI_RC.Systems.Movement; using ABI_RC.Systems.Movement;
using ABI_RC.Systems.PortalsV2;
using ABI.CCK.Components; using ABI.CCK.Components;
using DarkRift; using DarkRift;
using HarmonyLib; using HarmonyLib;
@ -250,19 +251,22 @@ internal static class DbJobsAvatarManagerPatches
} }
} }
// CVRPortalManager // AbstractPortalController
internal static class CVRPortalManagerPatches internal static class AbstractPortalControllerPatches
{ {
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(CVRPortalManager), nameof(CVRPortalManager.Start))] [HarmonyPatch(typeof(AbstractPortalController), nameof(AbstractPortalController.Setup))]
private static void Postfix_CVRPortalManager_Start(ref CVRPortalManager __instance) private static void Postfix_AbstractPortalManager_Setup(ref AbstractPortalController __instance)
{ {
if (__instance.PortalSoul.portalType == PortalType.World)
return; // only care about user portals
// parent portal to the object below it using a physics cast // parent portal to the object below it using a physics cast
Transform portalTransform = __instance.transform; Transform portalTransform = __instance.transform;
Vector3 origin = portalTransform.position; Vector3 origin = portalTransform.position;
Vector3 direction = Vector3.down; Vector3 direction = Vector3.down;
if (Physics.Raycast(origin, direction, out RaycastHit hit, 0.5f)) if (Physics.Raycast(origin, direction, out RaycastHit hit, 0.5f))
portalTransform.SetParent(hit.transform); portalTransform.SetParent(hit.transform, true);
} }
} }