Automatically unsubscribe event bus registrations in entity system shutdown. (#1758)

* Automatically unsubscribe event bus registrations in entity system shutdown.

* Fix incorrect unsubscription of local events, obsolete unsubscribe methods.

That's what we got tests for.

* = null instead of .Clear()
This commit is contained in:
Pieter-Jan Briers
2021-05-17 11:01:22 +02:00
committed by GitHub
parent c26ebcbc78
commit 96c0a4ae1f
16 changed files with 140 additions and 145 deletions
@@ -22,14 +22,6 @@ namespace Robust.Client.GameObjects
}
}
public override void Shutdown()
{
base.Shutdown();
UnsubscribeNetworkEvent<BoundUIWrapMessage>();
UnsubscribeLocalEvent<ClientUserInterfaceComponent, ComponentShutdown>();
}
private void MessageReceived(BoundUIWrapMessage ev)
{
var cmp = ComponentManager.GetComponent<ClientUserInterfaceComponent>(ev.Entity);