diff --git a/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs b/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs index 0431d95a42..a4ebbf3eac 100644 --- a/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs +++ b/Content.Shared/Silicons/Borgs/SharedBorgSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.Access.Components; +using System.Linq; +using Content.Shared._White.TTS; using Content.Shared.Containers.ItemSlots; using Content.Shared.Movement.Components; using Content.Shared.Movement.Systems; @@ -7,6 +8,8 @@ using Content.Shared.PowerCell.Components; using Content.Shared.Silicons.Borgs.Components; using Content.Shared.Wires; using Robust.Shared.Containers; +using Robust.Shared.Prototypes; +using Robust.Shared.Random; namespace Content.Shared.Silicons.Borgs; @@ -18,6 +21,10 @@ 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!; // Giedi EDIT + [Dependency] protected readonly IRobustRandom RobustRandom = default!; // Giedi EDIT + + private HashSet _voices = new (); /// public override void Initialize() @@ -31,9 +38,33 @@ public abstract partial class SharedBorgSystem : EntitySystem SubscribeLocalEvent(OnRemoved); SubscribeLocalEvent(OnRefreshMovementSpeedModifiers); + // WD edit + SubscribeLocalEvent(EnsureRandomTTS); + InitializeRelay(); + GenerateVoiceList(); // WD edit } + // Giedi added + private void EnsureRandomTTS(EntityUid uid, SharedTTSComponent component, ComponentStartup args) + { + if (!HasComp(uid)) + return; + + var voiceId = RobustRandom.Pick(_voices); + + component.VoicePrototypeId = voiceId.ID; + Dirty(uid, component); + } + + private void GenerateVoiceList() + { + _voices = PrototypeManager.EnumeratePrototypes() + .Where(x => x.BorgVoice) + .ToHashSet(); + } + // Giedi added + private void OnItemSlotInsertAttempt(EntityUid uid, BorgChassisComponent component, ref ItemSlotInsertAttemptEvent args) { if (args.Cancelled) diff --git a/Content.Shared/_White/TTS/SharedTTSComponent.cs b/Content.Shared/_White/TTS/SharedTTSComponent.cs index 18b1e0d9be..1b1990777c 100644 --- a/Content.Shared/_White/TTS/SharedTTSComponent.cs +++ b/Content.Shared/_White/TTS/SharedTTSComponent.cs @@ -1,11 +1,12 @@ -using Robust.Shared.Prototypes; +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; namespace Content.Shared._White.TTS; /// /// Apply TTS for entity chat say messages /// -[RegisterComponent, AutoGenerateComponentState] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] // ReSharper disable once InconsistentNaming public sealed partial class SharedTTSComponent : Component { @@ -14,4 +15,4 @@ public sealed partial class SharedTTSComponent : Component /// [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] public ProtoId VoicePrototypeId { get; set; } = "Eugene"; -} \ No newline at end of file +} diff --git a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml index 6706411861..a05e50badd 100644 --- a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml +++ b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml @@ -128,12 +128,7 @@ - Flashed - type: TypingIndicator proto: robot - - type: Speech - speechVerb: Robotic - speechSounds: Borg - - type: Vocal - sounds: - Unsexed: UnisexSilicon + - type: TTS - type: UnblockableSpeech - type: FootstepModifier footstepSoundCollection: @@ -282,10 +277,6 @@ - Syndicate - type: ShowSyndicateIcons - type: MovementAlwaysTouching - - type: Speech - speechSounds: SyndieBorg - - type: Vocal - sounds: - Unsexed: UnisexSiliconSyndicate + - type: TTS - type: PointLight color: "#dd200b" diff --git a/Resources/Prototypes/Entities/Mobs/Cyborgs/borg_chassis.yml b/Resources/Prototypes/Entities/Mobs/Cyborgs/borg_chassis.yml index 052b084f72..47984958a9 100644 --- a/Resources/Prototypes/Entities/Mobs/Cyborgs/borg_chassis.yml +++ b/Resources/Prototypes/Entities/Mobs/Cyborgs/borg_chassis.yml @@ -27,8 +27,6 @@ name: cyborg - type: Construction node: cyborg - - type: Speech - speechVerb: Robotic - type: InteractionPopup interactSuccessString: petting-success-generic-cyborg interactFailureString: petting-failure-generic-cyborg