using Audio; namespace Harmony.XUiC_MapWaypointListPatches { internal class XUiC_MapWaypointListPatches { [HarmonyPatch(typeof(XUiC_MapWaypointList))] [HarmonyPatch("onWaypointRemovePressed")] public class onWaypointRemovePressedPatch { public static bool Prefix(XUiC_MapWaypointList __instance, XUiController _sender, int _mouseButton) { //Log.Out("XUiC_MapWaypointListPatches-onWaypointRemovePressed START"); EntityPlayerLocal entityPlayer = __instance.xui.playerUI.entityPlayer; Waypoint waypoint = __instance.GetSelectedWaypoint(); if (waypoint != null) { //Log.Out("XUiC_MapWaypointListPatches-onWaypointRemovePressed 1"); entityPlayer.Waypoints.Collection.Remove(waypoint); NavObjectManager.Instance.UnRegisterNavObject(waypoint.navObject); __instance.UpdateWaypointsList(null); __instance.SelectedWaypoint = null; if (__instance.SelectedWaypointEntry != null) { __instance.SelectedWaypointEntry.Selected = false; } Manager.PlayInsidePlayerHead("ui_waypoint_delete", -1, 0f, false); return false; } //Log.Out("XUiC_MapWaypointListPatches-onWaypointRemovePressed 2"); Manager.PlayInsidePlayerHead("ui_denied", -1, 0f, false); return false; } } } }