mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-29 18:32:45 +00:00
Merge branch 'dev' of https://github.com/misternebula/quantum-space-buddies into dev
This commit is contained in:
commit
86a177bae4
@ -30,12 +30,6 @@ internal class ProjectorPatches : QSBPatch
|
||||
return;
|
||||
}
|
||||
|
||||
// todo remove after removing QSBDreamRaftProjector
|
||||
if (__instance is DreamRaftProjector)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
__instance.GetWorldObject<QSBDreamObjectProjector>()
|
||||
.SendMessage(new ProjectorLitMessage(false));
|
||||
}
|
||||
|
@ -11,5 +11,5 @@ internal class ProjectorManager : WorldObjectManager
|
||||
public override bool DlcOnly => true;
|
||||
|
||||
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct)
|
||||
=> QSBWorldSync.Init<QSBDreamObjectProjector, DreamObjectProjector>(typeof(DreamRaftProjector) /*todo remove after removing QSBDreamRaftProjector*/);
|
||||
=> QSBWorldSync.Init<QSBDreamObjectProjector, DreamObjectProjector>();
|
||||
}
|
||||
|
@ -14,8 +14,5 @@ public class DreamRaftManager : WorldObjectManager
|
||||
{
|
||||
QSBWorldSync.Init<QSBDreamRaft, DreamRaftController>();
|
||||
QSBWorldSync.Init<QSBSealRaft, SealRaftController>();
|
||||
|
||||
QSBWorldSync.Init<QSBDreamRaftProjector, DreamRaftProjector>();
|
||||
QSBWorldSync.Init<QSBDreamRaftProjection, DreamRaftProjection>();
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
using QSB.EchoesOfTheEye.DreamRafts.WorldObjects;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.DreamRafts.Messages;
|
||||
|
||||
public class ExtinguishMessage : QSBWorldObjectMessage<QSBDreamRaftProjection>
|
||||
{
|
||||
public override void OnReceiveRemote() =>
|
||||
QSBPatch.RemoteCall(() => WorldObject.AttachedObject.SetVisible(false));
|
||||
}
|
14
QSB/EchoesOfTheEye/DreamRafts/Messages/RespawnRaftMessage.cs
Normal file
14
QSB/EchoesOfTheEye/DreamRafts/Messages/RespawnRaftMessage.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using QSB.EchoesOfTheEye.DreamObjectProjectors.WorldObject;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.DreamRafts.Messages;
|
||||
|
||||
public class RespawnRaftMessage : QSBWorldObjectMessage<QSBDreamObjectProjector>
|
||||
{
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
var attachedObject = (DreamRaftProjector)WorldObject.AttachedObject;
|
||||
QSBPatch.RemoteCall(attachedObject.RespawnRaft);
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
using QSB.EchoesOfTheEye.DreamRafts.WorldObjects;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.DreamRafts.Messages;
|
||||
|
||||
public class SpawnRaftMessage : QSBWorldObjectMessage<QSBDreamRaftProjector>
|
||||
{
|
||||
public override void OnReceiveRemote() =>
|
||||
QSBPatch.RemoteCall(WorldObject.AttachedObject.RespawnRaft);
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
using HarmonyLib;
|
||||
using QSB.EchoesOfTheEye.DreamObjectProjectors.WorldObject;
|
||||
using QSB.EchoesOfTheEye.DreamRafts.Messages;
|
||||
using QSB.EchoesOfTheEye.DreamRafts.WorldObjects;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
using QSB.WorldSync;
|
||||
using System.Linq;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.DreamRafts.Patches;
|
||||
|
||||
@ -13,8 +12,8 @@ public class DreamRaftPatches : QSBPatch
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DreamRaftProjector), nameof(DreamRaftProjector.SpawnRaft))]
|
||||
private static void SpawnRaft(DreamRaftProjector __instance)
|
||||
[HarmonyPatch(typeof(DreamRaftProjector), nameof(DreamRaftProjector.RespawnRaft))]
|
||||
private static void RespawnRaft(DreamRaftProjector __instance)
|
||||
{
|
||||
if (Remote)
|
||||
{
|
||||
@ -26,30 +25,30 @@ public class DreamRaftPatches : QSBPatch
|
||||
return;
|
||||
}
|
||||
|
||||
__instance.GetWorldObject<QSBDreamRaftProjector>()
|
||||
.SendMessage(new SpawnRaftMessage());
|
||||
__instance.GetWorldObject<QSBDreamObjectProjector>()
|
||||
.SendMessage(new RespawnRaftMessage());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this is only called when:
|
||||
/// - you exit the dream world
|
||||
/// - the raft goes thru the warp volume with you not on it
|
||||
///
|
||||
/// we ignore both of these.
|
||||
/// we DO still suspend the raft so it's not visible.
|
||||
/// </summary>
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DreamRaftProjection), nameof(DreamRaftProjection.OnCandleLitStateChanged))]
|
||||
private static bool OnCandleLitStateChanged(DreamRaftProjection __instance)
|
||||
[HarmonyPatch(typeof(DreamRaftProjector), nameof(DreamRaftProjector.ExtinguishImmediately))]
|
||||
private static bool ExtinguishImmediately(DreamRaftProjector __instance)
|
||||
{
|
||||
if (!__instance._visible)
|
||||
if (!__instance._lit)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (__instance._candles.Any(x => x.IsLit()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
__instance.SetVisible(false);
|
||||
if (!Remote && QSBWorldSync.AllObjectsReady)
|
||||
{
|
||||
__instance.GetWorldObject<QSBDreamRaftProjection>()
|
||||
.SendMessage(new ExtinguishMessage());
|
||||
}
|
||||
var projection = __instance._dreamRaftProjection;
|
||||
projection._body.Suspend();
|
||||
projection._waitingToSuspend = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.DreamRafts.WorldObjects;
|
||||
|
||||
public class QSBDreamRaftProjection : WorldObject<DreamRaftProjection>
|
||||
{
|
||||
public override void SendInitialState(uint to) { }
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
using QSB.EchoesOfTheEye.DreamRafts.Messages;
|
||||
using QSB.Messaging;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.DreamRafts.WorldObjects;
|
||||
|
||||
public class QSBDreamRaftProjector : WorldObject<DreamRaftProjector>
|
||||
{
|
||||
public override void SendInitialState(uint to)
|
||||
{
|
||||
if (AttachedObject._lit)
|
||||
{
|
||||
this.SendMessage(new SpawnRaftMessage { To = to });
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user