Unstable 0.16.0.0
This commit is contained in:
@@ -83,9 +83,7 @@ namespace Barotrauma.Items.Components
|
||||
private const float ConnectedSubUpdateInterval = 1.0f;
|
||||
float connectedSubUpdateTimer;
|
||||
|
||||
//Vector2 = vector from the ping source to the position of the disruption
|
||||
//float = strength of the disruption, between 0-1
|
||||
private readonly List<Pair<Vector2, float>> disruptedDirections = new List<Pair<Vector2, float>>();
|
||||
private readonly List<(Vector2 pos, float strength)> disruptedDirections = new List<(Vector2 pos, float strength)>();
|
||||
|
||||
private readonly Dictionary<object, CachedDistance> markerDistances = new Dictionary<object, CachedDistance>();
|
||||
|
||||
@@ -455,7 +453,20 @@ namespace Barotrauma.Items.Components
|
||||
zoomSlider.OnMoved(zoomSlider, zoomSlider.BarScroll);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vector2 transducerCenter = GetTransducerPos();
|
||||
|
||||
if (steering != null && steering.DockingModeEnabled && steering.ActiveDockingSource != null)
|
||||
{
|
||||
Vector2 worldFocusPos = (steering.ActiveDockingSource.Item.WorldPosition + steering.DockingTarget.Item.WorldPosition) / 2.0f;
|
||||
DisplayOffset = Vector2.Lerp(DisplayOffset, worldFocusPos - transducerCenter, 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayOffset = Vector2.Lerp(DisplayOffset, Vector2.Zero, 0.1f);
|
||||
}
|
||||
transducerCenter += DisplayOffset;
|
||||
|
||||
float distort = MathHelper.Clamp(1.0f - item.Condition / item.MaxCondition, 0.0f, 1.0f);
|
||||
for (int i = sonarBlips.Count - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -502,8 +513,6 @@ namespace Barotrauma.Items.Components
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 transducerCenter = GetTransducerPos() + DisplayOffset;
|
||||
|
||||
if (Level.Loaded != null)
|
||||
{
|
||||
nearbyObjectUpdateTimer -= deltaTime;
|
||||
@@ -829,8 +838,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 transducerCenter = GetTransducerPos();
|
||||
|
||||
Vector2 transducerCenter = GetTransducerPos();// + DisplayOffset;
|
||||
|
||||
if (sonarBlips.Count > 0)
|
||||
{
|
||||
@@ -840,7 +848,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
foreach (SonarBlip sonarBlip in sonarBlips)
|
||||
{
|
||||
DrawBlip(spriteBatch, sonarBlip, transducerCenter, center, sonarBlip.FadeTimer / 2.0f * signalStrength, blipScale);
|
||||
DrawBlip(spriteBatch, sonarBlip, transducerCenter + DisplayOffset, center, sonarBlip.FadeTimer / 2.0f * signalStrength, blipScale);
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
@@ -849,8 +857,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (item.Submarine != null && !DetectSubmarineWalls)
|
||||
{
|
||||
DrawDockingPorts(spriteBatch, transducerCenter, signalStrength);
|
||||
transducerCenter += DisplayOffset;
|
||||
DrawDockingPorts(spriteBatch, transducerCenter, signalStrength);
|
||||
DrawOwnSubmarineBorders(spriteBatch, transducerCenter, signalStrength);
|
||||
}
|
||||
else
|
||||
@@ -1083,10 +1091,6 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
DrawDockingIndicator(spriteBatch, steering, ref transducerCenter);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayOffset = Vector2.Lerp(DisplayOffset, Vector2.Zero, 0.1f);
|
||||
}
|
||||
|
||||
foreach (DockingPort dockingPort in DockingPort.List)
|
||||
{
|
||||
@@ -1131,9 +1135,6 @@ namespace Barotrauma.Items.Components
|
||||
Vector2 worldFocusPos = (steering.ActiveDockingSource.Item.WorldPosition + steering.DockingTarget.Item.WorldPosition) / 2.0f;
|
||||
worldFocusPos.X = steering.DockingTarget.Item.WorldPosition.X;
|
||||
|
||||
DisplayOffset = Vector2.Lerp(DisplayOffset, worldFocusPos - transducerCenter, 0.1f);
|
||||
transducerCenter += DisplayOffset;
|
||||
|
||||
Vector2 sourcePortDiff = (steering.ActiveDockingSource.Item.WorldPosition - transducerCenter) * scale;
|
||||
Vector2 sourcePortPos = new Vector2(sourcePortDiff.X, -sourcePortDiff.Y);
|
||||
Vector2 targetPortDiff = (steering.DockingTarget.Item.WorldPosition - transducerCenter) * scale;
|
||||
@@ -1234,7 +1235,7 @@ namespace Barotrauma.Items.Components
|
||||
Vector2 disruptionPos = new Vector2(levelObject.Position.X, levelObject.Position.Y);
|
||||
|
||||
float disruptionDist = Vector2.Distance(pingSource, disruptionPos);
|
||||
disruptedDirections.Add(new Pair<Vector2, float>((disruptionPos - pingSource) / disruptionDist, disruptionStrength));
|
||||
disruptedDirections.Add(((disruptionPos - pingSource) / disruptionDist, disruptionStrength));
|
||||
|
||||
CreateBlipsForDisruption(disruptionPos, disruptionStrength);
|
||||
|
||||
@@ -1246,7 +1247,7 @@ namespace Barotrauma.Items.Components
|
||||
float distSqr = Vector2.DistanceSquared(aiTarget.WorldPosition, pingSource);
|
||||
if (distSqr > worldPingRadiusSqr) { continue; }
|
||||
float disruptionDist = (float)Math.Sqrt(distSqr);
|
||||
disruptedDirections.Add(new Pair<Vector2, float>((aiTarget.WorldPosition - pingSource) / disruptionDist, aiTarget.SonarDisruption));
|
||||
disruptedDirections.Add(((aiTarget.WorldPosition - pingSource) / disruptionDist, aiTarget.SonarDisruption));
|
||||
CreateBlipsForDisruption(aiTarget.WorldPosition, disruption);
|
||||
}
|
||||
}
|
||||
@@ -1461,10 +1462,10 @@ namespace Barotrauma.Items.Components
|
||||
float transducerDist = transducerDiff.Length();
|
||||
Vector2 pingDirection = transducerDiff / transducerDist;
|
||||
bool disrupted = false;
|
||||
foreach (Pair<Vector2, float> disruptDir in disruptedDirections)
|
||||
foreach ((Vector2 disruptPos, float disruptStrength) in disruptedDirections)
|
||||
{
|
||||
float dot = Vector2.Dot(pingDirection, disruptDir.First);
|
||||
if (dot > 1.0f - disruptDir.Second)
|
||||
float dot = Vector2.Dot(pingDirection, disruptPos);
|
||||
if (dot > 1.0f - disruptStrength)
|
||||
{
|
||||
disrupted = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user