mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-18 13:23:05 +00:00
38 lines
783 B
C#
38 lines
783 B
C#
using HarmonyLib;
|
|
using QSB.EchoesOfTheEye.DreamCandles.Messages;
|
|
using QSB.EchoesOfTheEye.DreamCandles.WorldObjects;
|
|
using QSB.Messaging;
|
|
using QSB.Patches;
|
|
using QSB.WorldSync;
|
|
|
|
namespace QSB.EchoesOfTheEye.DreamCandles.Patches;
|
|
|
|
public class DreamCandlePatches : QSBPatch
|
|
{
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(typeof(DreamCandle), nameof(DreamCandle.SetLit))]
|
|
private static void SetLit(DreamCandle __instance,
|
|
bool lit, bool playAudio, bool instant)
|
|
{
|
|
if (Remote)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (lit == __instance._lit)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!QSBWorldSync.AllObjectsReady)
|
|
{
|
|
return;
|
|
}
|
|
|
|
__instance.GetWorldObject<QSBDreamCandle>()
|
|
.SendMessage(new SetLitMessage(lit, playAudio, instant));
|
|
}
|
|
}
|