Enable nullability in Content.Server (#3685)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user