diff --git a/Content.Server/Delivery/DeliverySystem.cs b/Content.Server/Delivery/DeliverySystem.cs index 5fc9b53316..04079c2006 100644 --- a/Content.Server/Delivery/DeliverySystem.cs +++ b/Content.Server/Delivery/DeliverySystem.cs @@ -52,7 +52,19 @@ public sealed partial class DeliverySystem : SharedDeliverySystem if (_station.GetStationInMap(Transform(ent).MapID) is not { } stationId) return; - if (!_records.TryGetRandomRecord(stationId, out var entry)) + // Sunrise-Start + HashSet siliconIds = new(); + if (_records.GetRecordsOfType(stationId, null) is { } records) + { + foreach (var (id, record) in records) + { + if (record.Silicon) + siliconIds.Add(id); + } + } + // Sunrise-End + + if (!_records.TryGetRandomRecord(stationId, out var entry, siliconIds)) // Sunrise-Edit return; ent.Comp.RecipientName = entry.Name; diff --git a/Content.Server/StationRecords/Systems/StationRecordsSystem.cs b/Content.Server/StationRecords/Systems/StationRecordsSystem.cs index 2f6b02d526..5dbe9f93aa 100644 --- a/Content.Server/StationRecords/Systems/StationRecordsSystem.cs +++ b/Content.Server/StationRecords/Systems/StationRecordsSystem.cs @@ -8,10 +8,14 @@ using Content.Shared.Inventory; using Content.Shared.PDA; using Content.Shared.Preferences; using Content.Shared.Roles; +using Content.Shared.Silicons.Borgs.Components; +using Content.Shared.Silicons.StationAi; using Content.Shared.StationRecords; using Robust.Shared.Enums; using Robust.Shared.Prototypes; using Robust.Shared.Random; +using System.Linq; + namespace Content.Server.StationRecords.Systems; @@ -99,12 +103,14 @@ public sealed class StationRecordsSystem : SharedStationRecordsSystem idUid = player; name = MetaData(player).EntityName; } + + var silicon = HasComp(player) || HasComp(player); // Sunrise-End TryComp(player, out var fingerprintComponent); TryComp(player, out var dnaComponent); - CreateGeneralRecord(station, idUid, name, profile.Age, profile.Species, profile.Gender, jobId, fingerprintComponent?.Fingerprint, dnaComponent?.DNA, profile, records); + CreateGeneralRecord(station, idUid, name, profile.Age, profile.Species, profile.Gender, jobId, fingerprintComponent?.Fingerprint, dnaComponent?.DNA, profile, records, silicon); // Sunrise-Edit } @@ -146,7 +152,8 @@ public sealed class StationRecordsSystem : SharedStationRecordsSystem string? mobFingerprint, string? dna, HumanoidCharacterProfile profile, - StationRecordsComponent records) + StationRecordsComponent records, + bool silicon = false) // Sunrise-Edit { if (!_prototypeManager.TryIndex(jobId, out var jobPrototype)) throw new ArgumentException($"Invalid job prototype ID: {jobId}"); @@ -170,7 +177,8 @@ public sealed class StationRecordsSystem : SharedStationRecordsSystem Gender = gender, DisplayPriority = jobPrototype.RealDisplayWeight, Fingerprint = mobFingerprint, - DNA = dna + DNA = dna, + Silicon = silicon, // Sunrise-Edit }; var key = AddRecordEntry(station, record); @@ -249,18 +257,24 @@ public sealed class StationRecordsSystem : SharedStationRecordsSystem /// The resulting entry. /// Type to get from the record set. /// True if a record was obtained. False otherwise. - public bool TryGetRandomRecord(Entity ent, [NotNullWhen(true)] out T? entry) + public bool TryGetRandomRecord(Entity ent, [NotNullWhen(true)] out T? entry, HashSet ignoredIds) // Sunrise-Edit { entry = default; if (!Resolve(ent.Owner, ref ent.Comp)) return false; - if (ent.Comp.Records.Keys.Count == 0) + // Sunrise-Start + var keys = ent.Comp.Records.Keys; + if (keys.Count == 0) return false; - var key = _random.Pick(ent.Comp.Records.Keys); + var filtered = keys.Where(id => !ignoredIds.Contains(id)).ToList(); + if (!filtered.Any()) + return false; + // Sunrise-End + var key = _random.Pick(filtered); // Sunrise-Edit return ent.Comp.Records.TryGetRecordEntry(key, out entry); } diff --git a/Content.Shared/StationRecords/GeneralStationRecord.cs b/Content.Shared/StationRecords/GeneralStationRecord.cs index 2ca34a4ffb..9e7bac423e 100644 --- a/Content.Shared/StationRecords/GeneralStationRecord.cs +++ b/Content.Shared/StationRecords/GeneralStationRecord.cs @@ -68,4 +68,7 @@ public sealed record GeneralStationRecord /// [DataField] public string? DNA; + + [DataField] + public bool Silicon; // Sunrise-Edit }