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.Collections.Generic;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Mobs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
|
||||
using Content.Shared.Actions;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Input.Binding;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Alert;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -24,7 +25,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
|
||||
[ViewVariables] private Dictionary<AlertKey, AlertState> _alerts = new();
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Players;
|
||||
@@ -36,7 +37,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Shared.Preferences;
|
||||
using Robust.Shared.Enums;
|
||||
@@ -10,7 +11,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
{
|
||||
public abstract class SharedHumanoidAppearanceComponent : Component
|
||||
{
|
||||
private HumanoidCharacterAppearance _appearance;
|
||||
private HumanoidCharacterAppearance _appearance = default!;
|
||||
private Sex _sex;
|
||||
private Gender _gender;
|
||||
|
||||
@@ -55,7 +56,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
return new HumanoidAppearanceComponentState(Appearance, Sex, Gender);
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Content.Shared.Alert;
|
||||
@@ -40,7 +41,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
protected float KnockdownTimer;
|
||||
protected float SlowdownTimer;
|
||||
|
||||
private string _stunAlertId;
|
||||
private string _stunAlertId = string.Empty;
|
||||
|
||||
protected CancellationTokenSource StatusRemoveCancellation = new();
|
||||
|
||||
@@ -182,7 +183,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
SlowdownTimer = seconds;
|
||||
LastStun = _gameTiming.CurTime;
|
||||
|
||||
if (Owner.TryGetComponent(out MovementSpeedModifierComponent movement))
|
||||
if (Owner.TryGetComponent(out MovementSpeedModifierComponent? movement))
|
||||
movement.RefreshMovementSpeedModifiers();
|
||||
|
||||
SetAlert();
|
||||
@@ -191,7 +192,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
|
||||
private void SetAlert()
|
||||
{
|
||||
if (!Owner.TryGetComponent(out SharedAlertsComponent status))
|
||||
if (!Owner.TryGetComponent(out SharedAlertsComponent? status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Mobs.State
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Alert;
|
||||
#nullable enable
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -15,7 +16,7 @@ namespace Content.Shared.GameObjects.Components.Mobs.State
|
||||
{
|
||||
base.EnterState(entity);
|
||||
|
||||
if (entity.TryGetComponent(out SharedAlertsComponent status))
|
||||
if (entity.TryGetComponent(out SharedAlertsComponent? status))
|
||||
{
|
||||
status.ShowAlert(AlertType.HumanCrit); // TODO: combine humancrit-0 and humancrit-1 into a gif and display it
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace Content.Shared.GameObjects.Components.Mobs.State
|
||||
#nullable enable
|
||||
namespace Content.Shared.GameObjects.Components.Mobs.State
|
||||
{
|
||||
public abstract class SharedDeadMobState : BaseMobState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Content.Shared.GameObjects.Components.Mobs.State
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Mobs.State
|
||||
{
|
||||
/// <summary>
|
||||
/// The standard state an entity is in; no negative effects.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user