Change components to use timer component (#2426)
* Change components to use timer component * Fix old usages of tokens
This commit is contained in:
@@ -7,6 +7,7 @@ using Content.Shared.Physics;
|
|||||||
using Robust.Client.Audio.Midi;
|
using Robust.Client.Audio.Midi;
|
||||||
using Robust.Shared.Audio.Midi;
|
using Robust.Shared.Audio.Midi;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.Interfaces.Network;
|
using Robust.Shared.Interfaces.Network;
|
||||||
using Robust.Shared.Interfaces.Timing;
|
using Robust.Shared.Interfaces.Timing;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -173,7 +174,7 @@ namespace Content.Client.GameObjects.Components.Instruments
|
|||||||
var renderer = _renderer;
|
var renderer = _renderer;
|
||||||
|
|
||||||
// We dispose of the synth two seconds from now to allow the last notes to stop from playing.
|
// We dispose of the synth two seconds from now to allow the last notes to stop from playing.
|
||||||
Timer.Spawn(2000, () => { renderer?.Dispose(); });
|
Owner.SpawnTimer(2000, () => { renderer?.Dispose(); });
|
||||||
_renderer = null;
|
_renderer = null;
|
||||||
_midiEventBuffer.Clear();
|
_midiEventBuffer.Clear();
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.GameObjects.Components.Sound;
|
|||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Robust.Client.GameObjects.EntitySystems;
|
using Robust.Client.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.Network;
|
using Robust.Shared.Interfaces.Network;
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
@@ -53,7 +54,7 @@ namespace Content.Client.GameObjects.Components.Sound
|
|||||||
{
|
{
|
||||||
if (!schedule.Play) return;
|
if (!schedule.Play) return;
|
||||||
|
|
||||||
Timer.Spawn((int) schedule.Delay + (_random.Next((int) schedule.RandomDelay)),() =>
|
Owner.SpawnTimer((int) schedule.Delay + (_random.Next((int) schedule.RandomDelay)),() =>
|
||||||
{
|
{
|
||||||
if (!schedule.Play) return; // We make sure this hasn't changed.
|
if (!schedule.Play) return; // We make sure this hasn't changed.
|
||||||
if (_audioSystem == null) _audioSystem = EntitySystem.Get<AudioSystem>();
|
if (_audioSystem == null) _audioSystem = EntitySystem.Get<AudioSystem>();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Robust.Client.Interfaces.Graphics;
|
|||||||
using Robust.Client.Interfaces.Graphics.Overlays;
|
using Robust.Client.Interfaces.Graphics.Overlays;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.Interfaces.Timing;
|
using Robust.Shared.Interfaces.Timing;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -83,7 +84,7 @@ namespace Content.Client.GameObjects.Components.Weapons
|
|||||||
}
|
}
|
||||||
|
|
||||||
_cancelToken = new CancellationTokenSource();
|
_cancelToken = new CancellationTokenSource();
|
||||||
Timer.Spawn((int) duration * 1000, DisableOverlay, _cancelToken.Token);
|
Owner.SpawnTimer((int) duration * 1000, DisableOverlay, _cancelToken.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisableOverlay()
|
private void DisableOverlay()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Interfaces.GameObjects.Components;
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.EntitySystemMessages;
|
using Robust.Shared.GameObjects.EntitySystemMessages;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.Timing;
|
using Robust.Shared.Interfaces.Timing;
|
||||||
@@ -95,7 +96,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
var newColor = Color.Red * originalColor;
|
var newColor = Color.Red * originalColor;
|
||||||
sprite.Color = newColor;
|
sprite.Color = newColor;
|
||||||
|
|
||||||
Timer.Spawn(100, () =>
|
hitEntity.SpawnTimer(100, () =>
|
||||||
{
|
{
|
||||||
// Only reset back to the original color if something else didn't change the color in the mean time.
|
// Only reset back to the original color if something else didn't change the color in the mean time.
|
||||||
if (sprite.Color == newColor)
|
if (sprite.Color == newColor)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using Content.Shared.Interfaces.GameObjects.Components;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -205,7 +206,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
Owner.PopupMessage(Loc.GetString("You stop, drop, and roll!"));
|
Owner.PopupMessage(Loc.GetString("You stop, drop, and roll!"));
|
||||||
stunnable.Paralyze(2f);
|
stunnable.Paralyze(2f);
|
||||||
|
|
||||||
Timer.Spawn(2000, () =>
|
Owner.SpawnTimer(2000, () =>
|
||||||
{
|
{
|
||||||
_resisting = false;
|
_resisting = false;
|
||||||
FireStacks -= 2f;
|
FireStacks -= 2f;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Components.Transform;
|
using Robust.Shared.GameObjects.Components.Transform;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
@@ -139,7 +140,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out IPhysicsComponent? physics) ||
|
if (!entity.TryGetComponent(out IPhysicsComponent? physics) ||
|
||||||
!physics.CanCollide)
|
!physics.CanCollide)
|
||||||
{
|
{
|
||||||
if (!(entity.TryGetComponent(out IDamageableComponent? damageState) && damageState.CurrentState == DamageState.Dead)) {
|
if (!(entity.TryGetComponent(out IDamageableComponent? damageState) && damageState.CurrentState == DamageState.Dead)) {
|
||||||
@@ -165,7 +166,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
|
|
||||||
_automaticEngageToken = new CancellationTokenSource();
|
_automaticEngageToken = new CancellationTokenSource();
|
||||||
|
|
||||||
Timer.Spawn(_automaticEngageTime, () =>
|
Owner.SpawnTimer(_automaticEngageTime, () =>
|
||||||
{
|
{
|
||||||
if (!TryFlush())
|
if (!TryFlush())
|
||||||
{
|
{
|
||||||
@@ -260,7 +261,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
|
|
||||||
if (Engaged && CanFlush())
|
if (Engaged && CanFlush())
|
||||||
{
|
{
|
||||||
Timer.Spawn(_flushDelay, () => TryFlush());
|
Owner.SpawnTimer(_flushDelay, () => TryFlush());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -310,7 +311,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
PowerWiresPulsed = true;
|
PowerWiresPulsed = true;
|
||||||
_powerWiresPulsedTimerCancel.Cancel();
|
_powerWiresPulsedTimerCancel.Cancel();
|
||||||
_powerWiresPulsedTimerCancel = new CancellationTokenSource();
|
_powerWiresPulsedTimerCancel = new CancellationTokenSource();
|
||||||
Timer.Spawn(PowerWiresTimeout,
|
Owner.SpawnTimer(PowerWiresTimeout,
|
||||||
() => PowerWiresPulsed = false,
|
() => PowerWiresPulsed = false,
|
||||||
_powerWiresPulsedTimerCancel.Token);
|
_powerWiresPulsedTimerCancel.Token);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ using Robust.Server.GameObjects.EntitySystems;
|
|||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -249,7 +250,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
occluder.Enabled = false;
|
occluder.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer.Spawn(OpenTimeOne, async () =>
|
Owner.SpawnTimer(OpenTimeOne, async () =>
|
||||||
{
|
{
|
||||||
if (Owner.TryGetComponent(out AirtightComponent? airtight))
|
if (Owner.TryGetComponent(out AirtightComponent? airtight))
|
||||||
{
|
{
|
||||||
@@ -319,7 +320,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
stun.Paralyze(DoorStunTime);
|
stun.Paralyze(DoorStunTime);
|
||||||
|
|
||||||
// If we hit someone, open up after stun (opens right when stun ends)
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -402,7 +403,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
occluder.Enabled = true;
|
occluder.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer.Spawn(CloseTimeOne, async () =>
|
Owner.SpawnTimer(CloseTimeOne, async () =>
|
||||||
{
|
{
|
||||||
if (shouldCheckCrush && _canCrush)
|
if (shouldCheckCrush && _canCrush)
|
||||||
{
|
{
|
||||||
@@ -435,7 +436,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SetAppearance(DoorVisualState.Deny);
|
SetAppearance(DoorVisualState.Deny);
|
||||||
Timer.Spawn(DenyTime, () =>
|
Owner.SpawnTimer(DenyTime, () =>
|
||||||
{
|
{
|
||||||
SetAppearance(DoorVisualState.Closed);
|
SetAppearance(DoorVisualState.Closed);
|
||||||
}, _cancellationTokenSource.Token);
|
}, _cancellationTokenSource.Token);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Robust.Server.GameObjects.EntitySystems;
|
|||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Components.Transform;
|
using Robust.Shared.GameObjects.Components.Transform;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
@@ -254,7 +255,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
_evaporationToken = new CancellationTokenSource();
|
_evaporationToken = new CancellationTokenSource();
|
||||||
|
|
||||||
// KYS to evaporate
|
// KYS to evaporate
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(_evaporateTime), Evaporate, _evaporationToken.Token);
|
Owner.SpawnTimer(TimeSpan.FromSeconds(_evaporateTime), Evaporate, _evaporationToken.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSlip()
|
private void UpdateSlip()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using Robust.Server.GameObjects.Components.Container;
|
using Robust.Server.GameObjects.Components.Container;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Timers;
|
using Robust.Shared.Timers;
|
||||||
@@ -67,7 +68,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case ContainerContentsModifiedMessage contentsModified:
|
case ContainerContentsModifiedMessage contentsModified:
|
||||||
Timer.Spawn(0, DropIdAndPocketsIfWeNoLongerHaveAUniform);
|
Owner.SpawnTimer(0, DropIdAndPocketsIfWeNoLongerHaveAUniform);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ using Robust.Server.GameObjects.EntitySystems;
|
|||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -312,7 +313,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
(_currentCookTimerTime == (uint)recipeToCook.CookTime);
|
(_currentCookTimerTime == (uint)recipeToCook.CookTime);
|
||||||
SetAppearance(MicrowaveVisualState.Cooking);
|
SetAppearance(MicrowaveVisualState.Cooking);
|
||||||
_audioSystem.PlayFromEntity(_startCookingSound, Owner, AudioParams.Default);
|
_audioSystem.PlayFromEntity(_startCookingSound, Owner, AudioParams.Default);
|
||||||
Timer.Spawn((int)(_currentCookTimerTime * _cookTimeMultiplier), (Action)(() =>
|
Owner.SpawnTimer((int)(_currentCookTimerTime * _cookTimeMultiplier), (Action)(() =>
|
||||||
{
|
{
|
||||||
if (_lostPower)
|
if (_lostPower)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -67,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
{
|
{
|
||||||
TokenSource?.Cancel();
|
TokenSource?.Cancel();
|
||||||
TokenSource = new CancellationTokenSource();
|
TokenSource = new CancellationTokenSource();
|
||||||
Timer.SpawnRepeating(TimeSpan.FromSeconds(IntervalSeconds), OnTimerFired, TokenSource.Token);
|
Owner.SpawnRepeatingTimer(TimeSpan.FromSeconds(IntervalSeconds), OnTimerFired, TokenSource.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTimerFired()
|
private void OnTimerFired()
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.GameObjects.Components.Damage;
|
|||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Robust.Server.GameObjects.Components.UserInterface;
|
using Robust.Server.GameObjects.Components.UserInterface;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -135,7 +136,7 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var spawnPosition = Owner.Transform.Coordinates;
|
var spawnPosition = Owner.Transform.Coordinates;
|
||||||
Timer.Spawn(0, () =>
|
Owner.SpawnTimer(0, () =>
|
||||||
{
|
{
|
||||||
// Async this so that we don't throw if the grid we're on is being deleted.
|
// Async this so that we don't throw if the grid we're on is being deleted.
|
||||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.GameObjects.Components.Movement;
|
|||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using NFluidsynth;
|
using NFluidsynth;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.Timing;
|
using Robust.Shared.Interfaces.Timing;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -101,7 +102,7 @@ namespace Content.Server.GameObjects.Components.Mobs
|
|||||||
|
|
||||||
if (progress >= length)
|
if (progress >= length)
|
||||||
{
|
{
|
||||||
Timer.Spawn(250, () => status.RemoveStatusEffect(StatusEffect.Stun), StatusRemoveCancellation.Token);
|
Owner.SpawnTimer(250, () => status.RemoveStatusEffect(StatusEffect.Stun), StatusRemoveCancellation.Token);
|
||||||
LastStun = null;
|
LastStun = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -58,7 +59,7 @@ namespace Content.Server.GameObjects.Components.Portal
|
|||||||
|
|
||||||
if (_aliveTime > 0)
|
if (_aliveTime > 0)
|
||||||
{
|
{
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(_aliveTime), () => Owner.Delete());
|
Owner.SpawnTimer(TimeSpan.FromSeconds(_aliveTime), () => Owner.Delete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +139,7 @@ namespace Content.Server.GameObjects.Components.Portal
|
|||||||
|
|
||||||
otherPortal.TryChangeState(PortalState.RecentlyTeleported);
|
otherPortal.TryChangeState(PortalState.RecentlyTeleported);
|
||||||
|
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(_overallPortalCooldown), () =>
|
Owner.SpawnTimer(TimeSpan.FromSeconds(_overallPortalCooldown), () =>
|
||||||
{
|
{
|
||||||
_onCooldown = false;
|
_onCooldown = false;
|
||||||
TryChangeState(PortalState.Pending);
|
TryChangeState(PortalState.Pending);
|
||||||
@@ -168,7 +169,7 @@ namespace Content.Server.GameObjects.Components.Portal
|
|||||||
// To stop spam teleporting. Could potentially look at adding a timer to flush this from the portal
|
// To stop spam teleporting. Could potentially look at adding a timer to flush this from the portal
|
||||||
ImmuneEntities.Add(entity);
|
ImmuneEntities.Add(entity);
|
||||||
_connectingTeleporter.GetComponent<PortalComponent>().ImmuneEntities.Add(entity);
|
_connectingTeleporter.GetComponent<PortalComponent>().ImmuneEntities.Add(entity);
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(_individualPortalCooldown), () => ReleaseCooldown(entity));
|
Owner.SpawnTimer(TimeSpan.FromSeconds(_individualPortalCooldown), () => ReleaseCooldown(entity));
|
||||||
StartCooldown();
|
StartCooldown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Robust.Server.GameObjects.EntitySystems;
|
|||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
@@ -125,14 +126,14 @@ namespace Content.Server.GameObjects.Components.Portal
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(_chargeTime), () => Teleport(user, mapCoords.Position));
|
Owner.SpawnTimer(TimeSpan.FromSeconds(_chargeTime), () => Teleport(user, mapCoords.Position));
|
||||||
StartCooldown();
|
StartCooldown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartCooldown()
|
public void StartCooldown()
|
||||||
{
|
{
|
||||||
SetState(ItemTeleporterState.Cooldown);
|
SetState(ItemTeleporterState.Cooldown);
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(_chargeTime + _cooldown), () => SetState(ItemTeleporterState.Off));
|
Owner.SpawnTimer(TimeSpan.FromSeconds(_chargeTime + _cooldown), () => SetState(ItemTeleporterState.Off));
|
||||||
if (_cooldownSound != null)
|
if (_cooldownSound != null)
|
||||||
{
|
{
|
||||||
var soundPlayer = EntitySystem.Get<AudioSystem>();
|
var soundPlayer = EntitySystem.Get<AudioSystem>();
|
||||||
@@ -212,7 +213,7 @@ namespace Content.Server.GameObjects.Components.Portal
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Seemed easier to just start the cd timer at the same time
|
// Seemed easier to just start the cd timer at the same time
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(_chargeTime), () => Teleport(user, targetVector));
|
Owner.SpawnTimer(TimeSpan.FromSeconds(_chargeTime), () => Teleport(user, targetVector));
|
||||||
StartCooldown();
|
StartCooldown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Damage;
|
|||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.EntitySystemMessages;
|
using Robust.Shared.GameObjects.EntitySystemMessages;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
@@ -94,7 +95,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(_soundHitWall, user.Transform.Coordinates.Offset(offset));
|
EntitySystem.Get<AudioSystem>().PlayAtCoords(_soundHitWall, user.Transform.Coordinates.Offset(offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer.Spawn((int) _deathTime.TotalMilliseconds, () =>
|
Owner.SpawnTimer((int) _deathTime.TotalMilliseconds, () =>
|
||||||
{
|
{
|
||||||
if (!Owner.Deleted)
|
if (!Owner.Deleted)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.GameObjects.Components.Damage;
|
|||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Physics;
|
using Robust.Shared.Interfaces.Physics;
|
||||||
@@ -102,7 +103,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
|
|
||||||
private void StartStopTimer()
|
private void StartStopTimer()
|
||||||
{
|
{
|
||||||
Timer.Spawn((int) (DefaultThrowTime * 1000), MaybeStopThrow);
|
Owner.SpawnTimer((int) (DefaultThrowTime * 1000), MaybeStopThrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MaybeStopThrow()
|
private void MaybeStopThrow()
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using Robust.Server.GameObjects.Components.UserInterface;
|
|||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Server.Interfaces.Player;
|
using Robust.Server.Interfaces.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.Timers;
|
using Robust.Shared.Timers;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
@@ -124,7 +125,7 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
State = LatheState.Producing;
|
State = LatheState.Producing;
|
||||||
SetAppearance(LatheVisualState.Producing);
|
SetAppearance(LatheVisualState.Producing);
|
||||||
|
|
||||||
Timer.Spawn(recipe.CompleteTime, () =>
|
Owner.SpawnTimer(recipe.CompleteTime, () =>
|
||||||
{
|
{
|
||||||
Producing = false;
|
Producing = false;
|
||||||
_producingRecipe = null;
|
_producingRecipe = null;
|
||||||
@@ -195,7 +196,7 @@ namespace Content.Server.GameObjects.Components.Research
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer.Spawn(InsertionTime, () =>
|
Owner.SpawnTimer(InsertionTime, () =>
|
||||||
{
|
{
|
||||||
State = LatheState.Base;
|
State = LatheState.Base;
|
||||||
SetAppearance(LatheVisualState.Idle);
|
SetAppearance(LatheVisualState.Idle);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.GameObjects.EntitySystems;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -117,7 +118,7 @@ namespace Content.Server.GameObjects.Components.Stack
|
|||||||
|
|
||||||
if (stack.AvailableSpace == 0)
|
if (stack.AvailableSpace == 0)
|
||||||
{
|
{
|
||||||
Timer.Spawn(300, () => popupPos.PopupMessage(eventArgs.User, "Stack is now full."));
|
Owner.SpawnTimer(300, () => popupPos.PopupMessage(eventArgs.User, "Stack is now full."));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Content.Shared.GameObjects.Components.Items;
|
using Content.Shared.GameObjects.Components.Items;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.Interfaces.Timing;
|
using Robust.Shared.Interfaces.Timing;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -46,7 +47,7 @@ namespace Content.Server.GameObjects.Components.Timing
|
|||||||
|
|
||||||
cancellationTokenSource = new CancellationTokenSource();
|
cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(Delay), () => ActiveDelay = false, cancellationTokenSource.Token);
|
Owner.SpawnTimer(TimeSpan.FromSeconds(Delay), () => ActiveDelay = false, cancellationTokenSource.Token);
|
||||||
|
|
||||||
_lastUseTime = IoCManager.Resolve<IGameTiming>().CurTime;
|
_lastUseTime = IoCManager.Resolve<IGameTiming>().CurTime;
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Robust.Server.GameObjects.EntitySystems;
|
|||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -184,7 +185,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines
|
|||||||
UserInterface?.SendMessage(new VendingMachineInventoryMessage(Inventory));
|
UserInterface?.SendMessage(new VendingMachineInventoryMessage(Inventory));
|
||||||
TrySetVisualState(VendingMachineVisualState.Eject);
|
TrySetVisualState(VendingMachineVisualState.Eject);
|
||||||
|
|
||||||
Timer.Spawn(_animationDuration, () =>
|
Owner.SpawnTimer(_animationDuration, () =>
|
||||||
{
|
{
|
||||||
_ejecting = false;
|
_ejecting = false;
|
||||||
TrySetVisualState(VendingMachineVisualState.Normal);
|
TrySetVisualState(VendingMachineVisualState.Normal);
|
||||||
@@ -198,7 +199,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines
|
|||||||
{
|
{
|
||||||
TrySetVisualState(VendingMachineVisualState.Deny);
|
TrySetVisualState(VendingMachineVisualState.Deny);
|
||||||
//TODO: This duration should be a distinct value specific to the deny animation
|
//TODO: This duration should be a distinct value specific to the deny animation
|
||||||
Timer.Spawn(_animationDuration, () =>
|
Owner.SpawnTimer(_animationDuration, () =>
|
||||||
{
|
{
|
||||||
TrySetVisualState(VendingMachineVisualState.Normal);
|
TrySetVisualState(VendingMachineVisualState.Normal);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -107,7 +108,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
|||||||
int animLayer = sprite.AddLayerWithState("flashing");
|
int animLayer = sprite.AddLayerWithState("flashing");
|
||||||
_flashing = true;
|
_flashing = true;
|
||||||
|
|
||||||
Timer.Spawn(400, () =>
|
Owner.SpawnTimer(400, () =>
|
||||||
{
|
{
|
||||||
sprite.RemoveLayer(animLayer);
|
sprite.RemoveLayer(animLayer);
|
||||||
_flashing = false;
|
_flashing = false;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.GameObjects.Components.Movement;
|
|||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components.Timers;
|
||||||
using Robust.Shared.Interfaces.Timing;
|
using Robust.Shared.Interfaces.Timing;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -225,7 +226,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
|||||||
}
|
}
|
||||||
|
|
||||||
_canHelp = false;
|
_canHelp = false;
|
||||||
Timer.Spawn((int) _helpInterval * 1000, () => _canHelp = true);
|
Owner.SpawnTimer((int) _helpInterval * 1000, () => _canHelp = true);
|
||||||
|
|
||||||
KnockdownTimer -= _helpKnockdownRemove;
|
KnockdownTimer -= _helpKnockdownRemove;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user