Change components to use timer component (#2426)

* Change components to use timer component

* Fix old usages of tokens
This commit is contained in:
DrSmugleaf
2020-10-30 05:02:49 +01:00
committed by GitHub
parent c86c378198
commit 37e97ca89f
24 changed files with 59 additions and 35 deletions

View File

@@ -23,6 +23,7 @@ using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.GameObjects.Components.Timers;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Maths;
@@ -249,7 +250,7 @@ namespace Content.Server.GameObjects.Components.Doors
occluder.Enabled = false;
}
Timer.Spawn(OpenTimeOne, async () =>
Owner.SpawnTimer(OpenTimeOne, async () =>
{
if (Owner.TryGetComponent(out AirtightComponent? airtight))
{
@@ -319,7 +320,7 @@ namespace Content.Server.GameObjects.Components.Doors
stun.Paralyze(DoorStunTime);
// If we hit someone, open up after stun (opens right when stun ends)
Timer.Spawn(TimeSpan.FromSeconds(DoorStunTime) - OpenTimeOne - OpenTimeTwo, Open);
Owner.SpawnTimer(TimeSpan.FromSeconds(DoorStunTime) - OpenTimeOne - OpenTimeTwo, Open);
break;
}
}
@@ -402,7 +403,7 @@ namespace Content.Server.GameObjects.Components.Doors
occluder.Enabled = true;
}
Timer.Spawn(CloseTimeOne, async () =>
Owner.SpawnTimer(CloseTimeOne, async () =>
{
if (shouldCheckCrush && _canCrush)
{
@@ -435,7 +436,7 @@ namespace Content.Server.GameObjects.Components.Doors
return;
SetAppearance(DoorVisualState.Deny);
Timer.Spawn(DenyTime, () =>
Owner.SpawnTimer(DenyTime, () =>
{
SetAppearance(DoorVisualState.Closed);
}, _cancellationTokenSource.Token);