diff --git a/Content.Server/Access/Components/IdCardConsoleComponent.cs b/Content.Server/Access/Components/IdCardConsoleComponent.cs index 6990802ea2..e4e034598a 100644 --- a/Content.Server/Access/Components/IdCardConsoleComponent.cs +++ b/Content.Server/Access/Components/IdCardConsoleComponent.cs @@ -95,12 +95,20 @@ namespace Content.Server.Access.Components } var accessSystem = _entities.EntitySysManager.GetEntitySystem(); + var oldTags = accessSystem.TryGetTags(targetIdEntity) ?? new List(); + oldTags = oldTags.ToList(); + + if (oldTags.SequenceEqual(newAccessList)) + return; + + var addedTags = newAccessList.Except(oldTags).Select(tag => "+" + tag).ToList(); + var removedTags = oldTags.Except(newAccessList).Select(tag => "-" + tag).ToList(); accessSystem.TrySetTags(targetIdEntity, newAccessList); /*TODO: ECS IdCardConsoleComponent and then log on card ejection, together with the save. This current implementation is pretty shit as it logs 27 entries (27 lines) if someone decides to give themselves AA*/ _adminLogger.Add(LogType.Action, LogImpact.Medium, - $"{_entities.ToPrettyString(player):player} has modified {_entities.ToPrettyString(targetIdEntity):entity} with the following accesses: [{string.Join(", ", newAccessList)}]"); + $"{_entities.ToPrettyString(player):player} has modified {_entities.ToPrettyString(targetIdEntity):entity} with the following accesses: [{String.Join(", ", addedTags.Union(removedTags))}] [{string.Join(", ", newAccessList)}]"); UpdateStationRecord(targetIdEntity, newFullName, newJobTitle, newJobProto); } diff --git a/Content.Server/Access/Systems/IdCardSystem.cs b/Content.Server/Access/Systems/IdCardSystem.cs index ce69b4f912..c5c8682073 100644 --- a/Content.Server/Access/Systems/IdCardSystem.cs +++ b/Content.Server/Access/Systems/IdCardSystem.cs @@ -48,6 +48,8 @@ namespace Content.Server.Access.Systems EntityManager.SpawnEntity("FoodBadRecipe", transformComponent.Coordinates); } + _adminLogger.Add(LogType.Action, LogImpact.Medium, + $"{ToPrettyString(args.Microwave)} burnt {ToPrettyString(uid):entity}"); EntityManager.QueueDeleteEntity(uid); return; } @@ -56,6 +58,8 @@ namespace Content.Server.Access.Systems { _popupSystem.PopupEntity(Loc.GetString("id-card-component-microwave-bricked", ("id", uid)), uid); access.Tags.Clear(); + _adminLogger.Add(LogType.Action, LogImpact.Medium, + $"{ToPrettyString(args.Microwave)} cleared access on {ToPrettyString(uid):entity}"); } else { @@ -65,6 +69,9 @@ namespace Content.Server.Access.Systems // Give them a wonderful new access to compensate for everything var random = _random.Pick(_prototypeManager.EnumeratePrototypes().ToArray()); access.Tags.Add(random.ID); + + _adminLogger.Add(LogType.Action, LogImpact.Medium, + $"{ToPrettyString(args.Microwave)} added {random.ID} access to {ToPrettyString(uid):entity}"); } } @@ -92,6 +99,8 @@ namespace Content.Server.Access.Systems jobTitle = null; } + if (id.JobTitle == jobTitle) + return true; id.JobTitle = jobTitle; Dirty(id); UpdateEntityName(uid, id); @@ -127,6 +136,8 @@ namespace Content.Server.Access.Systems fullName = null; } + if (id.FullName == fullName) + return true; id.FullName = fullName; Dirty(id); UpdateEntityName(uid, id); diff --git a/Content.Shared/Access/Systems/SharedAccessSystem.cs b/Content.Shared/Access/Systems/SharedAccessSystem.cs index 872e1190df..d7204fa8cc 100644 --- a/Content.Shared/Access/Systems/SharedAccessSystem.cs +++ b/Content.Shared/Access/Systems/SharedAccessSystem.cs @@ -67,6 +67,15 @@ namespace Content.Shared.Access.Systems return true; } + /// + /// Gets the set of access tags. + /// + /// The new access tags + public IEnumerable? TryGetTags(EntityUid uid, AccessComponent? access = null) + { + return !Resolve(uid, ref access) ? null : access.Tags; + } + public bool TryAddGroups(EntityUid uid, IEnumerable newGroups, AccessComponent? access = null) { if (!Resolve(uid, ref access))