Fix IDs without station records not being able to have nonstandard contents (#34921)
* fix ID console resetting to passenger * review * whoopsie! whitespace --------- Co-authored-by: Milon <milonpl.git@proton.me>
This commit is contained in:
@@ -98,9 +98,9 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
|
||||
var targetIdComponent = EntityManager.GetComponent<IdCardComponent>(targetId);
|
||||
var targetAccessComponent = EntityManager.GetComponent<AccessComponent>(targetId);
|
||||
|
||||
var jobProto = new ProtoId<AccessLevelPrototype>(string.Empty);
|
||||
var jobProto = targetIdComponent.JobPrototype ?? new ProtoId<AccessLevelPrototype>(string.Empty);
|
||||
if (TryComp<StationRecordKeyStorageComponent>(targetId, out var keyStorage)
|
||||
&& keyStorage.Key is {} key
|
||||
&& keyStorage.Key is { } key
|
||||
&& _record.TryGetRecord<GeneralStationRecord>(key, out var record))
|
||||
{
|
||||
jobProto = record.JobPrototype;
|
||||
@@ -151,6 +151,13 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
|
||||
}
|
||||
|
||||
UpdateStationRecord(uid, targetId, newFullName, newJobTitle, job);
|
||||
if ((!TryComp<StationRecordKeyStorageComponent>(targetId, out var keyStorage)
|
||||
|| keyStorage.Key is not { } key
|
||||
|| !_record.TryGetRecord<GeneralStationRecord>(key, out _))
|
||||
&& newJobProto != string.Empty)
|
||||
{
|
||||
Comp<IdCardComponent>(targetId).JobPrototype = newJobProto;
|
||||
}
|
||||
|
||||
if (!newAccessList.TrueForAll(x => component.AccessLevels.Contains(x)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user