39 lines
1.4 KiB
C#
Raw Normal View History

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;
namespace QSB.EchoesOfTheEye.SlideProjectors.Patches
2022-01-21 21:54:58 +00:00
{
internal class ProjectorPatches : QSBPatch
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
2022-01-21 21:54:58 +00: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
[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
[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
[HarmonyPostfix]
[HarmonyPatch(typeof(SlideProjector), nameof(SlideProjector.PreviousSlide))]
public static void PreviousSlide(SlideProjector __instance) =>
__instance.GetWorldObject<QSBSlideProjector>()
.SendMessage(new PreviousSlideMessage());
}
}