From d2c8ba5d11c97513680dd26a44f1ad9d82f3d4e0 Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 19 Dec 2020 21:47:19 +0000 Subject: [PATCH] fixed respawnondeath --- QSB/DeathSync/RespawnOnDeath.cs | 16 +--------------- QSB/QSBNetworkManager.cs | 2 ++ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/QSB/DeathSync/RespawnOnDeath.cs b/QSB/DeathSync/RespawnOnDeath.cs index 7d1e9513..e6eda1b5 100644 --- a/QSB/DeathSync/RespawnOnDeath.cs +++ b/QSB/DeathSync/RespawnOnDeath.cs @@ -28,21 +28,7 @@ namespace QSB.DeathSync private ShipCockpitController _cockpitController; private PlayerSpacesuit _spaceSuit; - public void Awake() - { - Instance = this; - - QSBCore.Helper.Events.Subscribe(OWML.Common.Events.AfterStart); - QSBCore.Helper.Events.Event += OnEvent; - } - - private void OnEvent(MonoBehaviour behaviour, OWML.Common.Events ev) - { - if (behaviour is PlayerResources && ev == OWML.Common.Events.AfterStart) - { - Init(); - } - } + public void Awake() => Instance = this; public void Init() { diff --git a/QSB/QSBNetworkManager.cs b/QSB/QSBNetworkManager.cs index 00861d28..fd7cb362 100644 --- a/QSB/QSBNetworkManager.cs +++ b/QSB/QSBNetworkManager.cs @@ -180,6 +180,8 @@ namespace QSB gameObject.AddComponent(); gameObject.AddComponent(); + QSBCore.Helper.Events.Unity.RunWhen(() => QSBCore.HasWokenUp, RespawnOnDeath.Instance.Init); + if (QSBSceneManager.IsInUniverse) { QSBSectorManager.Instance.RebuildSectors();