Unstable 1.8.4.0
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user