2022-04-05 23:08:30 -07:00
|
|
|
|
using HarmonyLib;
|
2022-04-05 23:18:42 -07:00
|
|
|
|
using QSB.EchoesOfTheEye.GrappleTotemSync.Messages;
|
|
|
|
|
using QSB.EchoesOfTheEye.GrappleTotemSync.WorldObjects;
|
2022-04-05 23:08:30 -07:00
|
|
|
|
using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
|
2022-04-05 23:18:42 -07:00
|
|
|
|
using QSB.Messaging;
|
2022-04-05 23:08:30 -07:00
|
|
|
|
using QSB.Patches;
|
|
|
|
|
using QSB.WorldSync;
|
|
|
|
|
|
|
|
|
|
namespace QSB.EchoesOfTheEye.GrappleTotemSync.Patches;
|
|
|
|
|
|
|
|
|
|
public class GrappleTotemPatches : QSBPatch
|
|
|
|
|
{
|
|
|
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
|
|
|
|
|
|
|
|
|
[HarmonyPrefix]
|
|
|
|
|
[HarmonyPatch(typeof(LanternZoomPoint), nameof(LanternZoomPoint.OnDetectLight))]
|
|
|
|
|
private static bool OnDetectLight(LanternZoomPoint __instance) =>
|
|
|
|
|
!QSBWorldSync.AllObjectsReady ||
|
2022-05-26 21:23:05 -07:00
|
|
|
|
__instance._lightSensor.GetWorldObject<QSBLightSensor>().LocallyIlluminated;
|
2022-04-05 23:18:42 -07:00
|
|
|
|
|
|
|
|
|
[HarmonyPostfix]
|
|
|
|
|
[HarmonyPatch(typeof(LanternZoomPoint), nameof(LanternZoomPoint.StartZoomIn))]
|
|
|
|
|
private static void StartZoomIn(LanternZoomPoint __instance)
|
|
|
|
|
{
|
|
|
|
|
if (__instance._totemAnimator != null && QSBWorldSync.AllObjectsReady)
|
|
|
|
|
{
|
|
|
|
|
__instance.GetWorldObject<QSBGrappleTotem>()
|
|
|
|
|
.SendMessage(new GrappleAnimateMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-05 23:08:30 -07:00
|
|
|
|
}
|