mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-04 02:47:22 +00:00
dream candles: add toggle to not send messages for funny dream raft bug
This commit is contained in:
parent
c70bdb0a49
commit
c3c6831208
@ -11,6 +11,8 @@ public class DreamCandlePatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public static bool DontSendMessage;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DreamCandle), nameof(DreamCandle.SetLit))]
|
||||
private static void SetLit(DreamCandle __instance,
|
||||
@ -31,6 +33,11 @@ public class DreamCandlePatches : QSBPatch
|
||||
return;
|
||||
}
|
||||
|
||||
if (DontSendMessage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
__instance.GetWorldObject<QSBDreamCandle>()
|
||||
.SendMessage(new SetLitMessage(lit, playAudio, instant));
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
using HarmonyLib;
|
||||
using QSB.EchoesOfTheEye.DreamCandles.Patches;
|
||||
using QSB.EchoesOfTheEye.DreamObjectProjectors.WorldObject;
|
||||
using QSB.EchoesOfTheEye.DreamRafts.Messages;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.DreamRafts.Patches;
|
||||
@ -13,7 +15,7 @@ public class DreamRaftPatches : QSBPatch
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DreamRaftProjector), nameof(DreamRaftProjector.RespawnRaft))]
|
||||
private static void RespawnRaft(DreamRaftProjector __instance)
|
||||
private static void RespawnRaft_Prefix(DreamRaftProjector __instance)
|
||||
{
|
||||
if (Remote)
|
||||
{
|
||||
@ -27,6 +29,26 @@ public class DreamRaftPatches : QSBPatch
|
||||
|
||||
__instance.GetWorldObject<QSBDreamObjectProjector>()
|
||||
.SendMessage(new RespawnRaftMessage());
|
||||
|
||||
// since respawning extinguishes all the candles, but we already have the above message
|
||||
DreamCandlePatches.DontSendMessage = true;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(DreamRaftProjector), nameof(DreamRaftProjector.RespawnRaft))]
|
||||
private static void RespawnRaft_Postfix(DreamRaftProjector __instance)
|
||||
{
|
||||
if (Remote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QSBWorldSync.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DreamCandlePatches.DontSendMessage = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -34,22 +56,17 @@ public class DreamRaftPatches : QSBPatch
|
||||
/// - 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.
|
||||
/// this is to suspend the raft so it doesn't fall endlessly.
|
||||
/// however, it's okay if it does that,
|
||||
/// and we don't want it to extinguish with other players on it.
|
||||
/// </summary>
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DreamRaftProjector), nameof(DreamRaftProjector.ExtinguishImmediately))]
|
||||
private static bool ExtinguishImmediately(DreamRaftProjector __instance)
|
||||
{
|
||||
if (!__instance._lit)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
private static bool ExtinguishImmediately()
|
||||
=> false;
|
||||
|
||||
var projection = __instance._dreamRaftProjection;
|
||||
projection._body.Suspend();
|
||||
projection._waitingToSuspend = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DreamRaftProjection), nameof(DreamRaftProjection.UpdateVisibility))]
|
||||
private static void UpdateVisibility(DreamRaftProjection __instance, bool immediate = false) =>
|
||||
DebugLog.DebugWrite($"DreamRaftProjection.UpdateVisibility | {__instance._visible} | {immediate} | {Remote}");
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class DebugActions : MonoBehaviour, IAddComponentOnStart
|
||||
{
|
||||
var relativeLocation = new RelativeLocationData(Vector3.up * 2 + Vector3.forward * 2, Quaternion.identity, Vector3.zero);
|
||||
|
||||
var location = Keyboard.current[Key.LeftShift].isPressed ? DreamArrivalPoint.Location.Zone4 : DreamArrivalPoint.Location.Zone2;
|
||||
var location = Keyboard.current[Key.LeftShift].isPressed ? DreamArrivalPoint.Location.Zone4 : DreamArrivalPoint.Location.Zone3;
|
||||
var arrivalPoint = Locator.GetDreamArrivalPoint(location);
|
||||
var dreamCampfire = Locator.GetDreamCampfire(location);
|
||||
if (Locator.GetToolModeSwapper().GetItemCarryTool().GetHeldItemType() != ItemType.DreamLantern)
|
||||
|
Loading…
Reference in New Issue
Block a user