From a0c531d08b5b8d1b6b9ade585218e3c0700c2873 Mon Sep 17 00:00:00 2001 From: Kara Date: Wed, 13 Jul 2022 22:23:55 -0700 Subject: [PATCH] Identity fixes (#9701) --- Content.Server/Chat/Systems/ChatSystem.cs | 6 ++++-- Content.Server/Clothing/MaskSystem.cs | 17 ++++++++++++++--- .../Components/IdentityBlockerComponent.cs | 1 + .../IdentityManagement/SharedIdentitySystem.cs | 3 ++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 3de90663e1..f38e3ff7ab 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -14,6 +14,7 @@ using Content.Shared.ActionBlocker; using Content.Shared.CCVar; using Content.Shared.Chat; using Content.Shared.Database; +using Content.Shared.IdentityManagement; using Content.Shared.Inventory; using Robust.Server.Player; using Robust.Shared.Audio; @@ -301,8 +302,9 @@ public sealed partial class ChatSystem : SharedChatSystem { if (!_actionBlocker.CanEmote(source)) return; + // Emotes use Identity.Name, since it doesn't actually involve your voice at all. var messageWrap = Loc.GetString("chat-manager-entity-me-wrap-message", - ("entityName", Name(source))); + ("entityName", Identity.Name(source, EntityManager))); SendInVoiceRange(ChatChannel.Emotes, action, messageWrap, source, hideChat); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Emote from {ToPrettyString(source):user}: {action}"); @@ -317,7 +319,7 @@ public sealed partial class ChatSystem : SharedChatSystem } else if (!_loocEnabled) return; var messageWrap = Loc.GetString("chat-manager-entity-looc-wrap-message", - ("entityName", Name(source))); + ("entityName", Identity.Name(source, EntityManager))); SendInVoiceRange(ChatChannel.LOOC, message, messageWrap, source, hideChat); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"LOOC from {player:Player}: {message}"); diff --git a/Content.Server/Clothing/MaskSystem.cs b/Content.Server/Clothing/MaskSystem.cs index 9b3d3a876b..202d905e50 100644 --- a/Content.Server/Clothing/MaskSystem.cs +++ b/Content.Server/Clothing/MaskSystem.cs @@ -8,8 +8,10 @@ using Content.Server.Atmos.Components; using Content.Server.Body.Components; using Content.Server.Clothing.Components; using Content.Server.Disease.Components; +using Content.Server.IdentityManagement; using Content.Server.Nutrition.EntitySystems; using Content.Server.Popups; +using Content.Shared.IdentityManagement.Components; using Robust.Shared.Player; namespace Content.Server.Clothing @@ -19,6 +21,8 @@ namespace Content.Server.Clothing [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly ActionsSystem _actionSystem = default!; + [Dependency] private readonly IdentitySystem _identity = default!; + public override void Initialize() { base.Initialize(); @@ -45,6 +49,9 @@ namespace Content.Server.Clothing mask.IsToggled ^= true; _actionSystem.SetToggled(mask.ToggleAction, mask.IsToggled); + // Pulling mask down can change identity, so we want to update that + _identity.QueueIdentityUpdate(args.Performer); + if (mask.IsToggled) _popupSystem.PopupEntity(Loc.GetString("action-mask-pull-down-popup-message", ("mask", mask.Owner)), args.Performer, Filter.Entities(args.Performer)); else @@ -75,15 +82,19 @@ namespace Content.Server.Clothing Dirty(item); } - //toggle ingestion blocking + // toggle ingestion blocking if (TryComp(uid, out var blocker)) blocker.Enabled = !mask.IsToggled; - //toggle disease protection + // toggle disease protection if (TryComp(uid, out var diseaseProtection)) diseaseProtection.IsActive = !mask.IsToggled; - //toggle breath tool connection (skip during equip since that is handled in LungSystem) + // toggle identity + if (TryComp(uid, out var identity)) + identity.Enabled = !mask.IsToggled; + + // toggle breath tool connection (skip during equip since that is handled in LungSystem) if (isEquip || !TryComp(uid, out var breathTool)) return; diff --git a/Content.Shared/IdentityManagement/Components/IdentityBlockerComponent.cs b/Content.Shared/IdentityManagement/Components/IdentityBlockerComponent.cs index a898ab7dce..0f65556279 100644 --- a/Content.Shared/IdentityManagement/Components/IdentityBlockerComponent.cs +++ b/Content.Shared/IdentityManagement/Components/IdentityBlockerComponent.cs @@ -6,6 +6,7 @@ namespace Content.Shared.IdentityManagement.Components; [RegisterComponent, NetworkedComponent] public sealed class IdentityBlockerComponent : Component { + public bool Enabled = true; } /// diff --git a/Content.Shared/IdentityManagement/SharedIdentitySystem.cs b/Content.Shared/IdentityManagement/SharedIdentitySystem.cs index 99c85c5ba0..54d50d0a5e 100644 --- a/Content.Shared/IdentityManagement/SharedIdentitySystem.cs +++ b/Content.Shared/IdentityManagement/SharedIdentitySystem.cs @@ -18,7 +18,8 @@ public abstract class SharedIdentitySystem : EntitySystem private void OnSeeIdentity(EntityUid uid, IdentityBlockerComponent component, SeeIdentityAttemptEvent args) { - args.Cancel(); + if (component.Enabled) + args.Cancel(); } protected virtual void OnComponentInit(EntityUid uid, IdentityComponent component, ComponentInit args)