mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
dont do the respawn stuff when ship is destroyed
This commit is contained in:
parent
942535c162
commit
d6cbd55dc1
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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<PlayerResources>();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user