Identity fixes (#9701)

This commit is contained in:
Kara
2022-07-13 22:23:55 -07:00
committed by GitHub
parent 130a4cdd6a
commit a0c531d08b
4 changed files with 21 additions and 6 deletions

View File

@@ -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}");

View File

@@ -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<IngestionBlockerComponent>(uid, out var blocker))
blocker.Enabled = !mask.IsToggled;
//toggle disease protection
// toggle disease protection
if (TryComp<DiseaseProtectionComponent>(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<IdentityBlockerComponent>(uid, out var identity))
identity.Enabled = !mask.IsToggled;
// toggle breath tool connection (skip during equip since that is handled in LungSystem)
if (isEquip || !TryComp<BreathToolComponent>(uid, out var breathTool))
return;

View File

@@ -6,6 +6,7 @@ namespace Content.Shared.IdentityManagement.Components;
[RegisterComponent, NetworkedComponent]
public sealed class IdentityBlockerComponent : Component
{
public bool Enabled = true;
}
/// <summary>

View File

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