diff --git a/QSB/RespawnSync/RespawnHUDMarker.cs b/QSB/RespawnSync/RespawnHUDMarker.cs index 87a25412..b52329cb 100644 --- a/QSB/RespawnSync/RespawnHUDMarker.cs +++ b/QSB/RespawnSync/RespawnHUDMarker.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using QSB.ShipSync; +using UnityEngine; namespace QSB.RespawnSync; @@ -26,10 +27,12 @@ public class RespawnHUDMarker : HUDDistanceMarker if (_canvasMarker != null) { var isVisible = _canvasMarker.IsVisible(); + var shouldBeVisible = RespawnManager.Instance.RespawnNeeded + && !ShipManager.Instance.ShipCockpitUI._shipDamageCtrlr.IsDestroyed(); - if (RespawnManager.Instance.RespawnNeeded != isVisible) + if (shouldBeVisible != isVisible) { - _isVisible = RespawnManager.Instance.RespawnNeeded; + _isVisible = shouldBeVisible; _canvasMarker.SetVisibility(_isVisible); } } diff --git a/QSB/RespawnSync/RespawnManager.cs b/QSB/RespawnSync/RespawnManager.cs index 334965f7..ab2aa021 100644 --- a/QSB/RespawnSync/RespawnManager.cs +++ b/QSB/RespawnSync/RespawnManager.cs @@ -35,7 +35,6 @@ internal class RespawnManager : MonoBehaviour, IAddComponentOnStart QSBPlayerManager.OnRemovePlayer += player => { _playersPendingRespawn.Remove(player); - UpdateRespawnNotification(); }; } @@ -148,7 +147,6 @@ internal class RespawnManager : MonoBehaviour, IAddComponentOnStart player.IsDead = true; _playersPendingRespawn.Add(player); - UpdateRespawnNotification(); var deadPlayersCount = QSBPlayerManager.PlayerList.Count(x => x.IsDead); @@ -172,7 +170,6 @@ internal class RespawnManager : MonoBehaviour, IAddComponentOnStart player.IsDead = false; _playersPendingRespawn.Remove(player); - UpdateRespawnNotification(); player.SetVisible(true, 1); } @@ -182,18 +179,4 @@ internal class RespawnManager : MonoBehaviour, IAddComponentOnStart var playerToRespawn = _playersPendingRespawn.First(); new PlayerRespawnMessage(playerToRespawn.PlayerId).Send(); } - - private void UpdateRespawnNotification() - { - NotificationManager.SharedInstance.UnpinNotification(_previousNotification); - - if (_playersPendingRespawn.Count == 0) - { - return; - } - - var data = new NotificationData(NotificationTarget.Player, $"[{_playersPendingRespawn.Count}] PLAYER(S) AWAITING RESPAWN"); - NotificationManager.SharedInstance.PostNotification(data, true); - _previousNotification = data; - } } \ No newline at end of file diff --git a/QSB/RespawnSync/ShipRecoveryPoint.cs b/QSB/RespawnSync/ShipRecoveryPoint.cs index 0a54d193..6c2f8c62 100644 --- a/QSB/RespawnSync/ShipRecoveryPoint.cs +++ b/QSB/RespawnSync/ShipRecoveryPoint.cs @@ -1,4 +1,5 @@ using QSB.Messaging; +using QSB.ShipSync; using QSB.Utility; using UnityEngine; @@ -56,7 +57,7 @@ internal class ShipRecoveryPoint : MonoBehaviour _playerResources = Locator.GetPlayerTransform().GetComponent(); } - if (RespawnManager.Instance.RespawnNeeded) + if (RespawnManager.Instance.RespawnNeeded && !ShipManager.Instance.ShipCockpitUI._shipDamageCtrlr.IsDestroyed()) { _interactVolume.EnableSingleInteraction(true, _respawnIndex); _interactVolume.SetKeyCommandVisible(true, _respawnIndex); @@ -124,7 +125,7 @@ internal class ShipRecoveryPoint : MonoBehaviour } else if (inputCommand == _interactVolume.GetInteractionAt(_respawnIndex).inputCommand) { - if (!RespawnManager.Instance.RespawnNeeded) + if (!RespawnManager.Instance.RespawnNeeded || ShipManager.Instance.ShipCockpitUI._shipDamageCtrlr.IsDestroyed()) { return; }