Removes all dependencies on engine component events. (#4199)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.GameTicking;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Suspicion.EntitySystems
|
||||
@@ -12,6 +13,28 @@ namespace Content.Server.Suspicion.EntitySystems
|
||||
|
||||
public IReadOnlyCollection<SuspicionRoleComponent> Traitors => _traitors;
|
||||
|
||||
#region Overrides of EntitySystem
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SuspicionRoleComponent, PlayerAttachedEvent>((HandlePlayerAttached));
|
||||
SubscribeLocalEvent<SuspicionRoleComponent, PlayerDetachedEvent>((HandlePlayerDetached));
|
||||
}
|
||||
|
||||
private void HandlePlayerDetached(EntityUid uid, SuspicionRoleComponent component, PlayerDetachedEvent args)
|
||||
{
|
||||
component.SyncRoles();
|
||||
}
|
||||
|
||||
private void HandlePlayerAttached(EntityUid uid, SuspicionRoleComponent component, PlayerAttachedEvent args)
|
||||
{
|
||||
component.SyncRoles();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void AddTraitor(SuspicionRoleComponent role)
|
||||
{
|
||||
if (!_traitors.Add(role))
|
||||
|
||||
Reference in New Issue
Block a user