Fix ship destroyed not counting sun/lava

This commit is contained in:
Mister_Nebula 2022-08-16 16:45:13 +01:00
parent bd496c1c56
commit 967147dc5d
3 changed files with 18 additions and 3 deletions

View File

@ -29,7 +29,7 @@ public class RespawnHUDMarker : HUDDistanceMarker
{
var isVisible = _canvasMarker.IsVisible();
var shouldBeVisible = RespawnManager.Instance.RespawnNeeded
&& !ShipManager.Instance.ShipCockpitUI._shipDamageCtrlr.IsDestroyed();
&& !ShipManager.Instance.IsShipWrecked;
if (shouldBeVisible != isVisible)
{

View File

@ -59,7 +59,7 @@ internal class ShipRecoveryPoint : MonoBehaviour
_playerResources = Locator.GetPlayerTransform().GetComponent<PlayerResources>();
}
if (RespawnManager.Instance.RespawnNeeded && !ShipManager.Instance.ShipCockpitUI._shipDamageCtrlr.IsDestroyed())
if (RespawnManager.Instance.RespawnNeeded && !ShipManager.Instance.IsShipWrecked)
{
_interactVolume.EnableSingleInteraction(true, _respawnIndex);
_interactVolume.SetKeyCommandVisible(true, _respawnIndex);
@ -127,7 +127,7 @@ internal class ShipRecoveryPoint : MonoBehaviour
}
else if (inputCommand == _interactVolume.GetInteractionAt(_respawnIndex).inputCommand)
{
if (!RespawnManager.Instance.RespawnNeeded || ShipManager.Instance.ShipCockpitUI._shipDamageCtrlr.IsDestroyed())
if (!RespawnManager.Instance.RespawnNeeded || ShipManager.Instance.IsShipWrecked)
{
return;
}

View File

@ -42,15 +42,28 @@ internal class ShipManager : WorldObjectManager
_currentFlyer = value;
}
}
public bool IsShipWrecked => _shipDestroyed || ShipCockpitUI._shipDamageCtrlr.IsDestroyed();
private readonly List<PlayerInfo> _playersInShip = new();
private uint _currentFlyer = uint.MaxValue;
private bool _shipDestroyed;
public void Start()
{
Instance = this;
QSBPlayerManager.OnRemovePlayer += OnRemovePlayer;
GlobalMessenger.AddListener("ShipDestroyed", OnShipDestroyed);
}
public void OnDestroy()
{
GlobalMessenger.RemoveListener("ShipDestroyed", OnShipDestroyed);
}
private void OnShipDestroyed()
{
_shipDestroyed = true;
}
private void OnRemovePlayer(PlayerInfo player)
@ -63,6 +76,8 @@ internal class ShipManager : WorldObjectManager
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct)
{
_shipDestroyed = false;
var shipBody = Locator.GetShipBody();
if (shipBody == null)
{