StatusEffects ignore components that are not there anymore, when removing effects

This commit is contained in:
Vera Aguilera Puerto
2021-10-16 00:52:35 +02:00
parent a4c5d96b5e
commit 6f63e5a888

View File

@@ -216,6 +216,12 @@ namespace Content.Shared.StatusEffect
if (state.RelevantComponent != null)
{
var type = _componentFactory.GetRegistration(state.RelevantComponent).Type;
// Make sure the component is actually there first.
// Maybe a badmin badminned the component away,
// or perhaps, on the client, the component deletion sync
// was faster than prediction could predict. Either way, let's not assume the component exists.
if(EntityManager.HasComponent(uid, type))
EntityManager.RemoveComponent(uid, type);
}