Unstable 1.8.4.0

This commit is contained in:
Markus Isberg
2025-03-12 12:56:27 +00:00
parent a4c3e868e4
commit a4a3427e4e
627 changed files with 29860 additions and 10018 deletions
@@ -1,3 +1,4 @@
using System;
using Barotrauma.Extensions;
using Barotrauma.Items.Components;
using Barotrauma.RuinGeneration;
@@ -20,23 +21,14 @@ namespace Barotrauma
private readonly Dictionary<WayPoint, bool> scanTargets = new Dictionary<WayPoint, bool>();
private readonly HashSet<WayPoint> newTargetsScanned = new HashSet<WayPoint>();
private readonly float minTargetDistance;
private Ruin TargetRuin { get; set; }
private bool AllTargetsScanned
{
get
{
return scanTargets.Any() && scanTargets.All(kvp => kvp.Value);
}
}
public override IEnumerable<(LocalizedString Label, Vector2 Position)> SonarLabels
{
get
{
if (State > 0 || scanTargets.None())
if (AllTargetsScanned())
{
return Enumerable.Empty<(LocalizedString Label, Vector2 Position)>();
}
@@ -234,24 +226,19 @@ namespace Barotrauma
protected override void UpdateMissionSpecific(float deltaTime)
{
if (IsClient) { return; }
switch (State)
{
case 0:
if (AllTargetsScanned)
{
State = 1;
}
break;
}
// Allow the state to be set higher with MissionStateAction, but not lower.
State = Math.Max(State, scanTargets.Count(kvp => kvp.Value));
}
protected override bool DetermineCompleted() => State > 0;
private bool AllTargetsScanned() => State >= targetsToScan;
protected override bool DetermineCompleted() => AllTargetsScanned();
protected override void EndMissionSpecific(bool completed)
{
foreach (var scanner in scanners)
{
if (scanner.Item != null && !scanner.Item.Removed)
if (scanner.Item is { Removed: false })
{
scanner.OnScanStarted -= OnScanStarted;
scanner.OnScanCompleted -= OnScanCompleted;
@@ -259,7 +246,7 @@ namespace Barotrauma
}
}
Reset();
failed = !completed && state > 0;
failed = !completed;
}
}
}