mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-28 03:40:01 +00:00
Fix not being able to join after statue cutscene
This commit is contained in:
parent
85bc05c50f
commit
dddbc0e1c1
@ -4,6 +4,8 @@ using QSB.Menus;
|
|||||||
using QSB.Messaging;
|
using QSB.Messaging;
|
||||||
using QSB.Utility;
|
using QSB.Utility;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using QSB.TimeSync.Patches;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace QSB.SaveSync.Messages;
|
namespace QSB.SaveSync.Messages;
|
||||||
|
|
||||||
@ -19,6 +21,10 @@ public class GameStateMessage : QSBMessage
|
|||||||
private bool[] KnownFrequencies;
|
private bool[] KnownFrequencies;
|
||||||
private Dictionary<int, bool> KnownSignals;
|
private Dictionary<int, bool> KnownSignals;
|
||||||
private bool ReducedFrights;
|
private bool ReducedFrights;
|
||||||
|
private bool IsLoopAfterStatue;
|
||||||
|
private Quaternion StatueRotation;
|
||||||
|
private Vector3 PlayerPosition;
|
||||||
|
private Quaternion PlayerRotation;
|
||||||
|
|
||||||
public GameStateMessage(uint toId)
|
public GameStateMessage(uint toId)
|
||||||
{
|
{
|
||||||
@ -31,6 +37,10 @@ public class GameStateMessage : QSBMessage
|
|||||||
KnownFrequencies = gameSave.knownFrequencies;
|
KnownFrequencies = gameSave.knownFrequencies;
|
||||||
KnownSignals = gameSave.knownSignals;
|
KnownSignals = gameSave.knownSignals;
|
||||||
ReducedFrights = PlayerData.GetReducedFrights();
|
ReducedFrights = PlayerData.GetReducedFrights();
|
||||||
|
IsLoopAfterStatue = TimeLoopPatches.IsLoopAfterStatue;
|
||||||
|
StatueRotation = MemoryUplinkTrigger._savedStatueRotation;
|
||||||
|
PlayerPosition = PlayerSpawner._localResetPos;
|
||||||
|
PlayerRotation = PlayerSpawner._localResetRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Serialize(NetworkWriter writer)
|
public override void Serialize(NetworkWriter writer)
|
||||||
@ -51,6 +61,10 @@ public class GameStateMessage : QSBMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
writer.Write(ReducedFrights);
|
writer.Write(ReducedFrights);
|
||||||
|
writer.Write(IsLoopAfterStatue);
|
||||||
|
writer.Write(StatueRotation);
|
||||||
|
writer.Write(PlayerPosition);
|
||||||
|
writer.Write(PlayerRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Deserialize(NetworkReader reader)
|
public override void Deserialize(NetworkReader reader)
|
||||||
@ -73,6 +87,10 @@ public class GameStateMessage : QSBMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReducedFrights = reader.Read<bool>();
|
ReducedFrights = reader.Read<bool>();
|
||||||
|
IsLoopAfterStatue = reader.Read<bool>();
|
||||||
|
StatueRotation = reader.ReadQuaternion();
|
||||||
|
PlayerPosition = reader.ReadVector3();
|
||||||
|
PlayerRotation = reader.ReadQuaternion();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnReceiveRemote()
|
public override void OnReceiveRemote()
|
||||||
@ -95,6 +113,12 @@ public class GameStateMessage : QSBMessage
|
|||||||
PlayerData.SetPersistentCondition("LAUNCH_CODES_GIVEN", LaunchCodesGiven);
|
PlayerData.SetPersistentCondition("LAUNCH_CODES_GIVEN", LaunchCodesGiven);
|
||||||
PlayerData._settingsSave.reducedFrights = ReducedFrights;
|
PlayerData._settingsSave.reducedFrights = ReducedFrights;
|
||||||
|
|
||||||
|
TimeLoop._startTimeLoopOnReload = IsLoopAfterStatue;
|
||||||
|
|
||||||
|
MemoryUplinkTrigger._savedStatueRotation = StatueRotation;
|
||||||
|
PlayerSpawner._localResetPos = PlayerPosition;
|
||||||
|
PlayerSpawner._localResetRotation = PlayerRotation;
|
||||||
|
|
||||||
PlayerData.SaveCurrentGame();
|
PlayerData.SaveCurrentGame();
|
||||||
|
|
||||||
MenuManager.Instance.LoadGame(WarpedToTheEye);
|
MenuManager.Instance.LoadGame(WarpedToTheEye);
|
||||||
|
@ -59,3 +59,17 @@ public class ClientTimePatches : QSBPatch
|
|||||||
new SetSecondsRemainingMessage(secondsRemaining).Send();
|
new SetSecondsRemainingMessage(secondsRemaining).Send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TimeLoopPatches : QSBPatch
|
||||||
|
{
|
||||||
|
public override QSBPatchTypes Type => QSBPatchTypes.OnModStart;
|
||||||
|
|
||||||
|
public static bool IsLoopAfterStatue;
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(TimeLoop), nameof(TimeLoop.Start))]
|
||||||
|
private static void TimeLoopStart()
|
||||||
|
{
|
||||||
|
IsLoopAfterStatue = TimeLoop._startTimeLoopOnReload;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user