Fix a bunch of warnings (#5058)

This commit is contained in:
Visne
2021-10-28 13:19:38 +02:00
committed by GitHub
parent 0bca9befca
commit 94579d1877
11 changed files with 65 additions and 73 deletions

View File

@@ -1,5 +1,5 @@
using System;
using Content.Client.GameObjects.Components;
using Content.Client.Computer;
using Content.Shared.Solar;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
@@ -27,32 +27,36 @@ namespace Content.Client.Power
public void SetupComputerWindow(ComputerBoundUserInterfaceBase cb)
{
PanelRotation.OnTextEntered += (text) => {
PanelRotation.OnTextEntered += text => {
double value;
if (double.TryParse((string?) text.Text, out value))
if (!double.TryParse((string?) text.Text, out value)) return;
SolarControlConsoleAdjustMessage msg = new()
{
SolarControlConsoleAdjustMessage msg = new SolarControlConsoleAdjustMessage();
msg.Rotation = Angle.FromDegrees(value);
msg.AngularVelocity = _lastState.AngularVelocity;
cb.SendMessage(msg);
// Predict this...
_lastState.Rotation = msg.Rotation;
NotARadar.UpdateState(_lastState);
}
Rotation = Angle.FromDegrees(value), AngularVelocity = _lastState.AngularVelocity,
};
cb.SendMessage(msg);
// Predict this...
_lastState.Rotation = msg.Rotation;
NotARadar.UpdateState(_lastState);
};
PanelVelocity.OnTextEntered += (text) => {
PanelVelocity.OnTextEntered += text => {
double value;
if (double.TryParse((string?) text.Text, out value))
if (!double.TryParse((string?) text.Text, out value)) return;
SolarControlConsoleAdjustMessage msg = new()
{
SolarControlConsoleAdjustMessage msg = new SolarControlConsoleAdjustMessage();
msg.Rotation = NotARadar.PredictedPanelRotation;
msg.AngularVelocity = Angle.FromDegrees(value / 60);
cb.SendMessage(msg);
// Predict this...
_lastState.Rotation = NotARadar.PredictedPanelRotation;
_lastState.AngularVelocity = msg.AngularVelocity;
NotARadar.UpdateState(_lastState);
}
Rotation = NotARadar.PredictedPanelRotation, AngularVelocity = Angle.FromDegrees(value / 60),
};
cb.SendMessage(msg);
// Predict this...
_lastState.Rotation = NotARadar.PredictedPanelRotation;
_lastState.AngularVelocity = msg.AngularVelocity;
NotARadar.UpdateState(_lastState);
};
}