2022-01-21 21:54:58 +00:00
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using QSB.EchoesOfTheEye.SlideProjectors.Messages;
|
|
|
|
|
using QSB.EchoesOfTheEye.SlideProjectors.WorldObjects;
|
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.Patches;
|
|
|
|
|
using QSB.Player;
|
|
|
|
|
using QSB.WorldSync;
|
|
|
|
|
|
2022-02-27 04:40:44 -08:00
|
|
|
|
namespace QSB.EchoesOfTheEye.SlideProjectors.Patches
|
2022-01-21 21:54:58 +00:00
|
|
|
|
{
|
2022-02-27 04:40:44 -08:00
|
|
|
|
internal class ProjectorPatches : QSBPatch
|
|
|
|
|
{
|
|
|
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
2022-01-21 21:54:58 +00:00
|
|
|
|
|
2022-02-27 04:40:44 -08:00
|
|
|
|
[HarmonyPostfix]
|
|
|
|
|
[HarmonyPatch(typeof(SlideProjector), nameof(SlideProjector.OnPressInteract))]
|
|
|
|
|
public static void Interact(SlideProjector __instance) =>
|
|
|
|
|
__instance.GetWorldObject<QSBSlideProjector>()
|
|
|
|
|
.SendMessage(new ProjectorAuthorityMessage(QSBPlayerManager.LocalPlayerId));
|
2022-01-21 21:54:58 +00:00
|
|
|
|
|
2022-02-27 04:40:44 -08:00
|
|
|
|
[HarmonyPostfix]
|
|
|
|
|
[HarmonyPatch(typeof(SlideProjector), nameof(SlideProjector.CancelInteraction))]
|
|
|
|
|
public static void CancelInteract(SlideProjector __instance) =>
|
|
|
|
|
__instance.GetWorldObject<QSBSlideProjector>()
|
|
|
|
|
.SendMessage(new ProjectorAuthorityMessage(0));
|
2022-01-21 21:54:58 +00:00
|
|
|
|
|
2022-02-27 04:40:44 -08:00
|
|
|
|
[HarmonyPostfix]
|
|
|
|
|
[HarmonyPatch(typeof(SlideProjector), nameof(SlideProjector.NextSlide))]
|
|
|
|
|
public static void NextSlide(SlideProjector __instance) =>
|
|
|
|
|
__instance.GetWorldObject<QSBSlideProjector>()
|
|
|
|
|
.SendMessage(new NextSlideMessage());
|
2022-01-21 21:54:58 +00:00
|
|
|
|
|
2022-02-27 04:40:44 -08:00
|
|
|
|
[HarmonyPostfix]
|
|
|
|
|
[HarmonyPatch(typeof(SlideProjector), nameof(SlideProjector.PreviousSlide))]
|
|
|
|
|
public static void PreviousSlide(SlideProjector __instance) =>
|
|
|
|
|
__instance.GetWorldObject<QSBSlideProjector>()
|
|
|
|
|
.SendMessage(new PreviousSlideMessage());
|
|
|
|
|
}
|
2022-02-24 22:04:54 -08:00
|
|
|
|
}
|