using QSB.Events; using QSB.Patches; using UnityEngine; namespace QSB.ShipSync.Patches { class ShipPatches : QSBPatch { public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect; public override void DoPatches() { QSBCore.HarmonyHelper.AddPrefix("OnPressInteract", typeof(ShipPatches), nameof(HatchController_OnPressInteract)); QSBCore.HarmonyHelper.AddPrefix("OnEntry", typeof(ShipPatches), nameof(HatchController_OnEntry)); } public override void DoUnpatches() { QSBCore.HarmonyHelper.Unpatch("OnPressInteract"); QSBCore.HarmonyHelper.Unpatch("OnEntry"); } public static bool HatchController_OnPressInteract() { QSBEventManager.FireEvent(EventNames.QSBHatchState, true); return true; } public static bool HatchController_OnEntry(GameObject hitObj) { if (hitObj.CompareTag("PlayerDetector")) { QSBEventManager.FireEvent(EventNames.QSBHatchState, false); } return true; } } }