public List<AdminLogPlayer> Players { get; set; } = default!;
+ // Unused
public List<AdminLogEntity> Entities { get; set; } = default!;
}
[ForeignKey("LogId,RoundId")] public AdminLog Log { get; set; } = default!;
}
+ // Unused
public class AdminLogEntity
{
[Required, Key] public int Uid { get; set; }
using System.Text.Json;
using System.Text.Json.Serialization;
using Content.Server.Administration.Logs.Converters;
-using Content.Server.Database;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Map;
_sawmill.Debug($"Admin log converters found: {string.Join(" ", converterNames)}");
}
- private (JsonDocument Json, HashSet<Guid> Players, List<AdminLogEntity> Entities) ToJson(
+ private (JsonDocument Json, HashSet<Guid> Players) ToJson(
Dictionary<string, object?> properties)
{
- var entities = new Dictionary<EntityUid, AdminLogEntity>();
var players = new HashSet<Guid>();
var parsed = new Dictionary<string, object?>();
_ => null
};
- if (entityId is not { } uid)
- {
- continue;
- }
-
- var entityName = _entityManager.TryGetComponent(uid, out MetaDataComponent? metadata)
- ? metadata.EntityName
- : null;
-
- // TODO set the id too whenever we feel like running a migration for 10 hours
- entities.TryAdd(uid, new AdminLogEntity { Name = entityName });
-
- if (_entityManager.TryGetComponent(uid, out ActorComponent? actor))
+ if (_entityManager.TryGetComponent(entityId, out ActorComponent? actor))
{
players.Add(actor.PlayerSession.UserId.UserId);
}
}
- return (JsonSerializer.SerializeToDocument(parsed, _jsonOptions), players, entities.Values.ToList());
+ return (JsonSerializer.SerializeToDocument(parsed, _jsonOptions), players);
}
}
}
}
- private void Add(LogType type, LogImpact impact, string message, JsonDocument json, HashSet<Guid> players, List<AdminLogEntity> entities)
+ private void Add(LogType type, LogImpact impact, string message, JsonDocument json, HashSet<Guid> players)
{
var preRound = _runLevel == GameRunLevel.PreRoundLobby;
var count = preRound ? _preRoundLogQueue.Count : _logQueue.Count;
Date = DateTime.UtcNow,
Message = message,
Json = json,
- Players = new List<AdminLogPlayer>(players.Count),
- Entities = entities
+ Players = new List<AdminLogPlayer>(players.Count)
};
foreach (var id in players)
return;
}
- var (json, players, entities) = ToJson(handler.Values);
+ var (json, players) = ToJson(handler.Values);
var message = handler.ToStringAndClear();
- Add(type, impact, message, json, players, entities);
+ Add(type, impact, message, json, players);
}
public override void Add(LogType type, ref LogStringHandler handler)