Added nullable to most Content.Shared files (#3238)

* Add nullable to some Content.Shared files.

* Use [NotNullWhen(true)]

* Undo adding now redundant !'s

* Forgot one

* Add a ton more nullable

* You can guess

* Fix some issues

* It actually compiles now

* Auto stash before merge of "null2" and "origin/master"

* I lied

* enable annotations -> enable

* Revert ActionBlockerSystem.cs to original

* Fix ActionBlockerSystem.cs

* More nullable

* Undo some added exclamation marks

* Fix issues

* Update Content.Shared/Maps/ContentTileDefinition.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Resolve some issues

* Remove unused method

* Fix more issues

* Fix more issues

* Fix more issues

* Fix more issues

* Fix issue, rollback SharedGhostComponent.cs

* Update submodule

* Fix issue, invert some if-statements to reduce nesting

* Revert RobustToolbox

* FIx things broken by merge

* Some fixes

- Replaced with string.Empty
- Remove some exclamation marks
- Revert file

* Some fixes

* Trivial #nullable enable

* Fix null ables

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
Visne
2021-02-27 04:12:09 +01:00
committed by GitHub
parent 2f45e5e044
commit 9b94d5c195
377 changed files with 1048 additions and 646 deletions

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;

View File

@@ -1,4 +1,5 @@
using Robust.Shared.GameObjects;
#nullable enable
using Robust.Shared.GameObjects;
namespace Content.Shared.GameObjects.Verbs
{

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;

View File

@@ -1,4 +1,6 @@
namespace Content.Shared.GameObjects.Verbs
#nullable enable
namespace Content.Shared.GameObjects.Verbs
{
public abstract class VerbBase
{

View File

@@ -1,3 +1,5 @@
#nullable enable
namespace Content.Shared.GameObjects.Verbs
{
/// <summary>

View File

@@ -1,3 +1,4 @@
#nullable enable
using Robust.Shared.Utility;
namespace Content.Shared.GameObjects.Verbs
@@ -7,18 +8,25 @@ namespace Content.Shared.GameObjects.Verbs
/// </summary>
public readonly struct VerbCategoryData
{
public VerbCategoryData(string name, SpriteSpecifier icon)
public VerbCategoryData(string name, SpriteSpecifier? icon)
{
Name = name;
Icon = icon;
}
public string Name { get; }
public SpriteSpecifier Icon { get; }
public SpriteSpecifier? Icon { get; }
public static implicit operator VerbCategoryData((string name, string icon) tuple)
public static implicit operator VerbCategoryData((string name, string? icon) tuple)
{
return new(tuple.name, tuple.icon == null ? null : new SpriteSpecifier.Texture(new ResourcePath(tuple.icon)));
var (name, icon) = tuple;
if (icon == null)
{
return new VerbCategoryData(name, null);
}
return new VerbCategoryData(name, new SpriteSpecifier.Texture(new ResourcePath(icon)));
}
}
}

View File

@@ -1,3 +1,4 @@
#nullable enable
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Utility;
@@ -16,12 +17,12 @@ namespace Content.Shared.GameObjects.Verbs
/// <summary>
/// The text that the user sees on the verb button.
/// </summary>
public string Text { get; set; }
public string Text { get; set; } = string.Empty;
/// <summary>
/// Sprite of the icon that the user sees on the verb button.
/// </summary>
public SpriteSpecifier Icon { get; set; }
public SpriteSpecifier Icon { get; set; } = SpriteSpecifier.Invalid;
/// <summary>
/// Name of the category this button is under.
@@ -31,7 +32,7 @@ namespace Content.Shared.GameObjects.Verbs
/// <summary>
/// Sprite of the icon that the user sees on the verb button.
/// </summary>
public SpriteSpecifier CategoryIcon { get; set; }
public SpriteSpecifier? CategoryIcon { get; set; } = SpriteSpecifier.Invalid;
/// <summary>
/// Whether this verb is visible, disabled (greyed out) or hidden.

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using System.Reflection;
using Robust.Shared.Containers;

View File

@@ -1,3 +1,5 @@
#nullable enable
namespace Content.Shared.GameObjects.Verbs
{
/// <summary>