Removes all dependencies on engine component events. (#4199)

This commit is contained in:
Acruid
2021-06-18 01:49:18 -07:00
committed by GitHub
parent 9fea68707c
commit e1e54e9cb1
27 changed files with 235 additions and 184 deletions

View File

@@ -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))