Add IResettingEntitySystem for entity systems that do resetting cleanup (#2257)

* Add IResettingEntitySystem for entity systems that do resetting cleanup

* You got a license for that submodule update?
This commit is contained in:
DrSmugleaf
2020-10-14 22:45:53 +02:00
committed by GitHub
parent 6be80c119b
commit 50bc61b672
17 changed files with 76 additions and 54 deletions

View File

@@ -4,6 +4,7 @@ using System.Text;
using Content.Server.GameTicking;
using Content.Server.Interfaces.GameTicking;
using Content.Server.StationEvents;
using Content.Shared.GameTicking;
using JetBrains.Annotations;
using Robust.Server.Console;
using Robust.Server.Interfaces.Player;
@@ -20,7 +21,7 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
{
[UsedImplicitly]
// Somewhat based off of TG's implementation of events
public sealed class StationEventSystem : EntitySystem
public sealed class StationEventSystem : EntitySystem, IResettingEntitySystem
{
[Dependency] private readonly IServerNetManager _netManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
@@ -339,7 +340,13 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
return true;
}
public void ResettingCleanup()
public override void Shutdown()
{
base.Shutdown();
CurrentEvent?.Shutdown();
}
public void Reset()
{
if (CurrentEvent != null && CurrentEvent.Running)
{
@@ -354,11 +361,5 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
_timeUntilNextEvent = MinimumTimeUntilFirstEvent;
}
public override void Shutdown()
{
base.Shutdown();
CurrentEvent?.Shutdown();
}
}
}