2022-03-29 18:53:19 +01:00
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using QSB.EchoesOfTheEye.DreamObjectProjectors.Messages;
|
|
|
|
|
using QSB.EchoesOfTheEye.DreamObjectProjectors.WorldObject;
|
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.Patches;
|
|
|
|
|
using QSB.WorldSync;
|
|
|
|
|
|
|
|
|
|
namespace QSB.EchoesOfTheEye.DreamObjectProjectors.Patches;
|
|
|
|
|
|
|
|
|
|
internal class ProjectorPatches : QSBPatch
|
|
|
|
|
{
|
|
|
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
|
|
|
|
|
|
|
|
|
[HarmonyPrefix]
|
2022-03-29 12:03:13 -07:00
|
|
|
|
[HarmonyPatch(typeof(DreamObjectProjector), nameof(DreamObjectProjector.SetLit))]
|
|
|
|
|
private static void SetLit(DreamObjectProjector __instance, bool lit)
|
2022-03-29 18:53:19 +01:00
|
|
|
|
{
|
2022-03-29 12:03:13 -07:00
|
|
|
|
if (Remote)
|
2022-03-29 18:53:19 +01:00
|
|
|
|
{
|
2022-03-29 12:03:13 -07:00
|
|
|
|
return;
|
2022-03-29 18:53:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-29 12:03:13 -07:00
|
|
|
|
if (__instance._lit == lit)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!QSBWorldSync.AllObjectsReady)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
__instance.GetWorldObject<QSBDreamObjectProjector>()
|
2022-04-02 19:58:33 +01:00
|
|
|
|
.SendMessage(new ProjectorLitMessage(lit));
|
2022-03-29 18:53:19 +01:00
|
|
|
|
}
|
|
|
|
|
}
|