mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-26 18:35:34 +00:00
Merge pull request #393 from misternebula/fix-worldsync-errors
Fix worldsync errors
This commit is contained in:
commit
7d49de82ef
@ -26,7 +26,7 @@ namespace QSB.Anglerfish.Events
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, AnglerChangeStateMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace QSB.Anglerfish.Patches
|
||||
[HarmonyPatch(typeof(AnglerfishController), nameof(AnglerfishController.OnSectorOccupantsUpdated))]
|
||||
public static bool OnSectorOccupantsUpdated(AnglerfishController __instance)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -77,7 +77,7 @@ namespace QSB.Anglerfish.Patches
|
||||
[HarmonyPatch(typeof(AnglerfishController), nameof(AnglerfishController.UpdateState))]
|
||||
public static bool UpdateState(AnglerfishController __instance)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -172,7 +172,7 @@ namespace QSB.Anglerfish.Patches
|
||||
[HarmonyPatch(typeof(AnglerfishController), nameof(AnglerfishController.UpdateMovement))]
|
||||
public static bool UpdateMovement(AnglerfishController __instance)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace QSB.Anglerfish.TransformSync
|
||||
{
|
||||
public class AnglerTransformSync : UnsectoredRigidbodySync
|
||||
{
|
||||
public override bool IsReady => WorldObjectManager.AllAdded;
|
||||
public override bool IsReady => WorldObjectManager.AllObjectsAdded;
|
||||
public override bool UseInterpolation => false;
|
||||
|
||||
private QSBAngler _qsbAngler;
|
||||
@ -47,7 +47,7 @@ namespace QSB.Anglerfish.TransformSync
|
||||
{
|
||||
base.DeserializeTransform(reader, initialState);
|
||||
|
||||
if (!WorldObjectManager.AllReady || HasAuthority)
|
||||
if (!WorldObjectManager.AllObjectsReady || HasAuthority)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -73,7 +73,7 @@ namespace QSB.Anglerfish.TransformSync
|
||||
|
||||
protected override void OnRenderObject()
|
||||
{
|
||||
if (!WorldObjectManager.AllReady
|
||||
if (!WorldObjectManager.AllObjectsReady
|
||||
|| !QSBCore.ShowLinesInDebug
|
||||
|| !IsReady
|
||||
|| ReferenceTransform == null
|
||||
|
@ -30,7 +30,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
Animator ____animator,
|
||||
CharacterDialogueTree ____dialogueTree)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady || ConversationManager.Instance == null)
|
||||
if (!WorldObjectManager.AllObjectsReady || ConversationManager.Instance == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -178,7 +178,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
[HarmonyPatch(typeof(KidRockController), nameof(KidRockController.Update))]
|
||||
public static bool UpdateReplacement(KidRockController __instance)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace QSB.Animation.Player.Events
|
||||
public override void OnReceiveRemote(bool server, AnimationTriggerMessage message)
|
||||
{
|
||||
var animationSync = QSBPlayerManager.GetSyncObject<AnimationSync>(message.AttachedNetId);
|
||||
if (!WorldObjectManager.AllReady || animationSync == null)
|
||||
if (!WorldObjectManager.AllObjectsReady || animationSync == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace QSB.Animation.Player.Events
|
||||
|
||||
public override void OnReceiveRemote(bool server, EnumMessage<AnimationType> message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady || !QSBPlayerManager.GetPlayer(message.AboutId).IsReady)
|
||||
if (!WorldObjectManager.AllObjectsReady || !QSBPlayerManager.GetPlayer(message.AboutId).IsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace QSB.Animation.Player.Events
|
||||
var player = QSBPlayerManager.GetPlayer(message.AboutId);
|
||||
player.SuitedUp = message.ToggleValue;
|
||||
|
||||
if (!WorldObjectManager.AllReady || !player.IsReady)
|
||||
if (!WorldObjectManager.AllObjectsReady || !player.IsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace QSB.Animation.Player.Thrusters
|
||||
|
||||
private void OnRenderObject()
|
||||
{
|
||||
if (!WorldObjectManager.AllReady || !QSBCore.ShowLinesInDebug)
|
||||
if (!WorldObjectManager.AllObjectsReady || !QSBCore.ShowLinesInDebug)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace QSB.AuthoritySync
|
||||
|
||||
private static void OnReceive(AuthorityQueueMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace QSB.ConversationSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool server, ConversationMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace QSB.ConversationSync.Events
|
||||
return;
|
||||
}
|
||||
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace QSB.GeyserSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, BoolWorldObjectMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -25,21 +25,31 @@ namespace QSB.ItemSync.WorldObjects.Items
|
||||
return;
|
||||
}
|
||||
|
||||
InitialParent = attachedObject.transform.parent;
|
||||
InitialPosition = attachedObject.transform.localPosition;
|
||||
InitialRotation = attachedObject.transform.localRotation;
|
||||
InitialSector = QSBWorldSync.GetWorldFromUnity<QSBSector>(attachedObject.GetSector());
|
||||
|
||||
if (InitialParent == null)
|
||||
StartDelayedReady();
|
||||
QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsAdded, () =>
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - InitialParent of {attachedObject.name} is null!", OWML.Common.MessageType.Warning);
|
||||
}
|
||||
FinishDelayedReady();
|
||||
|
||||
if (InitialParent?.GetComponent<OWItemSocket>() != null)
|
||||
{
|
||||
var qsbObj = (IQSBOWItemSocket)QSBWorldSync.GetWorldFromUnity(InitialParent.GetComponent<OWItemSocket>());
|
||||
InitialSocket = qsbObj;
|
||||
}
|
||||
InitialParent = attachedObject.transform.parent;
|
||||
InitialPosition = attachedObject.transform.localPosition;
|
||||
InitialRotation = attachedObject.transform.localRotation;
|
||||
var initialSector = attachedObject.GetSector();
|
||||
if (initialSector != null)
|
||||
{
|
||||
InitialSector = QSBWorldSync.GetWorldFromUnity<QSBSector>(initialSector);
|
||||
}
|
||||
|
||||
if (InitialParent == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - InitialParent of {attachedObject.name} is null!", OWML.Common.MessageType.Warning);
|
||||
}
|
||||
|
||||
if (InitialParent?.GetComponent<OWItemSocket>() != null)
|
||||
{
|
||||
var qsbObj = (IQSBOWItemSocket)QSBWorldSync.GetWorldFromUnity(InitialParent.GetComponent<OWItemSocket>());
|
||||
InitialSocket = qsbObj;
|
||||
}
|
||||
});
|
||||
|
||||
QSBPlayerManager.OnRemovePlayer += OnPlayerLeave;
|
||||
}
|
||||
@ -63,7 +73,7 @@ namespace QSB.ItemSync.WorldObjects.Items
|
||||
AttachedObject.transform.localPosition = InitialPosition;
|
||||
AttachedObject.transform.localRotation = InitialRotation;
|
||||
AttachedObject.transform.localScale = Vector3.one;
|
||||
AttachedObject.SetSector(InitialSector.AttachedObject);
|
||||
AttachedObject.SetSector(InitialSector?.AttachedObject);
|
||||
AttachedObject.SetColliderActivation(true);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ namespace QSB.JellyfishSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, BoolWorldObjectMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace QSB.JellyfishSync.Patches
|
||||
[HarmonyPatch(typeof(JellyfishController), nameof(JellyfishController.OnSectorOccupantsUpdated))]
|
||||
public static bool OnSectorOccupantsUpdated(JellyfishController __instance)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -42,7 +42,7 @@ namespace QSB.JellyfishSync.Patches
|
||||
[HarmonyPatch(typeof(JellyfishController), nameof(JellyfishController.FixedUpdate))]
|
||||
public static bool FixedUpdate(JellyfishController __instance)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace QSB.JellyfishSync.TransformSync
|
||||
{
|
||||
public class JellyfishTransformSync : UnsectoredRigidbodySync
|
||||
{
|
||||
public override bool IsReady => WorldObjectManager.AllAdded;
|
||||
public override bool IsReady => WorldObjectManager.AllObjectsAdded;
|
||||
public override bool UseInterpolation => false;
|
||||
|
||||
private QSBJellyfish _qsbJellyfish;
|
||||
@ -47,7 +47,7 @@ namespace QSB.JellyfishSync.TransformSync
|
||||
{
|
||||
base.SerializeTransform(writer, initialState);
|
||||
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
writer.Write(false);
|
||||
return;
|
||||
@ -63,7 +63,7 @@ namespace QSB.JellyfishSync.TransformSync
|
||||
{
|
||||
base.DeserializeTransform(reader, initialState);
|
||||
|
||||
if (!WorldObjectManager.AllReady || HasAuthority)
|
||||
if (!WorldObjectManager.AllObjectsReady || HasAuthority)
|
||||
{
|
||||
reader.ReadBoolean();
|
||||
return;
|
||||
@ -142,7 +142,7 @@ namespace QSB.JellyfishSync.TransformSync
|
||||
|
||||
protected override void OnRenderObject()
|
||||
{
|
||||
if (!WorldObjectManager.AllReady
|
||||
if (!WorldObjectManager.AllObjectsReady
|
||||
|| !QSBCore.ShowLinesInDebug
|
||||
|| !IsReady
|
||||
|| ReferenceTransform == null
|
||||
|
@ -33,7 +33,7 @@ namespace QSB.LogSync.Events
|
||||
QSBWorldSync.AddFactReveal(message.FactId, message.SaveGame, message.ShowNotification);
|
||||
}
|
||||
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace QSB.MeteorSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, FragmentDamageMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace QSB.MeteorSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, FragmentResyncMessage msg)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace QSB.MeteorSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, MeteorLaunchMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace QSB.MeteorSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, WorldObjectMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace QSB.MeteorSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, WorldObjectMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ namespace QSB.MeteorSync.Patches
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace QSB.MeteorSync.Patches
|
||||
[HarmonyPatch(typeof(MeteorLauncher), nameof(MeteorLauncher.FixedUpdate))]
|
||||
public static bool FixedUpdate(MeteorLauncher __instance)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -202,7 +202,7 @@ namespace QSB.MeteorSync.Patches
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ namespace QSB.OrbSync.TransformSync
|
||||
protected override Component InitRemoteTransform() => GetTransform();
|
||||
|
||||
protected override float DistanceLeeway => 1f;
|
||||
public override bool IsReady => WorldObjectManager.AllReady;
|
||||
public override bool IsReady => WorldObjectManager.AllObjectsReady;
|
||||
public override bool UseInterpolation => false;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace QSB.OrbSync.WorldObjects
|
||||
|
||||
public void HandleEvent(bool state, int orbId)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace QSB.Player.TransformSync
|
||||
|
||||
protected override Component InitLocalTransform()
|
||||
{
|
||||
QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllReady, () => SectorSync.Init(Locator.GetPlayerSectorDetector(), TargetType.Player));
|
||||
QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsReady, () => SectorSync.Init(Locator.GetPlayerSectorDetector(), TargetType.Player));
|
||||
|
||||
// player body
|
||||
var player = Locator.GetPlayerTransform();
|
||||
@ -249,7 +249,7 @@ namespace QSB.Player.TransformSync
|
||||
{
|
||||
base.OnRenderObject();
|
||||
|
||||
if (!WorldObjectManager.AllReady
|
||||
if (!WorldObjectManager.AllObjectsReady
|
||||
|| !QSBCore.ShowLinesInDebug
|
||||
|| !IsReady
|
||||
|| ReferenceTransform == null)
|
||||
|
@ -24,7 +24,7 @@ namespace QSB.QuantumSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool server, MoonStateChangeMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace QSB.QuantumSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool server, MultiStateChangeMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace QSB.QuantumSync.Events
|
||||
|
||||
public override bool CheckMessage(bool isServer, QuantumAuthorityMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace QSB.QuantumSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool server, QuantumShuffleMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace QSB.QuantumSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool server, SocketStateChangeMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace QSB.QuantumSync.Patches
|
||||
ref QuantumSocket ____recentlyObscuredSocket,
|
||||
QuantumSocket ____occupiedSocket)
|
||||
{
|
||||
if (WorldObjectManager.AllReady)
|
||||
if (WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
var socketedWorldObject = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject>(__instance);
|
||||
if (socketedWorldObject.ControllingPlayer != QSBPlayerManager.LocalPlayerId)
|
||||
@ -143,7 +143,7 @@ namespace QSB.QuantumSync.Patches
|
||||
[HarmonyPatch(typeof(SocketedQuantumObject), nameof(SocketedQuantumObject.MoveToSocket))]
|
||||
public static void SocketedQuantumObject_MoveToSocket(SocketedQuantumObject __instance, QuantumSocket socket)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -185,7 +185,7 @@ namespace QSB.QuantumSync.Patches
|
||||
ref bool __result)
|
||||
{
|
||||
QSBQuantumShuffleObject shuffleWorldObject = default;
|
||||
if (WorldObjectManager.AllReady)
|
||||
if (WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
shuffleWorldObject = QSBWorldSync.GetWorldFromUnity<QSBQuantumShuffleObject>(__instance);
|
||||
if (shuffleWorldObject.ControllingPlayer != QSBPlayerManager.LocalPlayerId)
|
||||
@ -209,7 +209,7 @@ namespace QSB.QuantumSync.Patches
|
||||
____shuffledObjects[j].localPosition = ____localPositions[____indexList[j]];
|
||||
}
|
||||
|
||||
if (WorldObjectManager.AllReady)
|
||||
if (WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
QSBEventManager.FireEvent(
|
||||
EventNames.QSBQuantumShuffle,
|
||||
@ -225,7 +225,7 @@ namespace QSB.QuantumSync.Patches
|
||||
[HarmonyPatch(typeof(MultiStateQuantumObject), nameof(MultiStateQuantumObject.Start))]
|
||||
public static bool MultiStateQuantumObject_Start(MultiStateQuantumObject __instance, Sector ____sector, bool ____collapseOnStart)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -261,7 +261,7 @@ namespace QSB.QuantumSync.Patches
|
||||
[HarmonyPatch(typeof(MultiStateQuantumObject), nameof(MultiStateQuantumObject.ChangeQuantumState))]
|
||||
public static bool MultiStateQuantumObject_ChangeQuantumState(MultiStateQuantumObject __instance)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -280,7 +280,7 @@ namespace QSB.QuantumSync.Patches
|
||||
[HarmonyPatch(typeof(QuantumState), nameof(QuantumState.SetVisible))]
|
||||
public static void QuantumState_SetVisible(QuantumState __instance, bool visible)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ namespace QSB.QuantumSync
|
||||
|
||||
public void OnRenderObject()
|
||||
{
|
||||
if (!WorldObjectManager.AllReady || !QSBCore.ShowLinesInDebug)
|
||||
if (!WorldObjectManager.AllObjectsReady || !QSBCore.ShowLinesInDebug)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -99,7 +99,7 @@ namespace QSB.QuantumSync
|
||||
|
||||
public static Tuple<bool, List<PlayerInfo>> IsVisibleUsingCameraFrustum(ShapeVisibilityTracker tracker, bool ignoreLocalCamera)
|
||||
{
|
||||
if (!AllReady)
|
||||
if (!AllObjectsReady)
|
||||
{
|
||||
return new Tuple<bool, List<PlayerInfo>>(false, new List<PlayerInfo>());
|
||||
}
|
||||
@ -146,7 +146,7 @@ namespace QSB.QuantumSync
|
||||
|
||||
public static IEnumerable<PlayerInfo> GetEntangledPlayers(QuantumObject obj)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return Enumerable.Empty<PlayerInfo>();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
base.Init(attachedObject, id);
|
||||
|
||||
StartDelayedReady();
|
||||
QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllAdded, () =>
|
||||
QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsAdded, () =>
|
||||
{
|
||||
FinishDelayedReady();
|
||||
|
||||
|
@ -160,7 +160,7 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
}
|
||||
|
||||
IsEnabled = true;
|
||||
if (!WorldObjectManager.AllReady && !QSBCore.IsHost)
|
||||
if (!WorldObjectManager.AllObjectsReady && !QSBCore.IsHost)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -189,7 +189,7 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
}
|
||||
|
||||
IsEnabled = false;
|
||||
if (!WorldObjectManager.AllReady && !QSBCore.IsHost)
|
||||
if (!WorldObjectManager.AllObjectsReady && !QSBCore.IsHost)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace QSB.RoastingSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool server, BoolWorldObjectMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace QSB.RoastingSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool server, EnumMessage<MarshmallowEventType> message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace QSB.SectorSync
|
||||
|
||||
public void Invoke()
|
||||
{
|
||||
if (!Instance.IsReady || !AllReady)
|
||||
if (!Instance.IsReady || !AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ namespace QSB.ShipSync.Patches
|
||||
*
|
||||
*/
|
||||
|
||||
if (!WorldObjectManager.AllReady || __instance != ShipManager.Instance.HatchInteractZone)
|
||||
if (!WorldObjectManager.AllObjectsReady || __instance != ShipManager.Instance.HatchInteractZone)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace QSB.ShipSync.TransformSync
|
||||
|
||||
protected override OWRigidbody GetRigidbody()
|
||||
{
|
||||
QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllReady, () => SectorSync.Init(Locator.GetShipDetector().GetComponent<SectorDetector>(), TargetType.Ship));
|
||||
QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsReady, () => SectorSync.Init(Locator.GetShipDetector().GetComponent<SectorDetector>(), TargetType.Ship));
|
||||
return Locator.GetShipBody();
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace QSB.Syncs.Sectored
|
||||
return;
|
||||
}
|
||||
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
base.Update();
|
||||
return;
|
||||
@ -138,7 +138,7 @@ namespace QSB.Syncs.Sectored
|
||||
public override void DeserializeTransform(QNetworkReader reader, bool initialState)
|
||||
{
|
||||
int sectorId;
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
sectorId = reader.ReadInt32();
|
||||
if (initialState && sectorId != -1)
|
||||
|
@ -62,7 +62,7 @@ namespace QSB.Syncs.Sectored.Rigidbodies
|
||||
{
|
||||
base.DeserializeTransform(reader, initialState);
|
||||
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
reader.ReadVector3();
|
||||
DeserializeRotation(reader);
|
||||
|
@ -32,7 +32,7 @@ namespace QSB.Syncs.Sectored.Transforms
|
||||
{
|
||||
base.DeserializeTransform(reader, initialState);
|
||||
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
reader.ReadVector3();
|
||||
DeserializeRotation(reader);
|
||||
|
@ -76,7 +76,7 @@ namespace QSB.Syncs
|
||||
// && Player.IsReady
|
||||
&& NetId.Value != uint.MaxValue
|
||||
&& NetId.Value != 0U
|
||||
&& WorldObjectManager.AllAdded;
|
||||
&& WorldObjectManager.AllObjectsAdded;
|
||||
public abstract bool IsReady { get; }
|
||||
public abstract bool UseInterpolation { get; }
|
||||
public abstract bool IgnoreDisabledAttachedObject { get; }
|
||||
@ -298,7 +298,7 @@ namespace QSB.Syncs
|
||||
|
||||
protected virtual void OnRenderObject()
|
||||
{
|
||||
if (!WorldObjectManager.AllReady
|
||||
if (!WorldObjectManager.AllObjectsReady
|
||||
|| !QSBCore.ShowLinesInDebug
|
||||
|| !IsReady
|
||||
|| ReferenceTransform == null)
|
||||
|
@ -56,7 +56,7 @@ namespace QSB.Syncs.Unsectored.Rigidbodies
|
||||
|
||||
public override void DeserializeTransform(QNetworkReader reader, bool initialState)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
reader.ReadVector3();
|
||||
DeserializeRotation(reader);
|
||||
|
@ -28,7 +28,7 @@ namespace QSB.Syncs.Unsectored.Transforms
|
||||
|
||||
public override void DeserializeTransform(QNetworkReader reader, bool initialState)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
reader.ReadVector3();
|
||||
DeserializeRotation(reader);
|
||||
|
@ -22,7 +22,7 @@ namespace QSB.Tools.ProbeTool.TransformSync
|
||||
|
||||
protected override Component InitLocalTransform()
|
||||
{
|
||||
QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllReady, () => SectorSync.Init(Locator.GetProbe().GetSectorDetector(), TargetType.Probe));
|
||||
QSBCore.UnityEvents.RunWhen(() => WorldObjectManager.AllObjectsReady, () => SectorSync.Init(Locator.GetProbe().GetSectorDetector(), TargetType.Probe));
|
||||
|
||||
var body = Locator.GetProbe().transform;
|
||||
Player.ProbeBody = body.gameObject;
|
||||
|
@ -77,7 +77,7 @@ namespace QSB.Tools.TranslatorTool
|
||||
|
||||
private void OnRenderObject()
|
||||
{
|
||||
if (!WorldObjectManager.AllReady || !QSBCore.ShowLinesInDebug)
|
||||
if (!WorldObjectManager.AllObjectsReady || !QSBCore.ShowLinesInDebug)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace QSB.Tools.TranslatorTool.TranslationSync.Events
|
||||
|
||||
public override void OnReceiveRemote(bool server, SetAsTranslatedMessage message)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace QSB.Utility
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (!WorldObjectManager.AllReady || !_isReady)
|
||||
if (!WorldObjectManager.AllObjectsReady || !_isReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace QSB.Utility
|
||||
|
||||
#region Column1 - Server data
|
||||
WriteLine(1, $"FPS : {Mathf.Round(1f / Time.smoothDeltaTime)}");
|
||||
WriteLine(1, $"HasWokenUp : {WorldObjectManager.AllReady}");
|
||||
WriteLine(1, $"HasWokenUp : {WorldObjectManager.AllObjectsReady}");
|
||||
if (WakeUpSync.LocalInstance != null)
|
||||
{
|
||||
WriteLine(1, $"Server State : {ServerStateManager.Instance.GetServerState()}");
|
||||
@ -133,7 +133,7 @@ namespace QSB.Utility
|
||||
WriteLine(2, $"Ready : {player.IsReady}");
|
||||
WriteLine(2, $"Suited Up : {player.SuitedUp}");
|
||||
|
||||
if (player.IsReady && WorldObjectManager.AllReady)
|
||||
if (player.IsReady && WorldObjectManager.AllObjectsReady)
|
||||
{
|
||||
var networkTransform = player.TransformSync;
|
||||
var referenceSector = networkTransform.ReferenceSector;
|
||||
|
@ -38,25 +38,25 @@ namespace QSB.WorldSync
|
||||
{
|
||||
if (unityObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TUnityObject:NULL", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TUnityObject:NULL, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!QSBCore.IsInMultiplayer)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TUnityObject:{unityObject.GetType().Name}", MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Warning);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!WorldObjectsToUnityObjects.TryGetValue(unityObject, out var returnObject))
|
||||
{
|
||||
DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TUnityObject:{unityObject.GetType().Name}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (returnObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TUnityObject:{unityObject.GetType().Name}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
@ -68,25 +68,25 @@ namespace QSB.WorldSync
|
||||
{
|
||||
if (unityObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:NULL", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - Trying to run GetWorldFromUnity with a null unity object! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:NULL, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!QSBCore.IsInMultiplayer)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}", MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Trying to run GetWorldFromUnity while not in multiplayer! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Warning);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!WorldObjectsToUnityObjects.TryGetValue(unityObject, out var returnObject))
|
||||
{
|
||||
DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (returnObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}", MessageType.Error);
|
||||
DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,15 @@ namespace QSB.WorldSync
|
||||
{
|
||||
private static readonly List<WorldObjectManager> _managers = new();
|
||||
|
||||
public static bool AllAdded { get; private set; }
|
||||
public static bool AllReady { get; private set; }
|
||||
/// <summary>
|
||||
/// Set when all WorldObjectManagers have called Init() on all their objects (AKA all the objects are created)
|
||||
/// </summary>
|
||||
public static bool AllObjectsAdded { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set when all WorldObjects have finished running Init()
|
||||
/// </summary>
|
||||
public static bool AllObjectsReady { get; private set; }
|
||||
|
||||
public virtual void Awake()
|
||||
{
|
||||
@ -28,14 +35,14 @@ namespace QSB.WorldSync
|
||||
|
||||
public static void SetNotReady()
|
||||
{
|
||||
AllAdded = false;
|
||||
AllReady = false;
|
||||
AllObjectsAdded = false;
|
||||
AllObjectsReady = false;
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool inUniverse)
|
||||
{
|
||||
AllAdded = false;
|
||||
AllReady = false;
|
||||
AllObjectsAdded = false;
|
||||
AllObjectsReady = false;
|
||||
}
|
||||
|
||||
public static void Rebuild(OWScene scene)
|
||||
@ -67,12 +74,13 @@ namespace QSB.WorldSync
|
||||
{
|
||||
_numManagersReadying = 0;
|
||||
_numObjectsReadying = 0;
|
||||
AllAdded = false;
|
||||
AllReady = false;
|
||||
AllObjectsAdded = false;
|
||||
AllObjectsReady = false;
|
||||
foreach (var manager in _managers)
|
||||
{
|
||||
try
|
||||
{
|
||||
DebugLog.DebugWrite($"Rebuilding {manager.GetType().Name}", MessageType.Info);
|
||||
manager.RebuildWorldObjects(scene);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -83,11 +91,11 @@ namespace QSB.WorldSync
|
||||
|
||||
QSBCore.UnityEvents.RunWhen(() => _numManagersReadying == 0, () =>
|
||||
{
|
||||
AllAdded = true;
|
||||
AllObjectsAdded = true;
|
||||
DebugLog.DebugWrite("World Objects added.", MessageType.Success);
|
||||
QSBCore.UnityEvents.RunWhen(() => _numObjectsReadying == 0, () =>
|
||||
{
|
||||
AllReady = true;
|
||||
AllObjectsReady = true;
|
||||
DebugLog.DebugWrite("World Objects ready.", MessageType.Success);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user