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,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using Robust.Shared.GameObjects;
@@ -49,16 +50,16 @@ namespace Content.Shared.GameObjects.Components.Access
public readonly bool IsPrivilegedIdAuthorized;
public readonly bool IsTargetIdPresent;
public readonly string TargetIdName;
public readonly string TargetIdFullName;
public readonly string TargetIdJobTitle;
public readonly string[] TargetIdAccessList;
public readonly string? TargetIdFullName;
public readonly string? TargetIdJobTitle;
public readonly string[]? TargetIdAccessList;
public IdCardConsoleBoundUserInterfaceState(bool isPrivilegedIdPresent,
bool isPrivilegedIdAuthorized,
bool isTargetIdPresent,
string targetIdFullName,
string targetIdJobTitle,
string[] targetIdAccessList, string privilegedIdName, string targetIdName)
string? targetIdFullName,
string? targetIdJobTitle,
string[]? targetIdAccessList, string privilegedIdName, string targetIdName)
{
IsPrivilegedIdPresent = isPrivilegedIdPresent;
IsPrivilegedIdAuthorized = isPrivilegedIdAuthorized;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
@@ -12,9 +13,9 @@ namespace Content.Shared.GameObjects.Components.ActionBlocking
[Serializable, NetSerializable]
protected sealed class HandcuffedComponentState : ComponentState
{
public string IconState { get; }
public string? IconState { get; }
public HandcuffedComponentState(string iconState) : base(ContentNetIDs.HANDCUFFS)
public HandcuffedComponentState(string? iconState) : base(ContentNetIDs.HANDCUFFS)
{
IconState = iconState;
}

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using Content.Shared.Objectives;
using Robust.Shared.GameObjects;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Atmos.GasTank

View File

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

View File

@@ -1,4 +1,5 @@
using Robust.Shared.Serialization;
#nullable enable
using Robust.Shared.Serialization;
using System;
namespace Content.Shared.GameObjects.Components.Atmos

View File

@@ -1,4 +1,4 @@
#nullable enable annotations
#nullable enable
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -1,3 +1,4 @@
#nullable enable
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using System;

View File

@@ -1,3 +1,4 @@
#nullable enable
using System;
using Robust.Shared.Serialization;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Atmos

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Atmos

View File

@@ -1,4 +1,5 @@
using Content.Shared.Chemistry;
#nullable enable
using Content.Shared.Chemistry;
using Robust.Shared.GameObjects;
namespace Content.Shared.GameObjects.Components.Body.Networks

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Body.Part

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Body.Part

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Body.Part

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.GameObjects;
namespace Content.Shared.GameObjects.Components.Body.Part

View File

@@ -1,4 +1,6 @@
namespace Content.Shared.GameObjects.Components.Body.Part
#nullable enable
namespace Content.Shared.GameObjects.Components.Body.Part
{
/// <summary>
/// Defines a component as being capable of containing parts.

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
namespace Content.Shared.GameObjects.Components.Body.Part
{

View File

@@ -1,4 +1,5 @@
using Robust.Shared.GameObjects;
#nullable enable
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Body.Part.Property

View File

@@ -1,4 +1,5 @@
using Robust.Shared.GameObjects;
#nullable enable
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Body.Part.Property

View File

@@ -1,4 +1,5 @@
using Robust.Shared.GameObjects;
#nullable enable
using Robust.Shared.GameObjects;
namespace Content.Shared.GameObjects.Components.Body.Part.Property
{

View File

@@ -1,4 +1,5 @@
using Robust.Shared.GameObjects;
#nullable enable
using Robust.Shared.GameObjects;
namespace Content.Shared.GameObjects.Components.Body.Part.Property
{

View File

@@ -1,4 +1,5 @@
using Robust.Shared.GameObjects;
#nullable enable
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Body.Part.Property

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Body.Part;
using Robust.Shared.Prototypes;
@@ -15,9 +16,9 @@ namespace Content.Shared.GameObjects.Components.Body.Preset
[Serializable, NetSerializable]
public class BodyPresetPrototype : IPrototype
{
private string _id;
private string _name;
private Dictionary<string, string> _partIDs;
private string _id = string.Empty;
private string _name = string.Empty;
private Dictionary<string, string> _partIDs = new();
[ViewVariables] public string ID => _id;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Body.Surgery

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Body.Surgery

View File

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

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Shared.GameObjects.Components.Body.Part;
@@ -16,13 +17,13 @@ namespace Content.Shared.GameObjects.Components.Body.Template
[Serializable, NetSerializable]
public class BodyTemplatePrototype : IPrototype
{
private string _id;
private string _name;
private string _centerSlot;
private Dictionary<string, BodyPartType> _slots;
private Dictionary<string, List<string>> _connections;
private Dictionary<string, string> _layers;
private Dictionary<string, string> _mechanismLayers;
private string _id = string.Empty;
private string _name = string.Empty;
private string _centerSlot = string.Empty;
private Dictionary<string, BodyPartType> _slots = new();
private Dictionary<string, List<string>> _connections = new();
private Dictionary<string, string> _layers = new();
private Dictionary<string, string> _mechanismLayers = new();
[ViewVariables] public string ID => _id;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Botany

View File

@@ -44,7 +44,7 @@ namespace Content.Shared.GameObjects.Components.Buckle
public bool DontCollide { get; set; }
public abstract bool TryBuckle(IEntity user, IEntity to);
public abstract bool TryBuckle(IEntity? user, IEntity to);
bool ICollideSpecial.PreventCollide(IPhysBody collidedwith)
{

View File

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

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using Content.Shared.Prototypes.Cargo;
using Robust.Shared.GameObjects;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using Content.Shared.Prototypes.Cargo;
@@ -35,10 +36,10 @@ namespace Content.Shared.GameObjects.Components.Cargo
/// Returns a product from the string id;
/// </summary>
/// <returns>Product</returns>
public CargoProductPrototype GetProduct(string productId)
public CargoProductPrototype? GetProduct(string productId)
{
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
if (!prototypeManager.TryIndex(productId, out CargoProductPrototype product) || !_products.Contains(product))
if (!prototypeManager.TryIndex(productId, out CargoProductPrototype? product) || !_products.Contains(product))
{
return null;
}
@@ -75,7 +76,7 @@ namespace Content.Shared.GameObjects.Components.Cargo
_products.Clear();
foreach (var id in products)
{
if (!prototypeManager.TryIndex(id, out CargoProductPrototype product))
if (!prototypeManager.TryIndex(id, out CargoProductPrototype? product))
{
continue;
}

View File

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

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
@@ -15,8 +16,8 @@ namespace Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser
[Serializable, NetSerializable, Prototype("reagentDispenserInventory")]
public class ReagentDispenserInventoryPrototype : IPrototype
{
private string _id;
private List<string> _inventory;
private string _id = string.Empty;
private List<string> _inventory = new();
public string ID => _id;
public List<string> Inventory => _inventory;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using Content.Shared.Chemistry;
using Robust.Shared.GameObjects;
@@ -36,12 +37,12 @@ namespace Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser
/// <summary>
/// A list of the reagents and their amounts within the beaker/reagent container, if applicable.
/// </summary>
public readonly List<Solution.ReagentQuantity> ContainerReagents;
public readonly List<Solution.ReagentQuantity>? ContainerReagents;
public readonly string DispenserName;
public readonly ReagentUnit SelectedDispenseAmount;
public ReagentDispenserBoundUserInterfaceState(bool hasPower, bool hasBeaker, ReagentUnit beakerCurrentVolume, ReagentUnit beakerMaxVolume, string containerName,
List<ReagentDispenserInventoryEntry> inventory, string dispenserName, List<Solution.ReagentQuantity> containerReagents, ReagentUnit selectedDispenseAmount)
List<ReagentDispenserInventoryEntry> inventory, string dispenserName, List<Solution.ReagentQuantity>? containerReagents, ReagentUnit selectedDispenseAmount)
{
HasPower = hasPower;
HasBeaker = hasBeaker;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Content.Shared.Chemistry;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Content.Shared.Chemistry;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -1,3 +1,4 @@
#nullable enable
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Conveyor

View File

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

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Content.Shared.GameObjects.Components.Body;
namespace Content.Shared.GameObjects.Components.Damage

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using Content.Shared.Damage;

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
#nullable enable
using System.Collections.Generic;
using Content.Shared.Damage;
using Robust.Shared.GameObjects;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Damage

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
@@ -37,10 +38,10 @@ namespace Content.Shared.GameObjects.Components.Disposal
public readonly bool Engaged;
public readonly string Tag;
public readonly List<string> Tags;
public readonly string Target;
public readonly string? Target;
public DisposalMailingUnitBoundUserInterfaceState(string unitName, string unitState, float pressure, bool powered,
bool engaged, string tag, List<string> tags, string target)
bool engaged, string tag, List<string> tags, string? target)
{
UnitName = unitName;
UnitState = unitState;
@@ -57,7 +58,7 @@ namespace Content.Shared.GameObjects.Components.Disposal
return new DisposalMailingUnitBoundUserInterfaceState(UnitName, UnitState, Pressure, Powered, Engaged, Tag, (List<string>)Tags.Clone(), Target);
}
public bool Equals(DisposalMailingUnitBoundUserInterfaceState other)
public bool Equals(DisposalMailingUnitBoundUserInterfaceState? other)
{
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
@@ -91,9 +92,9 @@ namespace Content.Shared.GameObjects.Components.Disposal
[Serializable, NetSerializable]
public class UiTargetUpdateMessage : BoundUserInterfaceMessage
{
public readonly string Target;
public readonly string? Target;
public UiTargetUpdateMessage(string target)
public UiTargetUpdateMessage(string? target)
{
Target = target;
}

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Text.RegularExpressions;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Disposal

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Doors

View File

@@ -1,3 +1,4 @@
#nullable enable
using System;
using Robust.Shared.Serialization;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components

View File

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

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Items;
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;

View File

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

View File

@@ -1,3 +1,4 @@
#nullable enable
using System;
using Robust.Shared.Audio.Midi;
using Robust.Shared.GameObjects;

View File

@@ -1,3 +1,4 @@
#nullable enable
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

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

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
#nullable enable
using System.Collections.Generic;
using JetBrains.Annotations;
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Items

View File

@@ -1,3 +1,4 @@
#nullable enable
using Robust.Shared.GameObjects;
namespace Content.Shared.GameObjects.Components.Items

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
@@ -61,7 +62,7 @@ namespace Content.Shared.GameObjects.Components.Items
};
}
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
base.HandleComponentState(curState, nextState);

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.MachineLinking

View File

@@ -1,3 +1,4 @@
#nullable enable
using Robust.Shared.GameObjects;
namespace Content.Shared.GameObjects.Components.Markers

View File

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

View File

@@ -1,3 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using Content.Shared.Damage;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
namespace Content.Shared.GameObjects.Components.Mobs

View File

@@ -1,3 +1,4 @@
#nullable enable
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -1,3 +1,4 @@
#nullable enable
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;

View File

@@ -1,5 +1,4 @@
#nullable enable
using Content.Shared.Actions;
using Robust.Shared.GameObjects;
using Robust.Shared.Input.Binding;

View File

@@ -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);

View File

@@ -1,3 +1,4 @@
#nullable enable
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -1,3 +1,4 @@
#nullable enable
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -1,3 +1,4 @@
#nullable enable
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -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

View File

@@ -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;

View File

@@ -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
}

View File

@@ -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
{

View File

@@ -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.

View File

@@ -1,3 +1,4 @@
#nullable enable
using System;
using Robust.Shared.Serialization;

View File

@@ -1,4 +1,5 @@
using Robust.Shared.GameObjects;
#nullable enable
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;

View File

@@ -1,3 +1,4 @@
#nullable enable
using Robust.Shared.Players;
namespace Content.Shared.GameObjects.Components.Movement

View File

@@ -1,4 +1,5 @@
using Robust.Shared.Containers;
#nullable enable
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -58,7 +59,7 @@ namespace Content.Shared.GameObjects.Components.Movement
public static void RefreshItemModifiers(IEntity item)
{
if (item.TryGetContainer(out var container) &&
container.Owner.TryGetComponent(out MovementSpeedModifierComponent mod))
container.Owner.TryGetComponent(out MovementSpeedModifierComponent? mod))
{
mod.RefreshMovementSpeedModifiers();
}

View File

@@ -1,4 +1,5 @@
using Content.Shared.GameObjects.EntitySystems;
#nullable enable
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
using Content.Shared.Physics;
using Robust.Shared.GameObjects;
@@ -12,14 +13,14 @@ namespace Content.Shared.GameObjects.Components.Movement
public sealed override string Name => "Climbing";
public sealed override uint? NetID => ContentNetIDs.CLIMBING;
protected IPhysicsComponent Body;
protected bool IsOnClimbableThisFrame = false;
protected IPhysicsComponent? Body;
protected bool IsOnClimbableThisFrame;
protected bool OwnerIsTransitioning
{
get
{
if (Body.TryGetController<ClimbController>(out var controller))
if (Body != null && Body.TryGetController<ClimbController>(out var controller))
{
return controller.IsActive;
}

View File

@@ -1,3 +1,4 @@
#nullable enable
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Shared.GameObjects.Components.Mobs;
@@ -57,9 +58,9 @@ namespace Content.Shared.GameObjects.Components.Movement
if (!Slippery
|| Owner.IsInContainer()
|| _slipped.Contains(entity.Uid)
|| !entity.TryGetComponent(out SharedStunnableComponent stun)
|| !entity.TryGetComponent(out IPhysicsComponent otherBody)
|| !Owner.TryGetComponent(out IPhysicsComponent body))
|| !entity.TryGetComponent(out SharedStunnableComponent? stun)
|| !entity.TryGetComponent(out IPhysicsComponent? otherBody)
|| !Owner.TryGetComponent(out IPhysicsComponent? body))
{
return false;
}
@@ -81,7 +82,7 @@ namespace Content.Shared.GameObjects.Components.Movement
return false;
}
if (entity.TryGetComponent(out IPhysicsComponent physics))
if (entity.TryGetComponent(out IPhysicsComponent? physics))
{
var controller = physics.EnsureController<SlipController>();
controller.LinearVelocity = physics.LinearVelocity * LaunchForwardsMultiplier;

View File

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

Some files were not shown because too many files have changed in this diff Show More