From ec3e1520ed5c6bd640134a4bbfbf9dcad4e9fc8c Mon Sep 17 00:00:00 2001 From: MS-crew <100300664+MS-crew@users.noreply.github.com> Date: Fri, 29 Aug 2025 22:33:22 +0300 Subject: [PATCH 1/4] Create FixCapturePosition.cs --- .../Patches/Fixes/FixCapturePosition.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs diff --git a/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs b/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs new file mode 100644 index 0000000000..ff02340f58 --- /dev/null +++ b/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs @@ -0,0 +1,36 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Fixes +{ + using CustomPlayerEffects; + using Exiled.API.Enums; + using Exiled.API.Features; + using HarmonyLib; + using RelativePositioning; + using UnityEngine; + + /// + /// Patches 's setter. + /// Fix for those who go to pocket without effect and to get empty or null capture position and fall into the void. + /// + [HarmonyPatch(typeof(PocketCorroding), nameof(PocketCorroding.CapturePosition), MethodType.Getter)] + internal class FixCapturePosition + { + private const RoomType DefaultRoomType = RoomType.Surface; + +#pragma warning disable SA1313 // Parameter names should begin with lower-case letter + private static void Postfix(PocketCorroding __instance, ref RelativePosition __result) + { + if (__result.Position != Vector3.zero) + return; + + Room room = Room.Get(DefaultRoomType); + __result = new RelativePosition(room.Position); + } + } +} From c3158f8457292787eb6e962945788e70d2f666a5 Mon Sep 17 00:00:00 2001 From: MS-crew <100300664+MS-crew@users.noreply.github.com> Date: Sat, 30 Aug 2025 00:04:29 +0300 Subject: [PATCH 2/4] Update FixCapturePosition.cs --- EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs b/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs index ff02340f58..ee1a2c9136 100644 --- a/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs +++ b/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs @@ -24,7 +24,7 @@ internal class FixCapturePosition private const RoomType DefaultRoomType = RoomType.Surface; #pragma warning disable SA1313 // Parameter names should begin with lower-case letter - private static void Postfix(PocketCorroding __instance, ref RelativePosition __result) + private static void Postfix(ref RelativePosition __result) { if (__result.Position != Vector3.zero) return; From 4f4edf90405b281f19ab822052acd49a6f296296 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Tue, 2 Sep 2025 18:51:02 +0200 Subject: [PATCH 3/4] Update EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs --- EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs b/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs index ee1a2c9136..413489a0fd 100644 --- a/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs +++ b/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs @@ -21,7 +21,7 @@ namespace Exiled.Events.Patches.Fixes [HarmonyPatch(typeof(PocketCorroding), nameof(PocketCorroding.CapturePosition), MethodType.Getter)] internal class FixCapturePosition { - private const RoomType DefaultRoomType = RoomType.Surface; + private const RoomType DefaultRoomType = RoomType.Hcz106; #pragma warning disable SA1313 // Parameter names should begin with lower-case letter private static void Postfix(ref RelativePosition __result) From 02e3699be25eb3eeba9611d3cdbbe703775545d6 Mon Sep 17 00:00:00 2001 From: MS-crew <100300664+MS-crew@users.noreply.github.com> Date: Wed, 3 Sep 2025 18:25:41 +0300 Subject: [PATCH 4/4] Update FixCapturePosition.cs --- EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs b/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs index 413489a0fd..cadbc403f0 100644 --- a/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs +++ b/EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Fixes using HarmonyLib; using RelativePositioning; using UnityEngine; - +#pragma warning disable SA1313 // Parameter names should begin with lower-case letter /// /// Patches 's setter. /// Fix for those who go to pocket without effect and to get empty or null capture position and fall into the void. @@ -23,10 +23,9 @@ internal class FixCapturePosition { private const RoomType DefaultRoomType = RoomType.Hcz106; -#pragma warning disable SA1313 // Parameter names should begin with lower-case letter private static void Postfix(ref RelativePosition __result) { - if (__result.Position != Vector3.zero) + if (Room.Get(__result.Position) != null) return; Room room = Room.Get(DefaultRoomType);