From c7bc6320e87d38e2383a68ee4e2a0e35112dabb1 Mon Sep 17 00:00:00 2001 From: Jabak <163307958+Jabaks@users.noreply.github.com> Date: Sat, 21 Sep 2024 14:27:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Shared/Silicons/Borgs/SharedBorgSystem.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs b/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs index f618cea785..125a09c299 100644 --- a/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs +++ b/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs @@ -21,6 +21,8 @@ public abstract partial class SharedBorgSystem : EntitySystem [Dependency] protected readonly SharedContainerSystem Container = default!; [Dependency] protected readonly ItemSlotsSystem ItemSlots = default!; [Dependency] protected readonly SharedPopupSystem Popup = default!; + [Dependency] protected readonly IPrototypeManager PrototypeManager = default!; + [Dependency] protected readonly IRobustRandom RobustRandom = default!; /// public override void Initialize() @@ -40,12 +42,13 @@ public abstract partial class SharedBorgSystem : EntitySystem private void RandomTTS(EntityUid uid, SharedTTSComponent component, ComponentStartup args) { - if (TryComp(uid, out var borgChassis) && borgChassis.Initialized) - { - var voices = IoCManager.Resolve().EnumeratePrototypes().ToList(); - var voice = IoCManager.Resolve().Pick(voices); - component.VoicePrototypeId = voice.ID; - } + if (TryComp(uid, out _)) + return; + + var voiceList = PrototypeManager.EnumeratePrototypes().ToHashSet(); + var voice = RobustRandom.Pick(voiceList); + component.VoicePrototypeId = voice.ID; + } private void OnItemSlotInsertAttempt(EntityUid uid, BorgChassisComponent component, ref ItemSlotInsertAttemptEvent args)