Enable nullability in Content.Server (#3685)

This commit is contained in:
DrSmugleaf
2021-03-16 15:50:20 +01:00
committed by GitHub
parent 90fec0ed24
commit a5ade526b7
306 changed files with 1616 additions and 1441 deletions

View File

@@ -20,7 +20,7 @@ namespace Content.Client.GameObjects.Components.CloningPod
base.Open();
_window = new CloningPodWindow(new Dictionary<int, string>());
_window = new CloningPodWindow(new Dictionary<int, string?>());
_window.OnClose += Close;
_window.CloneButton.OnPressed += _ =>
{

View File

@@ -11,7 +11,7 @@ namespace Content.Client.GameObjects.Components.CloningPod
{
public sealed class CloningPodWindow : SS14Window
{
private Dictionary<int, string> _scanManager;
private Dictionary<int, string?> _scanManager;
private readonly VBoxContainer _scanList;
public readonly Button CloneButton;
@@ -21,11 +21,11 @@ namespace Content.Client.GameObjects.Components.CloningPod
private readonly ProgressBar _cloningProgressBar;
private readonly Label _mindState;
private CloningPodBoundUserInterfaceState _lastUpdate = null!;
private CloningPodBoundUserInterfaceState? _lastUpdate;
public int? SelectedScan;
public CloningPodWindow(Dictionary<int, string> scanManager)
public CloningPodWindow(Dictionary<int, string?> scanManager)
{
SetSize = MinSize = (250, 300);
_scanManager = scanManager;
@@ -120,7 +120,7 @@ namespace Content.Client.GameObjects.Components.CloningPod
{
var button = new CloningScanButton
{
Scan = scan.Value,
Scan = scan.Value ?? string.Empty,
Id = scan.Key
};
button.ActualButton.OnToggled += OnItemButtonToggled;

View File

@@ -20,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Interactable
[ViewVariables(VVAccess.ReadWrite)] private bool _uiUpdateNeeded;
[ViewVariables] public bool StatusShowBehavior => _statusShowBehavior;
[ViewVariables] public ToolQuality Behavior => _behavior;
[ViewVariables] public ToolQuality? Behavior => _behavior;
public override string Name => "MultiTool";
public override uint? NetID => ContentNetIDs.MULTITOOLS;
@@ -63,11 +63,7 @@ namespace Content.Client.GameObjects.Components.Interactable
_parent._uiUpdateNeeded = false;
if(!_parent.StatusShowBehavior)
_label.SetMarkup(string.Empty);
else
_label.SetMarkup(_parent.Behavior.ToString());
_label.SetMarkup(_parent.StatusShowBehavior ? _parent.Behavior.ToString() ?? string.Empty : string.Empty);
}
}
}

View File

@@ -41,7 +41,7 @@ namespace Content.Client.GameObjects.Components.Mobs
private void UpdateLooks()
{
if (Appearance is null ||
if (Appearance is null! ||
!Owner.TryGetComponent(out SpriteComponent? sprite))
{
return;

View File

@@ -74,20 +74,23 @@ namespace Content.Client.UserInterface
{
var playerInfoText = new RichTextLabel();
if (playerInfo.Observer)
if (playerInfo.PlayerICName != null)
{
playerInfoText.SetMarkup(
Loc.GetString("[color=gray]{0}[/color] was [color=lightblue]{1}[/color], an observer.",
playerInfo.PlayerOOCName, playerInfo.PlayerICName));
}
else
{
//TODO: On Hover display a popup detailing more play info.
//For example: their antag goals and if they completed them sucessfully.
var icNameColor = playerInfo.Antag ? "red" : "white";
playerInfoText.SetMarkup(
Loc.GetString("[color=gray]{0}[/color] was [color={1}]{2}[/color] playing role of [color=orange]{3}[/color].",
playerInfo.PlayerOOCName, icNameColor, playerInfo.PlayerICName, Loc.GetString(playerInfo.Role)));
if (playerInfo.Observer)
{
playerInfoText.SetMarkup(
Loc.GetString("[color=gray]{0}[/color] was [color=lightblue]{1}[/color], an observer.",
playerInfo.PlayerOOCName, playerInfo.PlayerICName));
}
else
{
//TODO: On Hover display a popup detailing more play info.
//For example: their antag goals and if they completed them sucessfully.
var icNameColor = playerInfo.Antag ? "red" : "white";
playerInfoText.SetMarkup(
Loc.GetString("[color=gray]{0}[/color] was [color={1}]{2}[/color] playing role of [color=orange]{3}[/color].",
playerInfo.PlayerOOCName, icNameColor, playerInfo.PlayerICName, Loc.GetString(playerInfo.Role)));
}
}
innerScrollContainer.AddChild(playerInfoText);
}