patch DreamWorldController.ExtinguishDreamRaft since we want to prevent _lastUsedRaftProjector from being null (since we dont actually extinguish the raft)

This commit is contained in:
JohnCorby 2022-10-06 16:18:44 -07:00
parent 5b18f682d6
commit 344ccbc1e0

View File

@ -62,17 +62,21 @@ public class DreamRaftPatches : QSBPatch
/// 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)
[HarmonyPatch(typeof(DreamWorldController), nameof(DreamWorldController.ExtinguishDreamRaft))]
private static bool ExtinguishDreamRaft(DreamWorldController __instance)
{
if (!QSBWorldSync.AllObjectsReady)
{
return true;
}
// still release authority over the raft tho
__instance._dreamRaftProjection.GetComponent<DreamRaftController>().GetWorldObject<QSBDreamRaft>()
.NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Remove);
if (__instance._lastUsedRaftProjector)
{
// still release authority over the raft tho
__instance._lastUsedRaftProjector
._dreamRaftProjection.GetComponent<DreamRaftController>().GetWorldObject<QSBDreamRaft>()
.NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Remove);
}
return false;
}