///
/// Works.
///
[HarmonyPatch(typeof(WaypointBase), nameof(WaypointBase.SqrDistanceTo))]
public class WaypointOwnerPatch
{
///
/// Hope it works.
///
public static bool HopeItWorks = false;
///
/// I hate.
///
/// i hate.
/// i hat1e.
/// i hat2e.
/// i hat3e.
#pragma warning disable SA1313
public static bool Prefix(WaypointBase __instance, Vector3 pos, ref float __result)
#pragma warning restore SA1313
{
if (__instance is not AdminToyWaypoint toy)
return true;
if (HopeItWorks)
{
__result = 0;
return false;
}
return true;
}
}
///
/// Works.
///
[HarmonyPatch(typeof(FirstPersonMovementModule), nameof(FirstPersonMovementModule.UpdateRelativePosition))]
public class WaypointOwnerPatch_Movement
{
public static bool Prefix()
{
WaypointOwnerPatch.HopeItWorks = true;
return true;
}
public static void Postifx()
{
WaypointOwnerPatch.HopeItWorks = false;
}
}