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,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -19,12 +20,12 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
|
||||
public class DestructionEventArgs : EventArgs
|
||||
{
|
||||
public IEntity Owner { get; set; }
|
||||
public IEntity Owner { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class BreakageEventArgs : EventArgs
|
||||
{
|
||||
public IEntity Owner { get; set; }
|
||||
public IEntity Owner { get; set; } = default!;
|
||||
}
|
||||
|
||||
public interface IBreakAct
|
||||
@@ -46,7 +47,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
public class ExplosionEventArgs : EventArgs
|
||||
{
|
||||
public EntityCoordinates Source { get; set; }
|
||||
public IEntity Target { get; set; }
|
||||
public IEntity Target { get; set; } = default!;
|
||||
public ExplosionSeverity Severity { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.EntitySystems.ActionBlocker
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Content.Shared.GameObjects.Components.Mobs.Speech;
|
||||
#nullable enable
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.GameObjects.Components.Mobs.Speech;
|
||||
using Content.Shared.GameObjects.EntitySystems.EffectBlocker;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -24,8 +26,13 @@ namespace Content.Shared.GameObjects.EntitySystems.ActionBlocker
|
||||
return canMove;
|
||||
}
|
||||
|
||||
public static bool CanInteract(IEntity entity)
|
||||
public static bool CanInteract([NotNullWhen(true)] IEntity? entity)
|
||||
{
|
||||
if (entity == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var canInteract = true;
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
@@ -36,8 +43,13 @@ namespace Content.Shared.GameObjects.EntitySystems.ActionBlocker
|
||||
return canInteract;
|
||||
}
|
||||
|
||||
public static bool CanUse(IEntity entity)
|
||||
public static bool CanUse([NotNullWhen(true)] IEntity? entity)
|
||||
{
|
||||
if (entity == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var canUse = true;
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.EntitySystems.EffectBlocker;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.EntitySystems.EffectBlocker;
|
||||
|
||||
namespace Content.Shared.GameObjects.EntitySystems.ActionBlocker
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
@@ -18,7 +19,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
|
||||
public class SolutionChangeEventArgs : EventArgs
|
||||
{
|
||||
public IEntity Owner { get; set; }
|
||||
public IEntity Owner { get; set; } = default!;
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using Content.Shared.Damage;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.EntitySystems.EffectBlocker
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
|
||||
namespace Content.Shared.GameObjects.EntitySystems.EffectBlocker
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.GameObjects.EntitySystems
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Chemistry;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
@@ -9,7 +10,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
{
|
||||
public abstract class SharedChemicalReactionSystem : EntitySystem
|
||||
{
|
||||
private IEnumerable<ReactionPrototype> _reactions;
|
||||
private IEnumerable<ReactionPrototype> _reactions = default!;
|
||||
|
||||
private const int MaxReactionIterations = 20;
|
||||
|
||||
@@ -139,7 +140,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
return;
|
||||
|
||||
var totalVolume = solution.TotalVolume + products.TotalVolume;
|
||||
var excessVolume = totalVolume - maxVolume;
|
||||
var excessVolume = totalVolume - maxVolume;
|
||||
|
||||
if (excessVolume > 0)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.EntitySystemMessages;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -18,7 +19,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
{
|
||||
var entity = eventArgs.SenderSession?.AttachedEntity;
|
||||
|
||||
if (entity == null || !entity.TryGetComponent(out SharedCombatModeComponent combatModeComponent))
|
||||
if (entity == null || !entity.TryGetComponent(out SharedCombatModeComponent? combatModeComponent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components.Disposal;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Disposal;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -12,8 +13,8 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
[Serializable, NetSerializable]
|
||||
public class GhostRole
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public EntityUid Id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
|
||||
var owner = session?.AttachedEntity;
|
||||
|
||||
if (owner != null)
|
||||
if (owner != null && session != null)
|
||||
{
|
||||
foreach (var comp in owner.GetAllComponents<IRelayMoveInput>())
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.EntitySystems.EffectBlocker;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user