Поправки

This commit is contained in:
Jabak
2024-09-21 14:27:44 +03:00
parent 2213132b77
commit c7bc6320e8

View File

@@ -21,6 +21,8 @@ public abstract partial class SharedBorgSystem : EntitySystem
[Dependency] protected readonly SharedContainerSystem Container = default!; [Dependency] protected readonly SharedContainerSystem Container = default!;
[Dependency] protected readonly ItemSlotsSystem ItemSlots = default!; [Dependency] protected readonly ItemSlotsSystem ItemSlots = default!;
[Dependency] protected readonly SharedPopupSystem Popup = default!; [Dependency] protected readonly SharedPopupSystem Popup = default!;
[Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
[Dependency] protected readonly IRobustRandom RobustRandom = default!;
/// <inheritdoc/> /// <inheritdoc/>
public override void Initialize() public override void Initialize()
@@ -40,12 +42,13 @@ public abstract partial class SharedBorgSystem : EntitySystem
private void RandomTTS(EntityUid uid, SharedTTSComponent component, ComponentStartup args) private void RandomTTS(EntityUid uid, SharedTTSComponent component, ComponentStartup args)
{ {
if (TryComp<BorgChassisComponent>(uid, out var borgChassis) && borgChassis.Initialized) if (TryComp<BorgChassisComponent>(uid, out _))
{ return;
var voices = IoCManager.Resolve<IPrototypeManager>().EnumeratePrototypes<TTSBorgVoicePrototype>().ToList();
var voice = IoCManager.Resolve<IRobustRandom>().Pick(voices); var voiceList = PrototypeManager.EnumeratePrototypes<TTSBorgVoicePrototype>().ToHashSet();
component.VoicePrototypeId = voice.ID; var voice = RobustRandom.Pick(voiceList);
} component.VoicePrototypeId = voice.ID;
} }
private void OnItemSlotInsertAttempt(EntityUid uid, BorgChassisComponent component, ref ItemSlotInsertAttemptEvent args) private void OnItemSlotInsertAttempt(EntityUid uid, BorgChassisComponent component, ref ItemSlotInsertAttemptEvent args)