Enable nullability in Content.Server (#3685)

This commit is contained in:
DrSmugleaf
2021-03-16 15:50:20 +01:00
committed by GitHub
parent 90fec0ed24
commit a5ade526b7
306 changed files with 1616 additions and 1441 deletions

View File

@@ -3,10 +3,8 @@ using System.Threading;
using Content.Shared.GameObjects.Components.Items;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Timing;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Timing
@@ -31,7 +29,7 @@ namespace Content.Server.GameObjects.Components.Timing
public bool ActiveDelay{ get; private set; }
private CancellationTokenSource cancellationTokenSource;
private CancellationTokenSource? cancellationTokenSource;
public void BeginDelay()
{
@@ -48,7 +46,7 @@ namespace Content.Server.GameObjects.Components.Timing
_lastUseTime = IoCManager.Resolve<IGameTiming>().CurTime;
if (Owner.TryGetComponent(out ItemCooldownComponent cooldown))
if (Owner.TryGetComponent(out ItemCooldownComponent? cooldown))
{
cooldown.CooldownStart = _lastUseTime;
cooldown.CooldownEnd = _lastUseTime + TimeSpan.FromSeconds(Delay);
@@ -58,10 +56,10 @@ namespace Content.Server.GameObjects.Components.Timing
public void Cancel()
{
cancellationTokenSource.Cancel();
cancellationTokenSource?.Cancel();
ActiveDelay = false;
if (Owner.TryGetComponent(out ItemCooldownComponent cooldown))
if (Owner.TryGetComponent(out ItemCooldownComponent? cooldown))
{
cooldown.CooldownEnd = IoCManager.Resolve<IGameTiming>().CurTime;
}
@@ -69,7 +67,7 @@ namespace Content.Server.GameObjects.Components.Timing
public void Restart()
{
cancellationTokenSource.Cancel();
cancellationTokenSource?.Cancel();
ActiveDelay = false;
BeginDelay();
}