diff --git a/Content.Server/Telephone/TelephoneSystem.cs b/Content.Server/Telephone/TelephoneSystem.cs index a13ebd16fda4..e90bfbf6c525 100644 --- a/Content.Server/Telephone/TelephoneSystem.cs +++ b/Content.Server/Telephone/TelephoneSystem.cs @@ -104,14 +104,17 @@ private void OnTelephoneMessageReceived(Entity entity, ref T var nameEv = new TransformSpeakerNameEvent(args.MessageSource, Name(args.MessageSource)); RaiseLocalEvent(args.MessageSource, nameEv); - var name = Loc.GetString("speech-name-relay", - ("speaker", Name(entity)), - ("originalName", nameEv.VoiceName)); + // Determine if speech should be relayed via the telephone itself or a designated speaker + var speaker = entity.Comp.Speaker != null ? entity.Comp.Speaker.Value.Owner : entity.Owner; + + var name = Loc.GetString("chat-telephone-name-relay", + ("originalName", nameEv.VoiceName), + ("speaker", Name(speaker))); var range = args.TelephoneSource.Comp.LinkedTelephones.Count > 1 ? ChatTransmitRange.HideChat : ChatTransmitRange.GhostRangeLimit; var volume = entity.Comp.SpeakerVolume == TelephoneVolume.Speak ? InGameICChatType.Speak : InGameICChatType.Whisper; - _chat.TrySendInGameICMessage(entity, args.Message, volume, range, nameOverride: name, checkRadioPrefix: false); + _chat.TrySendInGameICMessage(speaker, args.Message, volume, range, nameOverride: name, checkRadioPrefix: false); } #endregion @@ -404,6 +407,11 @@ private void SetTelephoneMicrophoneState(Entity entity, bool } } + public void SetSpeakerForTelephone(Entity entity, Entity? speaker) + { + entity.Comp.Speaker = speaker; + } + private (string?, string?) GetNameAndJobOfCallingEntity(EntityUid uid) { string? presumedName = null; diff --git a/Content.Shared/Telephone/TelephoneComponent.cs b/Content.Shared/Telephone/TelephoneComponent.cs index c08f8b9af378..c24840ce01a4 100644 --- a/Content.Shared/Telephone/TelephoneComponent.cs +++ b/Content.Shared/Telephone/TelephoneComponent.cs @@ -1,4 +1,5 @@ using Content.Shared.Chat; +using Content.Shared.Speech; using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Serialization; @@ -92,6 +93,12 @@ public sealed partial class TelephoneComponent : Component [DataField] public bool UnlistedNumber = false; + /// + /// Speech is relayed through this entity instead of the telephone + /// + [ViewVariables(VVAccess.ReadOnly)] + public Entity? Speaker = null; + /// /// Telephone number for this device /// @@ -182,7 +189,8 @@ public record struct TelephoneCallEndedEvent(); [Serializable, NetSerializable] public struct TelephoneCallOptions { - public bool ForceConnect; // The source immediately starts a call with the receiver, potentially interrupting a call that is already in progress + public bool IgnoreRange; // The source can always reach its target + public bool ForceConnect; // The source immediately starts a call with the receiver, potentially interrupting a call that is already in progress public bool ForceJoin; // The source smoothly joins a call in progress, or starts a normal call with the receiver if there is none public bool MuteSource; // Chatter from the source is not transmitted - could be used for eavesdropping when combined with 'ForceJoin' public bool MuteReceiver; // Chatter from the receiver is not transmitted - useful for broadcasting messages to multiple receivers @@ -214,7 +222,7 @@ public enum TelephoneVolume : byte [Serializable, NetSerializable] public enum TelephoneRange : byte { - Grid, // Can only reach telephones that are on the same grid + Grid, // Can only reach telephones that are on the same grid Map, // Can reach any telephone that is on the same map Unlimited, // Can reach any telephone, across any distance } diff --git a/Resources/Locale/en-US/telephone/telephone.ftl b/Resources/Locale/en-US/telephone/telephone.ftl index b1b27768e6ec..6685a67c8e2d 100644 --- a/Resources/Locale/en-US/telephone/telephone.ftl +++ b/Resources/Locale/en-US/telephone/telephone.ftl @@ -8,3 +8,6 @@ chat-telephone-caller-id-with-job = [color={$color}][font={$fontType} size={$fon chat-telephone-caller-id-without-job = [color={$color}][font={$fontType} size={$fontSize}][bold]{CAPITALIZE($callerName)}[/bold][/font][/color] chat-telephone-unknown-device = [color={$color}][font={$fontType} size={$fontSize}][bolditalic]Unknown device[/bolditalic][/font][/color] chat-telephone-device-id = [color={$color}][font={$fontType} size={$fontSize}][bold]{CAPITALIZE($deviceName)}[/bold][/font][/color] + +# Chat text +chat-telephone-name-relay = {$originalName} ({$speaker}) \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Structures/Machines/holopad.yml b/Resources/Prototypes/Entities/Structures/Machines/holopad.yml index f4327cfd03b0..84ecb085530e 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/holopad.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/holopad.yml @@ -149,6 +149,7 @@ # These are spawned by holopads - type: entity id: HolopadHologram + name: hologram categories: [ HideSpawnMenu ] suffix: DO NOT MAP components: @@ -163,6 +164,10 @@ - type: Appearance - type: TypingIndicator proto: robot + - type: Speech + speechVerb: Robotic + speechSounds: Borg + speechBubbleOffset: 0.45 - type: HolopadHologram rsiPath: Structures/Machines/holopad.rsi rsiState: icon_in_call