mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-29 09:32:38 +00:00
54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
using HarmonyLib;
|
|
using QSB.EchoesOfTheEye.DreamRafts.Messages;
|
|
using QSB.EchoesOfTheEye.DreamRafts.WorldObjects;
|
|
using QSB.Messaging;
|
|
using QSB.Patches;
|
|
using QSB.WorldSync;
|
|
|
|
namespace QSB.EchoesOfTheEye.DreamRafts.Patches;
|
|
|
|
public class DreamRaftPatches : QSBPatch
|
|
{
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(typeof(DreamRaftProjector), nameof(DreamRaftProjector.RespawnRaft))]
|
|
private static void RespawnRaft(DreamRaftProjector __instance)
|
|
{
|
|
if (Remote)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!QSBWorldSync.AllObjectsReady)
|
|
{
|
|
return;
|
|
}
|
|
|
|
__instance.GetWorldObject<QSBDreamRaftProjector>()
|
|
.SendMessage(new RespawnRaftMessage());
|
|
}
|
|
|
|
/// <summary>
|
|
/// make the projectors invisible,
|
|
/// but don't change the lit state
|
|
/// or sync anything.
|
|
/// </summary>
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(typeof(DreamRaftProjector), nameof(DreamRaftProjector.ExtinguishImmediately))]
|
|
private static bool ExtinguishImmediately(DreamRaftProjector __instance)
|
|
{
|
|
if (!__instance._lit)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
foreach (var projection in __instance._projections)
|
|
{
|
|
projection.SetVisibleImmediate(false, true);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|