Chameleon clothing hides identity (#12642)

This commit is contained in:
Alex Evgrashin
2022-11-24 03:02:54 +01:00
committed by GitHub
parent 186b8e00da
commit 1cae861f40
4 changed files with 43 additions and 1 deletions

View File

@@ -1,5 +1,8 @@
using Content.Shared.Clothing.Components;
using Content.Server.IdentityManagement;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.IdentityManagement.Components;
using Content.Shared.Prototypes;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.GameStates;
@@ -11,6 +14,8 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
{
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IdentitySystem _identity = default!;
public override void Initialize()
{
@@ -91,8 +96,20 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
return;
component.SelectedId = protoId;
UpdateIdentityBlocker(uid, component, proto);
UpdateVisuals(uid, component);
UpdateUi(uid, component);
Dirty(component);
}
private void UpdateIdentityBlocker(EntityUid uid, ChameleonClothingComponent component, EntityPrototype proto)
{
if (proto.HasComponent<IdentityBlockerComponent>(_factory))
EnsureComp<IdentityBlockerComponent>(uid);
else
RemComp<IdentityBlockerComponent>(uid);
if (component.User != null)
_identity.QueueIdentityUpdate(component.User.Value);
}
}