(3dc4135ce) v0.9.5.1

This commit is contained in:
Regalis
2019-11-21 18:22:25 +01:00
parent b39922a074
commit 5c95c53118
287 changed files with 12655 additions and 5048 deletions
+20 -13
View File
@@ -228,13 +228,16 @@ namespace Barotrauma
surface = rect.Y - rect.Height;
aiTarget = new AITarget(this)
if (submarine != null)
{
MinSightRange = 2000,
MaxSightRange = 5000,
MaxSoundRange = 5000,
SoundRange = 0
};
aiTarget = new AITarget(this)
{
MinSightRange = 2000,
MaxSightRange = 5000,
MaxSoundRange = 5000,
SoundRange = 0
};
}
hullList.Add(this);
@@ -430,8 +433,11 @@ namespace Barotrauma
FireSource.UpdateAll(FireSources, deltaTime);
aiTarget.SightRange = Submarine == null ? aiTarget.MinSightRange : Submarine.Velocity.Length() / 2 * aiTarget.MaxSightRange;
aiTarget.SoundRange -= deltaTime * 1000.0f;
if (aiTarget != null)
{
aiTarget.SightRange = Submarine == null ? aiTarget.MinSightRange : Submarine.Velocity.Length() / 2 * aiTarget.MaxSightRange;
aiTarget.SoundRange -= deltaTime * 1000.0f;
}
if (!update)
{
@@ -594,16 +600,17 @@ namespace Barotrauma
{
adjacentHulls.Clear();
int startStep = 0;
return GetAdjacentHulls(includingThis, adjacentHulls, ref startStep, searchDepth);
searchDepth = searchDepth ?? 100;
return GetAdjacentHulls(includingThis, adjacentHulls, ref startStep, searchDepth.Value);
}
private HashSet<Hull> GetAdjacentHulls(bool includingThis, HashSet<Hull> connectedHulls, ref int step, int? searchDepth)
private HashSet<Hull> GetAdjacentHulls(bool includingThis, HashSet<Hull> connectedHulls, ref int step, int searchDepth)
{
if (includingThis)
{
connectedHulls.Add(this);
}
if (step > searchDepth.Value)
if (step > searchDepth)
{
return connectedHulls;
}
@@ -642,7 +649,7 @@ namespace Barotrauma
foreach (Gap g in ConnectedGaps)
{
if (g.ConnectedDoor != null)
if (g.ConnectedDoor != null && !g.ConnectedDoor.IsBroken)
{
//gap blocked if the door is not open or the predicted state is not open
if (!g.ConnectedDoor.IsOpen || (g.ConnectedDoor.PredictedState.HasValue && !g.ConnectedDoor.PredictedState.Value))
@@ -660,7 +667,7 @@ namespace Barotrauma
if (g.linkedTo[i] is Hull hull && !connectedHulls.Contains(hull))
{
float dist = hull.GetApproximateHullDistance(g.Position, endPos, connectedHulls, target, distance + Vector2.Distance(startPos, g.Position), maxDistance);
if (dist < float.MaxValue) return dist;
if (dist < float.MaxValue) { return dist; }
}
}
}