Criminal record hud icons (#25192)
* Security hud shows icon based on criminal record status * Criminal status now linked to name instead of identity * parole loc * Test fix * review changes * Check station records instead of storing names on criminal record consoles. * cleanup * more cleanup * review changes * change outdated comments * rename * review changes * remove event subscription * replaced event with trycomp * default value
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.CriminalRecords.Systems;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Shared.Clothing;
|
||||
using Content.Shared.Database;
|
||||
@@ -25,6 +26,7 @@ public class IdentitySystem : SharedIdentitySystem
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly HumanoidAppearanceSystem _humanoid = default!;
|
||||
[Dependency] private readonly CriminalRecordsConsoleSystem _criminalRecordsConsole = default!;
|
||||
|
||||
private HashSet<EntityUid> _queuedIdentityUpdates = new();
|
||||
|
||||
@@ -107,7 +109,9 @@ public class IdentitySystem : SharedIdentitySystem
|
||||
_metaData.SetEntityName(ident, name);
|
||||
|
||||
_adminLog.Add(LogType.Identity, LogImpact.Medium, $"{ToPrettyString(uid)} changed identity to {name}");
|
||||
RaiseLocalEvent(new IdentityChangedEvent(uid, ident));
|
||||
var identityChangedEvent = new IdentityChangedEvent(uid, ident);
|
||||
RaiseLocalEvent(uid, ref identityChangedEvent);
|
||||
SetIdentityCriminalIcon(uid);
|
||||
}
|
||||
|
||||
private string GetIdentityName(EntityUid target, IdentityRepresentation representation)
|
||||
@@ -118,6 +122,16 @@ public class IdentitySystem : SharedIdentitySystem
|
||||
return representation.ToStringKnown(!ev.Cancelled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When the identity of a person is changed, searches the criminal records to see if the name of the new identity
|
||||
/// has a record. If the new name has a criminal status attached to it, the person will get the criminal status
|
||||
/// until they change identity again.
|
||||
/// </summary>
|
||||
private void SetIdentityCriminalIcon(EntityUid uid)
|
||||
{
|
||||
_criminalRecordsConsole.CheckNewIdentity(uid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an 'identity representation' of an entity, with their true name being the entity name
|
||||
/// and their 'presumed name' and 'presumed job' being the name/job on their ID card, if they have one.
|
||||
@@ -159,15 +173,3 @@ public class IdentitySystem : SharedIdentitySystem
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public sealed class IdentityChangedEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid CharacterEntity;
|
||||
public EntityUid IdentityEntity;
|
||||
|
||||
public IdentityChangedEvent(EntityUid characterEntity, EntityUid identityEntity)
|
||||
{
|
||||
CharacterEntity = characterEntity;
|
||||
IdentityEntity = identityEntity;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user