Station records (#8720)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Access.Systems;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Server.StationRecords;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.StationRecords;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -91,6 +93,25 @@ namespace Content.Server.Access.Components
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Medium,
|
||||
$"{_entities.ToPrettyString(player):player} has modified {_entities.ToPrettyString(targetIdEntity):entity} with the following accesses: [{string.Join(", ", newAccessList)}]");
|
||||
|
||||
UpdateStationRecord(targetIdEntity, newFullName, newJobTitle);
|
||||
}
|
||||
|
||||
private void UpdateStationRecord(EntityUid idCard, string newFullName, string newJobTitle)
|
||||
{
|
||||
var station = EntitySystem.Get<StationSystem>().GetOwningStation(Owner);
|
||||
var recordSystem = EntitySystem.Get<StationRecordsSystem>();
|
||||
if (station == null
|
||||
|| !_entities.TryGetComponent(idCard, out StationRecordKeyStorageComponent? keyStorage)
|
||||
|| keyStorage.Key == null
|
||||
|| !recordSystem.TryGetRecord(station.Value, keyStorage.Key.Value, out GeneralStationRecord? record))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
record.Name = newFullName;
|
||||
record.JobTitle = newJobTitle;
|
||||
|
||||
recordSystem.Synchronize(station.Value);
|
||||
}
|
||||
|
||||
public void UpdateUserInterface()
|
||||
|
||||
Reference in New Issue
Block a user