Small identity fixes (#9617)

This commit is contained in:
Kara
2022-07-10 23:54:48 -07:00
committed by GitHub
parent e1e1d2acc6
commit eb22cfbe43
2 changed files with 11 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ public class IdentitySystem : SharedIdentitySystem
[Dependency] private readonly IdCardSystem _idCard = default!;
[Dependency] private readonly IAdminLogManager _adminLog = default!;
private Queue<EntityUid> _queuedIdentityUpdates = new();
private HashSet<EntityUid> _queuedIdentityUpdates = new();
public override void Initialize()
{
@@ -37,13 +37,15 @@ public class IdentitySystem : SharedIdentitySystem
{
base.Update(frameTime);
while (_queuedIdentityUpdates.TryDequeue(out var ent))
foreach (var ent in _queuedIdentityUpdates)
{
if (!TryComp<IdentityComponent>(ent, out var identity))
continue;
UpdateIdentityInfo(ent, identity);
}
_queuedIdentityUpdates.Clear();
}
// This is where the magic happens
@@ -62,7 +64,7 @@ public class IdentitySystem : SharedIdentitySystem
/// </summary>
public void QueueIdentityUpdate(EntityUid uid)
{
_queuedIdentityUpdates.Enqueue(uid);
_queuedIdentityUpdates.Add(uid);
}
#region Private API

View File

@@ -28,6 +28,7 @@ using Content.Shared.Roles;
using Content.Server.Traitor;
using Content.Shared.Zombies;
using Content.Server.Atmos.Miasma;
using Content.Server.IdentityManagement;
namespace Content.Server.Zombies
{
@@ -45,6 +46,7 @@ namespace Content.Server.Zombies
[Dependency] private readonly ServerInventorySystem _serverInventory = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly SharedHumanoidAppearanceSystem _sharedHuApp = default!;
[Dependency] private readonly IdentitySystem _identity = default!;
[Dependency] private readonly IChatManager _chatMan = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
@@ -75,7 +77,7 @@ namespace Content.Server.Zombies
/// <remarks>
/// ALRIGHT BIG BOY. YOU'VE COME TO THE LAYER OF THE BEAST. THIS IS YOUR WARNING.
/// This function is the god function for zombie stuff, and it is cursed. I have
/// attempted to label everything thouroughly for your sanity. I have attempted to
/// attempted to label everything thouroughly for your sanity. I have attempted to
/// rewrite this, but this is how it shall lie eternal. Turn back now.
/// -emo
/// </remarks>
@@ -158,6 +160,8 @@ namespace Content.Server.Zombies
if (TryComp<MetaDataComponent>(target, out var meta))
meta.EntityName = Loc.GetString("zombie-name-prefix", ("target", meta.EntityName));
_identity.QueueIdentityUpdate(target);
//He's gotta have a mind
var mindcomp = EnsureComp<MindComponent>(target);
if (mindcomp.Mind != null && mindcomp.Mind.TryGetSession(out var session))
@@ -178,7 +182,7 @@ namespace Content.Server.Zombies
}
///Goes through every hand, drops the items in it, then removes the hand
///may become the source of various bugs.
///may become the source of various bugs.
foreach (var hand in _sharedHands.EnumerateHands(target))
{
_sharedHands.SetActiveHand(target, hand);