(24cde6cae) Add a static sight range. Considerably increase the hull sight ranges.

This commit is contained in:
Joonas Rikkonen
2019-03-29 17:25:58 +02:00
parent 57f8fe437b
commit a64096b5aa
4 changed files with 13 additions and 7 deletions
@@ -601,8 +601,7 @@ namespace Barotrauma
{ {
((GUIMessageBox)GUIMessageBox.VisibleBox).Close(); ((GUIMessageBox)GUIMessageBox.VisibleBox).Close();
} }
else if ((Character.Controlled?.SelectedConstruction == null || !Character.Controlled.SelectedConstruction.ActiveHUDs.Any(ic => ic.GuiFrame != null)) else if ((GUI.MouseOn == null || GUI.IsMouseOn(GUI.PauseMenu)) && Inventory.SelectedSlot == null && CharacterHealth.OpenHealthWindow == null)
&& Inventory.SelectedSlot == null && CharacterHealth.OpenHealthWindow == null)
{ {
// Otherwise toggle pausing, unless another window/interface is open. // Otherwise toggle pausing, unless another window/interface is open.
GUI.TogglePauseMenu(); GUI.TogglePauseMenu();
@@ -657,10 +657,9 @@ namespace Barotrauma.Tutorials
{ {
foreach (Gap gap in Gap.GapList) foreach (Gap gap in Gap.GapList)
{ {
if (gap.ConnectedWall == null || gap.IsRoomToRoom) continue; if (gap.ConnectedWall == null) continue;
if (gap.ConnectedDoor != null || gap.Open <= 0.0f) continue; if (gap.ConnectedDoor != null || gap.Open <= 0.0f) continue;
if (gap.Submarine == null) continue; if (gap.Submarine == null) continue;
if (gap.Submarine.IsOutpost) continue;
if (gap.Submarine != Submarine.MainSub) continue; if (gap.Submarine != Submarine.MainSub) continue;
return true; return true;
} }
@@ -15,6 +15,11 @@ namespace Barotrauma
private set; private set;
} }
/// <summary>
/// Use as a minimum or static sight range.
/// </summary>
public static float StaticSightRange = 3000;
private float soundRange; private float soundRange;
private float sightRange; private float sightRange;
@@ -110,9 +115,13 @@ namespace Barotrauma
SonarLabel = element.GetAttributeString("sonarlabel", ""); SonarLabel = element.GetAttributeString("sonarlabel", "");
} }
public AITarget(Entity e, float sightRange = 3000, float soundRange = 0) public AITarget(Entity e, float sightRange = -1, float soundRange = 0)
{ {
Entity = e; Entity = e;
if (sightRange < 0)
{
sightRange = StaticSightRange;
}
SightRange = sightRange; SightRange = sightRange;
SoundRange = soundRange; SoundRange = soundRange;
List.Add(this); List.Add(this);
@@ -88,7 +88,6 @@ namespace Barotrauma
Gap.UpdateHulls(); Gap.UpdateHulls();
} }
OxygenPercentage = prevOxygenPercentage;
surface = drawSurface = rect.Y - rect.Height + WaterVolume / rect.Width; surface = drawSurface = rect.Y - rect.Height + WaterVolume / rect.Width;
Pressure = surface; Pressure = surface;
} }
@@ -420,7 +419,7 @@ namespace Barotrauma
FireSource.UpdateAll(FireSources, deltaTime); FireSource.UpdateAll(FireSources, deltaTime);
aiTarget.SightRange = Submarine == null ? 0.0f : Math.Max(Submarine.Velocity.Length() * 500.0f, 500.0f); aiTarget.SightRange = Submarine == null ? 0.0f : Math.Max(Submarine.Velocity.Length() * 2000.0f, AITarget.StaticSightRange);
aiTarget.SoundRange -= deltaTime * 1000.0f; aiTarget.SoundRange -= deltaTime * 1000.0f;
if (!update) if (!update)