(3dc4135ce) v0.9.5.1
This commit is contained in:
@@ -38,7 +38,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void ToggleCrewArea(bool value, bool storeOriginalState)
|
||||
{
|
||||
var crewManager = GameMain.GameSession.CrewManager;
|
||||
var crewManager = GameMain.GameSession?.CrewManager;
|
||||
if (crewManager == null) { return; }
|
||||
|
||||
if (storeOriginalState)
|
||||
@@ -50,7 +50,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void ToggleChatBox(bool value, bool storeOriginalState)
|
||||
{
|
||||
var crewManager = GameMain.GameSession.CrewManager;
|
||||
var crewManager = GameMain.GameSession?.CrewManager;
|
||||
if (crewManager == null) { return; }
|
||||
|
||||
if (crewManager.IsSinglePlayer)
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void DrawHUDFront(SpriteBatch spriteBatch, GUICustomComponent container)
|
||||
{
|
||||
if (voltage < minVoltage)
|
||||
if (Voltage < MinVoltage)
|
||||
{
|
||||
Vector2 textSize = GUI.Font.MeasureString(noPowerTip);
|
||||
Vector2 textPos = GuiFrame.Rect.Center.ToVector2();
|
||||
@@ -164,7 +164,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (voltage < minVoltage)
|
||||
if (Voltage < MinVoltage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override void OnItemLoaded()
|
||||
{
|
||||
base.OnItemLoaded();
|
||||
if (pumpSpeedSlider != null)
|
||||
{
|
||||
pumpSpeedSlider.BarScroll = (flowPercentage + 100.0f) / 200.0f;
|
||||
|
||||
@@ -290,6 +290,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override void OnItemLoaded()
|
||||
{
|
||||
base.OnItemLoaded();
|
||||
turbineOutputScrollBar.BarScroll = targetTurbineOutput / 100.0f;
|
||||
fissionRateScrollBar.BarScroll = targetFissionRate / 100.0f;
|
||||
var itemContainer = item.GetComponent<ItemContainer>();
|
||||
@@ -604,14 +605,15 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
protected override void RemoveComponentSpecific()
|
||||
{
|
||||
graphLine.Remove();
|
||||
fissionRateMeter.Remove();
|
||||
turbineOutputMeter.Remove();
|
||||
meterPointer.Remove();
|
||||
sectorSprite.Remove();
|
||||
tempMeterFrame.Remove();
|
||||
tempMeterBar.Remove();
|
||||
tempRangeIndicator.Remove();
|
||||
base.RemoveComponentSpecific();
|
||||
graphLine?.Remove();
|
||||
fissionRateMeter?.Remove();
|
||||
turbineOutputMeter?.Remove();
|
||||
meterPointer?.Remove();
|
||||
sectorSprite?.Remove();
|
||||
tempMeterFrame?.Remove();
|
||||
tempMeterBar?.Remove();
|
||||
tempRangeIndicator?.Remove();
|
||||
}
|
||||
|
||||
public void ClientWrite(IWriteMessage msg, object[] extraData = null)
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Barotrauma.Items.Components
|
||||
//float = strength of the disruption, between 0-1
|
||||
List<Pair<Vector2, float>> disruptedDirections = new List<Pair<Vector2, float>>();
|
||||
|
||||
private static Color[] blipColorGradient =
|
||||
private static readonly Color[] blipColorGradient =
|
||||
{
|
||||
Color.TransparentBlack,
|
||||
new Color(0, 50, 160),
|
||||
@@ -162,9 +162,9 @@ namespace Barotrauma.Items.Components
|
||||
signalWarningText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), paddedControlContainer.RectTransform), "", Color.Orange, textAlignment: Alignment.Center);
|
||||
|
||||
GUIRadioButtonGroup sonarMode = new GUIRadioButtonGroup();
|
||||
sonarMode.AddRadioButton(Mode.Active, activeTickBox);
|
||||
sonarMode.AddRadioButton(Mode.Passive, passiveTickBox);
|
||||
sonarMode.Selected = Mode.Passive;
|
||||
sonarMode.AddRadioButton((int)Mode.Active, activeTickBox);
|
||||
sonarMode.AddRadioButton((int)Mode.Passive, passiveTickBox);
|
||||
sonarMode.Selected = (int)Mode.Passive;
|
||||
|
||||
GuiFrame.CanBeFocused = false;
|
||||
|
||||
@@ -226,6 +226,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override void OnItemLoaded()
|
||||
{
|
||||
base.OnItemLoaded();
|
||||
zoomSlider.BarScroll = MathUtils.InverseLerp(MinZoom, MaxZoom, zoom);
|
||||
//make the sonarView customcomponent render the steering view so it gets drawn in front of the sonar
|
||||
item.GetComponent<Steering>()?.AttachToSonarHUD(sonarView);
|
||||
@@ -434,7 +435,7 @@ namespace Barotrauma.Items.Components
|
||||
if (distSqr > t.SoundRange * t.SoundRange * 2) { continue; }
|
||||
|
||||
float dist = (float)Math.Sqrt(distSqr);
|
||||
if (dist > prevPassivePingRadius * Range && dist <= passivePingRadius * Range)
|
||||
if (dist > prevPassivePingRadius * Range && dist <= passivePingRadius * Range && Rand.Int(sonarBlips.Count) < 500)
|
||||
{
|
||||
Ping(t.WorldPosition, transducerCenter,
|
||||
Math.Min(t.SoundRange, range * 0.5f) * displayScale, 0, displayScale, Math.Min(t.SoundRange, range * 0.5f),
|
||||
@@ -675,14 +676,14 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
else if (startOutside)
|
||||
{
|
||||
if (MathUtils.GetLineCircleIntersections(Vector2.Zero, DisplayRadius, end, start, true, out Vector2? intersection1, out Vector2? intersection2) == 1)
|
||||
if (MathUtils.GetLineCircleIntersections(Vector2.Zero, DisplayRadius, end, start, true, out Vector2? intersection1, out _) == 1)
|
||||
{
|
||||
DrawLineSprite(spriteBatch, center + intersection1.Value, center + end, color, width: width);
|
||||
}
|
||||
}
|
||||
else if (endOutside)
|
||||
{
|
||||
if (MathUtils.GetLineCircleIntersections(Vector2.Zero, DisplayRadius, start, end, true, out Vector2? intersection1, out Vector2? intersection2) == 1)
|
||||
if (MathUtils.GetLineCircleIntersections(Vector2.Zero, DisplayRadius, start, end, true, out Vector2? intersection1, out _) == 1)
|
||||
{
|
||||
DrawLineSprite(spriteBatch, center + start, center + intersection1.Value, color, width: width);
|
||||
}
|
||||
@@ -750,7 +751,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
size.Y = 0.0f;
|
||||
}
|
||||
GUI.DrawLine(spriteBatch, center + offset - size, center + offset + size, Color.LightGreen, width: (int)(zoom * 2.5f));
|
||||
GUI.DrawLine(spriteBatch, center + offset - size, center + offset + size, Color.LightGreen * signalStrength, width: (int)(zoom * 2.5f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -769,8 +770,6 @@ namespace Barotrauma.Items.Components
|
||||
Vector2 targetPortDiff = (steering.DockingTarget.Item.WorldPosition - transducerCenter) * scale;
|
||||
Vector2 targetPortPos = new Vector2(targetPortDiff.X, -targetPortDiff.Y);
|
||||
|
||||
Vector2 midPos = (sourcePortPos + targetPortPos) / 2.0f;
|
||||
|
||||
System.Diagnostics.Debug.Assert(steering.ActiveDockingSource.IsHorizontal == steering.DockingTarget.IsHorizontal);
|
||||
Vector2 diff = steering.DockingTarget.Item.WorldPosition - steering.ActiveDockingSource.Item.WorldPosition;
|
||||
float dist = diff.Length();
|
||||
@@ -851,7 +850,6 @@ namespace Barotrauma.Items.Components
|
||||
private void UpdateDisruptions(Vector2 pingSource, float worldPingRadius, float worldPrevPingRadius)
|
||||
{
|
||||
float worldPingRadiusSqr = worldPingRadius * worldPingRadius;
|
||||
float worldPrevPingRadiusSqr = worldPrevPingRadius * worldPrevPingRadius;
|
||||
|
||||
disruptedDirections.Clear();
|
||||
if (Level.Loaded == null) { return; }
|
||||
|
||||
@@ -159,9 +159,9 @@ namespace Barotrauma.Items.Components
|
||||
};
|
||||
|
||||
GUIRadioButtonGroup modes = new GUIRadioButtonGroup();
|
||||
modes.AddRadioButton(Mode.AutoPilot, autopilotTickBox);
|
||||
modes.AddRadioButton(Mode.Manual, manualTickBox);
|
||||
modes.Selected = Mode.Manual;
|
||||
modes.AddRadioButton((int)Mode.AutoPilot, autopilotTickBox);
|
||||
modes.AddRadioButton((int)Mode.Manual, manualTickBox);
|
||||
modes.Selected = (int)Mode.Manual;
|
||||
|
||||
var autoPilotControls = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.6f), paddedControlContainer.RectTransform), "InnerFrame");
|
||||
var paddedAutoPilotControls = new GUILayoutGroup(new RectTransform(new Vector2(0.8f), autoPilotControls.RectTransform, Anchor.Center))
|
||||
@@ -171,7 +171,7 @@ namespace Barotrauma.Items.Components
|
||||
};
|
||||
|
||||
maintainPosTickBox = new GUITickBox(new RectTransform(new Vector2(0.2f, 0.2f), paddedAutoPilotControls.RectTransform),
|
||||
TextManager.Get("SteeringMaintainPos"), font: GUI.SmallFont)
|
||||
TextManager.Get("SteeringMaintainPos"), font: GUI.SmallFont, style: "GUIRadioButton")
|
||||
{
|
||||
Enabled = false,
|
||||
Selected = maintainPos,
|
||||
@@ -208,7 +208,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
levelStartTickBox = new GUITickBox(new RectTransform(new Vector2(0.2f, 0.2f), paddedAutoPilotControls.RectTransform),
|
||||
GameMain.GameSession?.StartLocation == null ? "" : ToolBox.LimitString(GameMain.GameSession.StartLocation.Name, 20),
|
||||
font: GUI.SmallFont)
|
||||
font: GUI.SmallFont, style: "GUIRadioButton")
|
||||
{
|
||||
Enabled = false,
|
||||
Selected = levelStartSelected,
|
||||
@@ -235,7 +235,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
levelEndTickBox = new GUITickBox(new RectTransform(new Vector2(0.2f, 0.2f), paddedAutoPilotControls.RectTransform),
|
||||
GameMain.GameSession?.EndLocation == null ? "" : ToolBox.LimitString(GameMain.GameSession.EndLocation.Name, 20),
|
||||
font: GUI.SmallFont)
|
||||
font: GUI.SmallFont, style: "GUIRadioButton")
|
||||
{
|
||||
Enabled = false,
|
||||
Selected = levelEndSelected,
|
||||
@@ -263,11 +263,11 @@ namespace Barotrauma.Items.Components
|
||||
autoPilotControlsDisabler = new GUIFrame(new RectTransform(Vector2.One, autoPilotControls.RectTransform), "InnerFrame");
|
||||
|
||||
GUIRadioButtonGroup destinations = new GUIRadioButtonGroup();
|
||||
destinations.AddRadioButton(Destination.MaintainPos, maintainPosTickBox);
|
||||
destinations.AddRadioButton(Destination.LevelStart, levelStartTickBox);
|
||||
destinations.AddRadioButton(Destination.LevelEnd, levelEndTickBox);
|
||||
destinations.Selected = maintainPos ? Destination.MaintainPos :
|
||||
levelStartSelected ? Destination.LevelStart : Destination.LevelEnd;
|
||||
destinations.AddRadioButton((int)Destination.MaintainPos, maintainPosTickBox);
|
||||
destinations.AddRadioButton((int)Destination.LevelStart, levelStartTickBox);
|
||||
destinations.AddRadioButton((int)Destination.LevelEnd, levelEndTickBox);
|
||||
destinations.Selected = (int)(maintainPos ? Destination.MaintainPos :
|
||||
levelStartSelected ? Destination.LevelStart : Destination.LevelEnd);
|
||||
|
||||
string steeringVelX = TextManager.Get("SteeringVelocityX");
|
||||
string steeringVelY = TextManager.Get("SteeringVelocityY");
|
||||
@@ -442,7 +442,7 @@ namespace Barotrauma.Items.Components
|
||||
int x = rect.X;
|
||||
int y = rect.Y;
|
||||
|
||||
if (voltage < minVoltage && currPowerConsumption > 0.0f) return;
|
||||
if (Voltage < MinVoltage) { return; }
|
||||
|
||||
Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40);
|
||||
Vector2 displaySubPos = (-sonar.DisplayOffset * sonar.Zoom) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
|
||||
@@ -649,7 +649,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
autoPilotControlsDisabler.Visible = !AutoPilot;
|
||||
|
||||
if (voltage < minVoltage && currPowerConsumption > 0.0f)
|
||||
if (Voltage < MinVoltage)
|
||||
{
|
||||
tipContainer.Visible = true;
|
||||
tipContainer.Text = noPowerTip;
|
||||
@@ -819,6 +819,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
protected override void RemoveComponentSpecific()
|
||||
{
|
||||
base.RemoveComponentSpecific();
|
||||
maintainPosIndicator?.Remove();
|
||||
maintainPosOriginIndicator?.Remove();
|
||||
steeringIndicator?.Remove();
|
||||
|
||||
Reference in New Issue
Block a user