public override void OnClientConnect(NetworkConnection connection) // Called on the client when connecting to a server { base.OnClientConnect(connection); gameObject.AddComponent <SectorSync>(); gameObject.AddComponent <RespawnOnDeath>(); gameObject.AddComponent <PreventShipDestruction>(); if (NetworkClient.active && !NetworkServer.active) { gameObject.AddComponent <Events.PlayerState>(); GeyserManager.Instance.EmptyUpdate(); WakeUpPatches.AddPatches(); } _lobby.CanEditName = false; OnNetworkManagerReady?.Invoke(); IsReady = true; QSB.Helper.Events.Unity.RunWhen(() => PlayerTransformSync.LocalInstance != null, EventList.Init); QSB.Helper.Events.Unity.RunWhen(() => EventList.Ready, () => GlobalMessenger <string> .FireEvent(EventNames.QSBPlayerJoin, _lobby.PlayerName)); }
public override void OnClientConnect(QNetworkConnection connection) // Called on the client when connecting to a server { DebugLog.DebugWrite("OnClientConnect", MessageType.Info); base.OnClientConnect(connection); QSBEventManager.Init(); gameObject.AddComponent <RespawnOnDeath>(); if (QSBSceneManager.IsInUniverse) { WorldObjectManager.Rebuild(QSBSceneManager.CurrentScene); } var specificType = QNetworkServer.active ? QSBPatchTypes.OnServerClientConnect : QSBPatchTypes.OnNonServerClientConnect; QSBPatchManager.DoPatchType(specificType); QSBPatchManager.DoPatchType(QSBPatchTypes.OnClientConnect); _lobby.CanEditName = false; OnNetworkManagerReady?.SafeInvoke(); IsReady = true; QSBCore.UnityEvents.RunWhen(() => QSBEventManager.Ready && PlayerTransformSync.LocalInstance != null, () => QSBEventManager.FireEvent(EventNames.QSBPlayerJoin, _lobby.PlayerName)); if (!QSBCore.IsServer) { QSBCore.UnityEvents.RunWhen(() => QSBEventManager.Ready && PlayerTransformSync.LocalInstance != null, () => QSBEventManager.FireEvent(EventNames.QSBPlayerStatesRequest)); } _everConnected = true; }