v0.14.6.0
This commit is contained in:
@@ -178,26 +178,26 @@ namespace Barotrauma.Items.Components
|
||||
ToolTip = fi.TargetItem.Description
|
||||
};
|
||||
|
||||
var container = new GUILayoutGroup(new RectTransform(Vector2.One, frame.RectTransform),
|
||||
childAnchor: Anchor.CenterLeft, isHorizontal: true) { RelativeSpacing = 0.02f };
|
||||
var container = new GUILayoutGroup(new RectTransform(Vector2.One, frame.RectTransform),
|
||||
childAnchor: Anchor.CenterLeft, isHorizontal: true) { RelativeSpacing = 0.02f };
|
||||
|
||||
var itemIcon = fi.TargetItem.InventoryIcon ?? fi.TargetItem.sprite;
|
||||
if (itemIcon != null)
|
||||
{
|
||||
new GUIImage(new RectTransform(new Point(frame.Rect.Height,frame.Rect.Height), container.RectTransform),
|
||||
itemIcon, scaleToFit: true)
|
||||
{
|
||||
Color = fi.TargetItem.InventoryIconColor,
|
||||
ToolTip = fi.TargetItem.Description
|
||||
};
|
||||
}
|
||||
var itemIcon = fi.TargetItem.InventoryIcon ?? fi.TargetItem.sprite;
|
||||
if (itemIcon != null)
|
||||
{
|
||||
new GUIImage(new RectTransform(new Point(frame.Rect.Height,frame.Rect.Height), container.RectTransform),
|
||||
itemIcon, scaleToFit: true)
|
||||
{
|
||||
Color = fi.TargetItem.InventoryIconColor,
|
||||
ToolTip = fi.TargetItem.Description
|
||||
};
|
||||
}
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.85f, 1f), container.RectTransform), GetRecipeNameAndAmount(fi))
|
||||
{
|
||||
Padding = Vector4.Zero,
|
||||
AutoScaleVertical = true,
|
||||
ToolTip = fi.TargetItem.Description
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.85f, 1f), container.RectTransform), GetRecipeNameAndAmount(fi))
|
||||
{
|
||||
Padding = Vector4.Zero,
|
||||
AutoScaleVertical = true,
|
||||
ToolTip = fi.TargetItem.Description
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,6 +367,10 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
toolTipText += " " + (int)Math.Round(requiredItem.MinCondition * 100) + "%";
|
||||
}
|
||||
else if (requiredItem.MaxCondition <= 0.0f)
|
||||
{
|
||||
toolTipText = TextManager.GetWithVariable("displayname.emptyitem", "[itemname]", toolTipText);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(requiredItem.ItemPrefabs.First().Description))
|
||||
{
|
||||
toolTipText += '\n' + requiredItem.ItemPrefabs.First().Description;
|
||||
|
||||
@@ -199,13 +199,9 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
Color neutralColor = Color.DarkCyan;
|
||||
if (hull.RoomName != null)
|
||||
if (hull.IsWetRoom)
|
||||
{
|
||||
if (hull.RoomName.Contains("ballast") || hull.RoomName.Contains("Ballast") ||
|
||||
hull.RoomName.Contains("airlock") || hull.RoomName.Contains("Airlock"))
|
||||
{
|
||||
neutralColor = new Color(9, 80, 159);
|
||||
}
|
||||
neutralColor = new Color(9, 80, 159);
|
||||
}
|
||||
|
||||
if (hullData.Distort)
|
||||
|
||||
+1
-4
@@ -33,10 +33,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
base.Update(deltaTime, cam);
|
||||
|
||||
if (selectionUI != null)
|
||||
{
|
||||
selectionUI.Update();
|
||||
}
|
||||
selectionUI?.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,8 @@ namespace Barotrauma.Items.Components
|
||||
private GUITickBox powerLight;
|
||||
private GUITickBox autoControlIndicator;
|
||||
|
||||
private List<Pair<Vector2, ParticleEmitter>> pumpOutEmitters = new List<Pair<Vector2, ParticleEmitter>>();
|
||||
private List<Pair<Vector2, ParticleEmitter>> pumpInEmitters = new List<Pair<Vector2, ParticleEmitter>>();
|
||||
private readonly List<(Vector2 position, ParticleEmitter emitter)> pumpOutEmitters = new List<(Vector2 position, ParticleEmitter emitter)>();
|
||||
private readonly List<(Vector2 position, ParticleEmitter emitter)> pumpInEmitters = new List<(Vector2 position, ParticleEmitter emitter)>();
|
||||
|
||||
public float CurrentBrokenVolume
|
||||
{
|
||||
@@ -35,14 +35,10 @@ namespace Barotrauma.Items.Components
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
{
|
||||
case "pumpoutemitter":
|
||||
pumpOutEmitters.Add(new Pair<Vector2, ParticleEmitter>(
|
||||
subElement.GetAttributeVector2("position", Vector2.Zero),
|
||||
new ParticleEmitter(subElement)));
|
||||
pumpOutEmitters.Add((subElement.GetAttributeVector2("position", Vector2.Zero), new ParticleEmitter(subElement)));
|
||||
break;
|
||||
case "pumpinemitter":
|
||||
pumpInEmitters.Add(new Pair<Vector2, ParticleEmitter>(
|
||||
subElement.GetAttributeVector2("position", Vector2.Zero),
|
||||
new ParticleEmitter(subElement)));
|
||||
pumpInEmitters.Add((subElement.GetAttributeVector2("position", Vector2.Zero), new ParticleEmitter(subElement)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -148,21 +144,43 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (FlowPercentage < 0.0f)
|
||||
{
|
||||
foreach (Pair<Vector2, ParticleEmitter> pumpOutEmitter in pumpOutEmitters)
|
||||
foreach (var (position, emitter) in pumpOutEmitters)
|
||||
{
|
||||
//only emit "pump out" particles when underwater
|
||||
Vector2 particlePos = item.Rect.Location.ToVector2() + pumpOutEmitter.First;
|
||||
if (item.CurrentHull != null && item.CurrentHull.Surface < particlePos.Y) continue;
|
||||
if (item.CurrentHull != null && item.CurrentHull.Surface < item.Rect.Location.Y + position.Y) { continue; }
|
||||
|
||||
pumpOutEmitter.Second.Emit(deltaTime, item.WorldRect.Location.ToVector2() + pumpOutEmitter.First * item.Scale, item.CurrentHull,
|
||||
//only emit "pump out" particles when underwater
|
||||
Vector2 relativeParticlePos = (item.WorldRect.Location.ToVector2() + position * item.Scale) - item.WorldPosition;
|
||||
float angle = 0.0f;
|
||||
if (item.FlippedX)
|
||||
{
|
||||
relativeParticlePos.X = -relativeParticlePos.X;
|
||||
angle = MathHelper.Pi;
|
||||
}
|
||||
if (item.FlippedY)
|
||||
{
|
||||
relativeParticlePos.Y = -relativeParticlePos.Y;
|
||||
}
|
||||
|
||||
emitter.Emit(deltaTime, item.WorldPosition + relativeParticlePos, item.CurrentHull, angle,
|
||||
velocityMultiplier: MathHelper.Lerp(0.5f, 1.0f, -FlowPercentage / 100.0f));
|
||||
}
|
||||
}
|
||||
else if (FlowPercentage > 0.0f)
|
||||
{
|
||||
foreach (Pair<Vector2, ParticleEmitter> pumpInEmitter in pumpInEmitters)
|
||||
foreach (var (position, emitter) in pumpInEmitters)
|
||||
{
|
||||
pumpInEmitter.Second.Emit(deltaTime, item.WorldRect.Location.ToVector2() + pumpInEmitter.First * item.Scale, item.CurrentHull,
|
||||
Vector2 relativeParticlePos = (item.WorldRect.Location.ToVector2() + position * item.Scale) - item.WorldPosition;
|
||||
float angle = 0.0f;
|
||||
if (item.FlippedX)
|
||||
{
|
||||
relativeParticlePos.X = -relativeParticlePos.X;
|
||||
angle = MathHelper.Pi;
|
||||
}
|
||||
if (item.FlippedY)
|
||||
{
|
||||
relativeParticlePos.Y = -relativeParticlePos.Y;
|
||||
}
|
||||
emitter.Emit(deltaTime, item.WorldPosition + relativeParticlePos, item.CurrentHull, angle,
|
||||
velocityMultiplier: MathHelper.Lerp(0.5f, 1.0f, FlowPercentage / 100.0f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private GUIFrame inventoryContainer;
|
||||
|
||||
private GUILayoutGroup paddedFrame;
|
||||
|
||||
private readonly Dictionary<string, GUIButton> warningButtons = new Dictionary<string, GUIButton>();
|
||||
|
||||
private static readonly string[] warningTexts = new string[]
|
||||
@@ -74,7 +76,7 @@ namespace Barotrauma.Items.Components
|
||||
tempRangeIndicator = new Sprite(element.GetChildElement("temprangeindicator")?.GetChildElement("sprite"));
|
||||
graphLine = new Sprite(element.GetChildElement("graphline")?.GetChildElement("sprite"));
|
||||
|
||||
var paddedFrame = new GUILayoutGroup(new RectTransform(
|
||||
paddedFrame = new GUILayoutGroup(new RectTransform(
|
||||
GuiFrame.Rect.Size - GUIStyle.ItemFrameMargin, GuiFrame.RectTransform, Anchor.Center)
|
||||
{ AbsoluteOffset = GUIStyle.ItemFrameOffset },
|
||||
isHorizontal: true)
|
||||
@@ -128,27 +130,27 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
|
||||
Point maxIndicatorSize = new Point(int.MaxValue, (int)(40 * GUI.Scale));
|
||||
criticalHeatWarning = new GUITickBox(new RectTransform(new Vector2(0.33f, 1.0f), topLeftArea.RectTransform) { MaxSize = maxIndicatorSize },
|
||||
criticalHeatWarning = new GUITickBox(new RectTransform(new Vector2(0.3f, 1.0f), topLeftArea.RectTransform) { MaxSize = maxIndicatorSize },
|
||||
TextManager.Get("ReactorWarningCriticalTemp"), font: GUI.SubHeadingFont, style: "IndicatorLightRed")
|
||||
{
|
||||
Selected = false,
|
||||
Enabled = false,
|
||||
ToolTip = TextManager.Get("ReactorHeatTip")
|
||||
};
|
||||
lowTemperatureWarning = new GUITickBox(new RectTransform(new Vector2(0.33f, 1.0f), topLeftArea.RectTransform) { MaxSize = maxIndicatorSize },
|
||||
TextManager.Get("ReactorWarningCriticalLowTemp"), font: GUI.SubHeadingFont, style: "IndicatorLightRed")
|
||||
{
|
||||
Selected = false,
|
||||
Enabled = false,
|
||||
ToolTip = TextManager.Get("ReactorTempTip")
|
||||
};
|
||||
criticalOutputWarning = new GUITickBox(new RectTransform(new Vector2(0.33f, 1.0f), topLeftArea.RectTransform) { MaxSize = maxIndicatorSize },
|
||||
criticalOutputWarning = new GUITickBox(new RectTransform(new Vector2(0.3f, 1.0f), topLeftArea.RectTransform) { MaxSize = maxIndicatorSize },
|
||||
TextManager.Get("ReactorWarningCriticalOutput"), font: GUI.SubHeadingFont, style: "IndicatorLightRed")
|
||||
{
|
||||
Selected = false,
|
||||
Enabled = false,
|
||||
ToolTip = TextManager.Get("ReactorOutputTip")
|
||||
};
|
||||
lowTemperatureWarning = new GUITickBox(new RectTransform(new Vector2(0.4f, 1.0f), topLeftArea.RectTransform) { MaxSize = maxIndicatorSize },
|
||||
TextManager.Get("ReactorWarningCriticalLowTemp"), font: GUI.SubHeadingFont, style: "IndicatorLightRed")
|
||||
{
|
||||
Selected = false,
|
||||
Enabled = false,
|
||||
ToolTip = TextManager.Get("ReactorTempTip")
|
||||
};
|
||||
List<GUITickBox> indicatorLights = new List<GUITickBox>() { criticalHeatWarning, lowTemperatureWarning, criticalOutputWarning };
|
||||
indicatorLights.ForEach(l => l.TextBlock.OverrideTextColor(GUI.Style.TextColor));
|
||||
topLeftArea.Recalculate();
|
||||
@@ -334,8 +336,9 @@ namespace Barotrauma.Items.Components
|
||||
};
|
||||
|
||||
topRightArea.Recalculate();
|
||||
autoTempLight.TextBlock.Wrap = true;
|
||||
indicatorLights.Add(autoTempLight);
|
||||
autoTempLight.TextBlock.Padding = new Vector4(autoTempLight.TextBlock.Padding.X, 0.0f, 0.0f, 0.0f);
|
||||
autoTempLight.TextBlock.Text = autoTempLight.TextBlock.Text.Replace(' ', '\n');
|
||||
autoTempLight.TextBlock.AutoScaleHorizontal = true;
|
||||
GUITextBlock.AutoScaleAndNormalize(indicatorLights.Select(l => l.TextBlock));
|
||||
|
||||
// right bottom (graph area) -----------------------
|
||||
@@ -533,8 +536,7 @@ namespace Barotrauma.Items.Components
|
||||
warningButtons["ReactorWarningMeltdown"].Selected = meltDownTimer > MeltdownDelay * 0.5f || item.Condition == 0.0f && lightOn;
|
||||
warningButtons["ReactorWarningSCRAM"].Selected = temperature > 0.1f && !PowerOn;
|
||||
|
||||
if ((FissionRateScrollBar.Rect.Contains(PlayerInput.MousePosition) || FissionRateScrollBar.Children.Contains(GUIScrollBar.DraggingBar) ||
|
||||
TurbineOutputScrollBar.Rect.Contains(PlayerInput.MousePosition) || TurbineOutputScrollBar.Children.Contains(GUIScrollBar.DraggingBar)) &&
|
||||
if (paddedFrame.Rect.Contains(PlayerInput.MousePosition) &&
|
||||
!PlayerInput.KeyDown(InputType.Deselect) && !PlayerInput.KeyHit(InputType.Deselect))
|
||||
{
|
||||
Character.DisableControls = true;
|
||||
|
||||
@@ -87,21 +87,6 @@ namespace Barotrauma.Items.Components
|
||||
//float = strength of the disruption, between 0-1
|
||||
private readonly List<Pair<Vector2, float>> disruptedDirections = new List<Pair<Vector2, float>>();
|
||||
|
||||
class CachedDistance
|
||||
{
|
||||
public readonly Vector2 TransducerWorldPos;
|
||||
public readonly Vector2 WorldPos;
|
||||
public readonly float Distance;
|
||||
public double RecalculationTime;
|
||||
|
||||
public CachedDistance(Vector2 transducerWorldPos, Vector2 worldPos, float dist)
|
||||
{
|
||||
TransducerWorldPos = transducerWorldPos;
|
||||
WorldPos = worldPos;
|
||||
Distance = dist;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Dictionary<object, CachedDistance> markerDistances = new Dictionary<object, CachedDistance>();
|
||||
|
||||
private readonly Color positiveColor = Color.Green;
|
||||
@@ -451,7 +436,9 @@ namespace Barotrauma.Items.Components
|
||||
connectedSubUpdateTimer = ConnectedSubUpdateInterval;
|
||||
}
|
||||
|
||||
if (sonarView.Rect.Contains(PlayerInput.MousePosition))
|
||||
Steering steering = item.GetComponent<Steering>();
|
||||
if (sonarView.Rect.Contains(PlayerInput.MousePosition) &&
|
||||
(GUI.MouseOn == null || GUI.MouseOn == sonarView || sonarView.IsParentOf(GUI.MouseOn) || GUI.MouseOn == steering?.GuiFrame || (steering?.GuiFrame?.IsParentOf(GUI.MouseOn) ?? false)))
|
||||
{
|
||||
float scrollSpeed = PlayerInput.ScrollWheelSpeed / 1000.0f;
|
||||
if (Math.Abs(scrollSpeed) > 0.0001f)
|
||||
@@ -459,8 +446,13 @@ namespace Barotrauma.Items.Components
|
||||
zoomSlider.BarScroll += PlayerInput.ScrollWheelSpeed / 1000.0f;
|
||||
zoomSlider.OnMoved(zoomSlider, zoomSlider.BarScroll);
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyHit(InputType.Run))
|
||||
{
|
||||
SonarModeSwitch.OnClicked(SonarModeSwitch, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float distort = 1.0f - item.Condition / item.MaxCondition;
|
||||
for (int i = sonarBlips.Count - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -623,7 +615,6 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
Steering steering = item.GetComponent<Steering>();
|
||||
if (steering != null && steering.DockingModeEnabled && steering.ActiveDockingSource != null)
|
||||
{
|
||||
float dockingDist = Vector2.Distance(steering.ActiveDockingSource.Item.WorldPosition, steering.DockingTarget.Item.WorldPosition);
|
||||
@@ -790,10 +781,7 @@ namespace Barotrauma.Items.Components
|
||||
DisplayRadius = (rect.Width / 2.0f) * (1.0f - displayBorderSize);
|
||||
displayScale = DisplayRadius / range * zoom;
|
||||
|
||||
if (screenBackground != null)
|
||||
{
|
||||
screenBackground.Draw(spriteBatch, center, 0.0f, rect.Width / screenBackground.size.X);
|
||||
}
|
||||
screenBackground?.Draw(spriteBatch, center, 0.0f, rect.Width / screenBackground.size.X);
|
||||
|
||||
if (useDirectionalPing)
|
||||
{
|
||||
@@ -881,10 +869,7 @@ namespace Barotrauma.Items.Components
|
||||
GUI.DrawString(spriteBatch, rect.Location.ToVector2(), sonarBlips.Count.ToString(), Color.White);
|
||||
}
|
||||
|
||||
if (screenOverlay != null)
|
||||
{
|
||||
screenOverlay.Draw(spriteBatch, center, 0.0f, rect.Width / screenOverlay.size.X);
|
||||
}
|
||||
screenOverlay?.Draw(spriteBatch, center, 0.0f, rect.Width / screenOverlay.size.X);
|
||||
|
||||
if (signalStrength <= 0.5f)
|
||||
{
|
||||
@@ -947,21 +932,25 @@ namespace Barotrauma.Items.Components
|
||||
cave.StartPos.ToVector2(), transducerCenter,
|
||||
displayScale, center, DisplayRadius);
|
||||
}
|
||||
|
||||
|
||||
int missionIndex = 0;
|
||||
foreach (Mission mission in GameMain.GameSession.Missions)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(mission.SonarLabel))
|
||||
{
|
||||
int i = 0;
|
||||
foreach (Vector2 sonarPosition in mission.SonarPositions)
|
||||
{
|
||||
DrawMarker(spriteBatch,
|
||||
mission.SonarLabel,
|
||||
mission.SonarIconIdentifier,
|
||||
mission,
|
||||
sonarPosition, transducerCenter,
|
||||
"mission" + missionIndex + ":" + i,
|
||||
sonarPosition, transducerCenter,
|
||||
displayScale, center, DisplayRadius * 0.95f);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
missionIndex++;
|
||||
}
|
||||
|
||||
if (AllowUsingMineralScanner && useMineralScanner && CurrentMode == Mode.Active && MineralClusters != null)
|
||||
@@ -974,7 +963,7 @@ namespace Barotrauma.Items.Components
|
||||
var i = unobtainedMinerals.FirstOrDefault();
|
||||
if (i == null) { continue; }
|
||||
DrawMarker(spriteBatch,
|
||||
i.Name, "mineral", i,
|
||||
i.Name, "mineral", "mineralcluster" + i,
|
||||
c.center, transducerCenter,
|
||||
displayScale, center, DisplayRadius * 0.95f,
|
||||
onlyShowTextOnMouseOver: true);
|
||||
@@ -987,14 +976,14 @@ namespace Barotrauma.Items.Components
|
||||
if (connectedSubs.Contains(sub)) { continue; }
|
||||
if (sub.WorldPosition.Y > Level.Loaded.Size.Y) { continue; }
|
||||
|
||||
if (item.Submarine != null)
|
||||
if (item.Submarine != null || Character.Controlled != null)
|
||||
{
|
||||
//hide enemy team
|
||||
if (sub.TeamID == CharacterTeamType.Team1 && (item.Submarine.TeamID == CharacterTeamType.Team2 || Character.Controlled?.TeamID == CharacterTeamType.Team2))
|
||||
if (sub.TeamID == CharacterTeamType.Team1 && (item.Submarine?.TeamID == CharacterTeamType.Team2 || Character.Controlled?.TeamID == CharacterTeamType.Team2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (sub.TeamID == CharacterTeamType.Team2 && (item.Submarine.TeamID == CharacterTeamType.Team1 || Character.Controlled?.TeamID == CharacterTeamType.Team1))
|
||||
else if (sub.TeamID == CharacterTeamType.Team2 && (item.Submarine?.TeamID == CharacterTeamType.Team1 || Character.Controlled?.TeamID == CharacterTeamType.Team1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1101,19 +1090,17 @@ namespace Barotrauma.Items.Components
|
||||
if (Level.Loaded != null && dockingPort.Item.Submarine.WorldPosition.Y > Level.Loaded.Size.Y) { continue; }
|
||||
if (dockingPort.Item.Submarine == null) { continue; }
|
||||
if (dockingPort.Item.Submarine.Info.IsWreck) { continue; }
|
||||
if (!dockingPort.Item.Submarine.ShowSonarMarker && !dockingPort.Item.Submarine.Info.IsOutpost) { continue; }
|
||||
// docking ports should be shown even if defined as not, if the submarine is the same as the sonar's
|
||||
if (!dockingPort.Item.Submarine.ShowSonarMarker && dockingPort.Item.Submarine != item.Submarine && !dockingPort.Item.Submarine.Info.IsOutpost) { continue; }
|
||||
|
||||
//don't show the docking ports of the opposing team on the sonar
|
||||
if (item.Submarine != null)
|
||||
if (item.Submarine != null &&
|
||||
item.Submarine != GameMain.NetworkMember?.RespawnManager?.RespawnShuttle &&
|
||||
dockingPort.Item.Submarine != GameMain.NetworkMember?.RespawnManager?.RespawnShuttle &&
|
||||
dockingPort.Item.Submarine.Info.Type != SubmarineType.Outpost)
|
||||
{
|
||||
if (dockingPort.Item.Submarine.TeamID == CharacterTeamType.Team1 && (item.Submarine.TeamID == CharacterTeamType.Team2 || Character.Controlled?.TeamID == CharacterTeamType.Team2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (dockingPort.Item.Submarine.TeamID == CharacterTeamType.Team2 && (item.Submarine.TeamID == CharacterTeamType.Team1 || Character.Controlled?.TeamID == CharacterTeamType.Team1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// specifically checking for friendlyNPC seems more logical here
|
||||
if (dockingPort.Item.Submarine.TeamID != item.Submarine.TeamID && dockingPort.Item.Submarine.TeamID != CharacterTeamType.FriendlyNPC) { continue; }
|
||||
}
|
||||
|
||||
Vector2 offset = (dockingPort.Item.WorldPosition - transducerCenter) * scale;
|
||||
@@ -1629,9 +1616,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (markerDistances.TryGetValue(targetIdentifier, out CachedDistance cachedDistance))
|
||||
{
|
||||
if (Timing.TotalTime > cachedDistance.RecalculationTime &&
|
||||
(Vector2.DistanceSquared(cachedDistance.TransducerWorldPos, transducerPosition) > 500 * 500 ||
|
||||
Vector2.DistanceSquared(cachedDistance.WorldPos, worldPosition) > 500 * 500))
|
||||
if (cachedDistance.ShouldUpdateDistance(transducerPosition, worldPosition))
|
||||
{
|
||||
markerDistances.Remove(targetIdentifier);
|
||||
CalculateDistance();
|
||||
@@ -1653,10 +1638,7 @@ namespace Barotrauma.Items.Components
|
||||
var path = pathFinder.FindPath(ConvertUnits.ToSimUnits(transducerPosition), ConvertUnits.ToSimUnits(worldPosition));
|
||||
if (!path.Unreachable)
|
||||
{
|
||||
var cachedDistance = new CachedDistance(transducerPosition, worldPosition, path.TotalLength)
|
||||
{
|
||||
RecalculationTime = Timing.TotalTime + Rand.Range(1.0f, 5.0f)
|
||||
};
|
||||
var cachedDistance = new CachedDistance(transducerPosition, worldPosition, path.TotalLength, Timing.TotalTime + Rand.Range(1.0f, 5.0f));
|
||||
markerDistances.Add(targetIdentifier, cachedDistance);
|
||||
dist = path.TotalLength;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user