Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions EXILED/Exiled.Events/Patches/Fixes/FixCapturePosition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// -----------------------------------------------------------------------
// <copyright file="FixCapturePosition.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.Patches.Fixes
{
using CustomPlayerEffects;
using Exiled.API.Enums;
using Exiled.API.Features;
using HarmonyLib;
using RelativePositioning;
using UnityEngine;
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
/// <summary>
/// Patches <see cref="PocketCorroding.CapturePosition" />'s setter.
/// Fix for those who go to pocket without effect and to get empty or null capture position and fall into the void.
/// </summary>
[HarmonyPatch(typeof(PocketCorroding), nameof(PocketCorroding.CapturePosition), MethodType.Getter)]
internal class FixCapturePosition
{
private const RoomType DefaultRoomType = RoomType.Hcz106;

private static void Postfix(ref RelativePosition __result)
{
if (Room.Get(__result.Position) != null)
return;

Room room = Room.Get(DefaultRoomType);
__result = new RelativePosition(room.Position);
}
}
}
Loading