mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-29 09:32:38 +00:00
67 lines
1.6 KiB
C#
67 lines
1.6 KiB
C#
using HarmonyLib;
|
|
using QSB.EchoesOfTheEye.SlideProjectors.Messages;
|
|
using QSB.EchoesOfTheEye.SlideProjectors.WorldObjects;
|
|
using QSB.Messaging;
|
|
using QSB.Patches;
|
|
using QSB.WorldSync;
|
|
|
|
namespace QSB.EchoesOfTheEye.SlideProjectors.Patches;
|
|
|
|
[HarmonyPatch(typeof(SlideProjector))]
|
|
public class SlideProjectorPatches : QSBPatch
|
|
{
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(nameof(SlideProjector.OnPressInteract))]
|
|
public static void OnPressInteract(SlideProjector __instance)
|
|
{
|
|
if (!QSBWorldSync.AllObjectsReady)
|
|
{
|
|
return;
|
|
}
|
|
__instance.GetWorldObject<QSBSlideProjector>().SendMessage(new UseSlideProjectorMessage(true));
|
|
}
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(nameof(SlideProjector.CancelInteraction))]
|
|
public static void CancelInteraction(SlideProjector __instance)
|
|
{
|
|
if (!QSBWorldSync.AllObjectsReady)
|
|
{
|
|
return;
|
|
}
|
|
__instance.GetWorldObject<QSBSlideProjector>().SendMessage(new UseSlideProjectorMessage(false));
|
|
}
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(nameof(SlideProjector.NextSlide))]
|
|
public static void NextSlide(SlideProjector __instance)
|
|
{
|
|
if (Remote)
|
|
{
|
|
return;
|
|
}
|
|
if (!QSBWorldSync.AllObjectsReady)
|
|
{
|
|
return;
|
|
}
|
|
__instance.GetWorldObject<QSBSlideProjector>().SendMessage(new NextSlideMessage());
|
|
}
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(nameof(SlideProjector.PreviousSlide))]
|
|
public static void PreviousSlide(SlideProjector __instance)
|
|
{
|
|
if (Remote)
|
|
{
|
|
return;
|
|
}
|
|
if (!QSBWorldSync.AllObjectsReady)
|
|
{
|
|
return;
|
|
}
|
|
__instance.GetWorldObject<QSBSlideProjector>().SendMessage(new PreviousSlideMessage());
|
|
}
|
|
}
|