Speech is relayed by holopad holograms (#33978)
* Initial commit * Corrected a field attribute
This commit is contained in:
@@ -10,6 +10,7 @@ using Content.Shared.Holopad;
|
|||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
using Content.Shared.Labels.Components;
|
using Content.Shared.Labels.Components;
|
||||||
using Content.Shared.Silicons.StationAi;
|
using Content.Shared.Silicons.StationAi;
|
||||||
|
using Content.Shared.Speech;
|
||||||
using Content.Shared.Telephone;
|
using Content.Shared.Telephone;
|
||||||
using Content.Shared.UserInterface;
|
using Content.Shared.UserInterface;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
@@ -528,16 +529,23 @@ public sealed class HolopadSystem : SharedHolopadSystem
|
|||||||
entity.Comp.HologramProtoId == null)
|
entity.Comp.HologramProtoId == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var uid = Spawn(entity.Comp.HologramProtoId, Transform(entity).Coordinates);
|
var hologramUid = Spawn(entity.Comp.HologramProtoId, Transform(entity).Coordinates);
|
||||||
|
|
||||||
// Safeguard - spawned holograms must have this component
|
// Safeguard - spawned holograms must have this component
|
||||||
if (!TryComp<HolopadHologramComponent>(uid, out var component))
|
if (!TryComp<HolopadHologramComponent>(hologramUid, out var holopadHologram))
|
||||||
{
|
{
|
||||||
Del(uid);
|
Del(hologramUid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.Comp.Hologram = new Entity<HolopadHologramComponent>(uid, component);
|
entity.Comp.Hologram = new Entity<HolopadHologramComponent>(hologramUid, holopadHologram);
|
||||||
|
|
||||||
|
// Relay speech preferentially through the hologram
|
||||||
|
if (TryComp<SpeechComponent>(hologramUid, out var hologramSpeech) &&
|
||||||
|
TryComp<TelephoneComponent>(entity, out var entityTelephone))
|
||||||
|
{
|
||||||
|
_telephoneSystem.SetSpeakerForTelephone((entity, entityTelephone), (hologramUid, hologramSpeech));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteHologram(Entity<HolopadHologramComponent> hologram, Entity<HolopadComponent> attachedHolopad)
|
private void DeleteHologram(Entity<HolopadHologramComponent> hologram, Entity<HolopadComponent> attachedHolopad)
|
||||||
|
|||||||
@@ -105,14 +105,17 @@ public sealed class TelephoneSystem : SharedTelephoneSystem
|
|||||||
var nameEv = new TransformSpeakerNameEvent(args.MessageSource, Name(args.MessageSource));
|
var nameEv = new TransformSpeakerNameEvent(args.MessageSource, Name(args.MessageSource));
|
||||||
RaiseLocalEvent(args.MessageSource, nameEv);
|
RaiseLocalEvent(args.MessageSource, nameEv);
|
||||||
|
|
||||||
var name = Loc.GetString("speech-name-relay",
|
// Determine if speech should be relayed via the telephone itself or a designated speaker
|
||||||
("speaker", Name(entity)),
|
var speaker = entity.Comp.Speaker != null ? entity.Comp.Speaker.Value.Owner : entity.Owner;
|
||||||
("originalName", nameEv.VoiceName));
|
|
||||||
|
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 range = args.TelephoneSource.Comp.LinkedTelephones.Count > 1 ? ChatTransmitRange.HideChat : ChatTransmitRange.GhostRangeLimit;
|
||||||
var volume = entity.Comp.SpeakerVolume == TelephoneVolume.Speak ? InGameICChatType.Speak : InGameICChatType.Whisper;
|
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
|
#endregion
|
||||||
@@ -412,6 +415,11 @@ public sealed class TelephoneSystem : SharedTelephoneSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetSpeakerForTelephone(Entity<TelephoneComponent> entity, Entity<SpeechComponent>? speaker)
|
||||||
|
{
|
||||||
|
entity.Comp.Speaker = speaker;
|
||||||
|
}
|
||||||
|
|
||||||
private (string?, string?) GetNameAndJobOfCallingEntity(EntityUid uid)
|
private (string?, string?) GetNameAndJobOfCallingEntity(EntityUid uid)
|
||||||
{
|
{
|
||||||
string? presumedName = null;
|
string? presumedName = null;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.Chat;
|
using Content.Shared.Chat;
|
||||||
|
using Content.Shared.Speech;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -92,6 +93,12 @@ public sealed partial class TelephoneComponent : Component
|
|||||||
[DataField]
|
[DataField]
|
||||||
public bool UnlistedNumber = false;
|
public bool UnlistedNumber = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Speech is relayed through this entity instead of the telephone
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadOnly)]
|
||||||
|
public Entity<SpeechComponent>? Speaker = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Telephone number for this device
|
/// Telephone number for this device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -183,7 +190,7 @@ public readonly record struct TelephoneMessageReceivedEvent(string Message, MsgC
|
|||||||
public struct TelephoneCallOptions
|
public struct TelephoneCallOptions
|
||||||
{
|
{
|
||||||
public bool IgnoreRange; // The source can always reach its target
|
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 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 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 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
|
public bool MuteReceiver; // Chatter from the receiver is not transmitted - useful for broadcasting messages to multiple receivers
|
||||||
@@ -215,7 +222,7 @@ public enum TelephoneVolume : byte
|
|||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public enum TelephoneRange : byte
|
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
|
Map, // Can reach any telephone that is on the same map
|
||||||
Unlimited, // Can reach any telephone, across any distance
|
Unlimited, // Can reach any telephone, across any distance
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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-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 source[/bolditalic][/font][/color]
|
chat-telephone-unknown-device = [color={$color}][font={$fontType} size={$fontSize}][bolditalic]Unknown source[/bolditalic][/font][/color]
|
||||||
chat-telephone-device-id = [color={$color}][font={$fontType} size={$fontSize}][bold]{CAPITALIZE($deviceName)}[/bold][/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})
|
||||||
@@ -149,6 +149,7 @@
|
|||||||
# These are spawned by holopads
|
# These are spawned by holopads
|
||||||
- type: entity
|
- type: entity
|
||||||
id: HolopadHologram
|
id: HolopadHologram
|
||||||
|
name: hologram
|
||||||
categories: [ HideSpawnMenu ]
|
categories: [ HideSpawnMenu ]
|
||||||
suffix: DO NOT MAP
|
suffix: DO NOT MAP
|
||||||
components:
|
components:
|
||||||
@@ -163,6 +164,10 @@
|
|||||||
- type: Appearance
|
- type: Appearance
|
||||||
- type: TypingIndicator
|
- type: TypingIndicator
|
||||||
proto: robot
|
proto: robot
|
||||||
|
- type: Speech
|
||||||
|
speechVerb: Robotic
|
||||||
|
speechSounds: Borg
|
||||||
|
speechBubbleOffset: 0.45
|
||||||
- type: HolopadHologram
|
- type: HolopadHologram
|
||||||
rsiPath: Structures/Machines/holopad.rsi
|
rsiPath: Structures/Machines/holopad.rsi
|
||||||
rsiState: icon_in_call
|
rsiState: icon_in_call
|
||||||
|
|||||||
Reference in New Issue
Block a user