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:
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -6,8 +7,8 @@ namespace Content.Shared.Construction
|
||||
{
|
||||
public abstract class ArbitraryInsertConstructionGraphStep : EntityInsertConstructionGraphStep
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public SpriteSpecifier Icon { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -7,7 +8,7 @@ namespace Content.Shared.Construction
|
||||
{
|
||||
public class ComponentConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
||||
{
|
||||
public string Component { get; private set; }
|
||||
public string Component { get; private set; } = string.Empty;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Maps;
|
||||
#nullable enable
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -12,11 +13,11 @@ namespace Content.Shared.Construction.ConstructionConditions
|
||||
public class TileType : IConstructionCondition
|
||||
{
|
||||
|
||||
public List<string> TargetTiles { get; private set; }
|
||||
public List<string> TargetTiles { get; private set; } = new();
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.TargetTiles, "targets", null);
|
||||
serializer.DataField(this, x => x.TargetTiles, "targets", new List<string>());
|
||||
}
|
||||
|
||||
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -13,11 +14,11 @@ namespace Content.Shared.Construction
|
||||
public class ConstructionGraphEdge : IExposeData
|
||||
{
|
||||
private List<ConstructionGraphStep> _steps = new();
|
||||
private List<IEdgeCondition> _conditions;
|
||||
private List<IGraphAction> _completed;
|
||||
private List<IEdgeCondition> _conditions = new();
|
||||
private List<IGraphAction> _completed = new();
|
||||
|
||||
[ViewVariables]
|
||||
public string Target { get; private set; }
|
||||
public string Target { get; private set; } = string.Empty;
|
||||
|
||||
[ViewVariables]
|
||||
public IReadOnlyList<IEdgeCondition> Conditions => _conditions;
|
||||
@@ -48,7 +49,7 @@ namespace Content.Shared.Construction
|
||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
||||
InternalExposeData(serializer);
|
||||
|
||||
if (!mapping.TryGetNode("steps", out YamlSequenceNode stepsMapping)) return;
|
||||
if (!mapping.TryGetNode("steps", out YamlSequenceNode? stepsMapping)) return;
|
||||
|
||||
foreach (var yamlNode in stepsMapping)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -10,7 +11,7 @@ namespace Content.Shared.Construction
|
||||
[Serializable]
|
||||
public abstract class ConstructionGraphStep : IExposeData
|
||||
{
|
||||
private List<IGraphAction> _completed;
|
||||
private List<IGraphAction> _completed = new();
|
||||
public float DoAfter { get; private set; }
|
||||
public IReadOnlyList<IGraphAction> Completed => _completed;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -9,50 +10,50 @@ namespace Content.Shared.Construction
|
||||
[Prototype("construction")]
|
||||
public class ConstructionPrototype : IPrototype
|
||||
{
|
||||
private List<IConstructionCondition> _conditions;
|
||||
private List<IConstructionCondition> _conditions = new();
|
||||
|
||||
/// <summary>
|
||||
/// Friendly name displayed in the construction GUI.
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// "Useful" description displayed in the construction GUI.
|
||||
/// </summary>
|
||||
public string Description { get; private set; }
|
||||
public string Description { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="ConstructionGraphPrototype"/> this construction will be using.
|
||||
/// </summary>
|
||||
public string Graph { get; private set; }
|
||||
public string Graph { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The target <see cref="ConstructionGraphNode"/> this construction will guide the user to.
|
||||
/// </summary>
|
||||
public string TargetNode { get; private set; }
|
||||
public string TargetNode { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The starting <see cref="ConstructionGraphNode"/> this construction will start at.
|
||||
/// </summary>
|
||||
public string StartNode { get; private set; }
|
||||
public string StartNode { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Texture path inside the construction GUI.
|
||||
/// </summary>
|
||||
public SpriteSpecifier Icon { get; private set; }
|
||||
public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid;
|
||||
|
||||
/// <summary>
|
||||
/// If you can start building or complete steps on impassable terrain.
|
||||
/// </summary>
|
||||
public bool CanBuildInImpassable { get; private set; }
|
||||
|
||||
public string Category { get; private set; }
|
||||
public string Category { get; private set; } = string.Empty;
|
||||
|
||||
public ConstructionType Type { get; private set; }
|
||||
public ConstructionType Type { get; private set; } = ConstructionType.Structure;
|
||||
|
||||
public string ID { get; private set; }
|
||||
public string ID { get; private set; } = string.Empty;
|
||||
|
||||
public string PlacementMode { get; private set; }
|
||||
public string PlacementMode { get; private set; } = "PlaceFree";
|
||||
|
||||
/// <summary>
|
||||
/// Whether this construction can be constructed rotated or not.
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Construction
|
||||
{
|
||||
public abstract class EntityInsertConstructionGraphStep : ConstructionGraphStep
|
||||
{
|
||||
public string Store { get; private set; }
|
||||
public string Store { get; private set; } = string.Empty;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
#nullable enable
|
||||
using System.Threading.Tasks;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
@@ -11,7 +12,7 @@ namespace Content.Shared.Construction
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
if (!mapping.TryGetNode("steps", out YamlSequenceNode steps)) return;
|
||||
if (!mapping.TryGetNode("steps", out YamlSequenceNode? steps)) return;
|
||||
|
||||
foreach (var node in steps)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -7,7 +8,7 @@ namespace Content.Shared.Construction
|
||||
{
|
||||
public class PrototypeConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
||||
{
|
||||
public string Prototype { get; private set; }
|
||||
public string Prototype { get; private set; } = string.Empty;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -9,7 +10,7 @@ namespace Content.Shared.Construction
|
||||
{
|
||||
public ToolQuality Tool { get; private set; }
|
||||
public float Fuel { get; private set; }
|
||||
public string ExamineOverride { get; private set; }
|
||||
public string ExamineOverride { get; private set; } = string.Empty;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user