Remove the last comp shutdown methods (#13582)

This commit is contained in:
metalgearsloth
2023-01-19 11:56:25 +11:00
committed by GitHub
parent 7e2b1d79b8
commit 3ca1c17290
4 changed files with 20 additions and 13 deletions

View File

@@ -31,7 +31,7 @@ namespace Content.Server.Spawners.Components
[DataField("MaximumEntitiesSpawned")]
public int MaximumEntitiesSpawned { get; set; } = 1;
private CancellationTokenSource? TokenSource;
public CancellationTokenSource? TokenSource;
void ISerializationHooks.AfterDeserialization()
{
@@ -45,12 +45,6 @@ namespace Content.Server.Spawners.Components
SetupTimer();
}
protected override void Shutdown()
{
base.Shutdown();
TokenSource?.Cancel();
}
private void SetupTimer()
{
TokenSource?.Cancel();

View File

@@ -1,9 +1,21 @@
using Content.Server.Spawners.Components;
using Content.Shared.Spawners.EntitySystems;
namespace Content.Server.Spawners.EntitySystems;
public sealed class TimedDespawnSystem : SharedTimedDespawnSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<TimedSpawnerComponent, ComponentShutdown>(OnTimedSpawnerShutdown);
}
private void OnTimedSpawnerShutdown(EntityUid uid, TimedSpawnerComponent component, ComponentShutdown args)
{
component.TokenSource?.Cancel();
}
protected override bool CanDelete(EntityUid uid)
{
return true;

View File

@@ -18,12 +18,6 @@
[DataField("needsHands")]
public bool NeedsHands = true;
protected override void Shutdown()
{
EntitySystem.Get<SharedPullingStateManagementSystem>().ForceDisconnectPuller(this);
base.Shutdown();
}
protected override void OnRemove()
{
if (Pulling != default)

View File

@@ -12,6 +12,7 @@ namespace Content.Shared.Pulling.Systems
[UsedImplicitly]
public sealed class SharedPullerSystem : EntitySystem
{
[Dependency] private readonly SharedPullingStateManagementSystem _why = default!;
[Dependency] private readonly SharedPullingSystem _pullSystem = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
@@ -25,6 +26,12 @@ namespace Content.Shared.Pulling.Systems
SubscribeLocalEvent<SharedPullerComponent, PullStoppedMessage>(PullerHandlePullStopped);
SubscribeLocalEvent<SharedPullerComponent, VirtualItemDeletedEvent>(OnVirtualItemDeleted);
SubscribeLocalEvent<SharedPullerComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
SubscribeLocalEvent<SharedPullerComponent, ComponentShutdown>(OnPullerShutdown);
}
private void OnPullerShutdown(EntityUid uid, SharedPullerComponent component, ComponentShutdown args)
{
_why.ForceDisconnectPuller(component);
}
private void OnVirtualItemDeleted(EntityUid uid, SharedPullerComponent component, VirtualItemDeletedEvent args)