* Initial resources commit * Initial code commit * Added additional resources * Continuing to build holopad and telephone systems * Added hologram shader * Added hologram system and entity * Holo calls now have a hologram of the user appear on them * Initial implementation of holopads transmitting nearby chatter * Added support for linking across multiple telephones/holopads/entities * Fixed a bunch of bugs * Tried simplifying holopad entity dependence, added support for mid-call user switching * Replaced PVS expansion with manually networked sprite states * Adjusted volume of ring tone * Added machine board * Minor features and tweaks * Resolving merge conflict * Recommit audio attributions * Telephone chat adjustments * Added support for AI interactions with holopads * Building the holopad UI * Holopad UI finished * Further UI tweaks * Station AI can hear local chatter when being projected from a holopad * Minor bug fixes * Added wire panels to holopads * Basic broadcasting * Start of emergency broadcasting code * Fixing issues with broadcasting * More work on emergency broadcasting * Updated holopad visuals * Added cooldown text to emergency broadcast and control lock out screen * Code clean up * Fixed issue with timing * Broadcasting now requires command access * Fixed some bugs * Added multiple holopad prototypes with different ranges * The AI no longer requires power to interact with holopads * Fixed some additional issues * Addressing more issues * Added emote support for holograms * Changed the broadcast lockout durations to their proper values * Added AI vision wire to holopads * Bug fixes * AI vision and interaction wires can be added to the same wire panel * Fixed error * More bug fixes * Fixed test fail * Embellished the emergency call lock out window * Holopads play borg sounds when speaking * Borg and AI names are listed as the caller ID on the holopad * Borg chassis can now be seen on holopad holograms * Holopad returns to a machine frame when badly damaged * Clarified some text * Fix merge conflict * Fixed merge conflict * Fixing merge conflict * Fixing merge conflict * Fixing merge conflict * Offset menu on open * AI can alt click on holopads to activate the projector * Bug fixes for intellicard interactions * Fixed speech issue with intellicards * The UI automatically opens for the AI when it alt-clicks on the holopad * Simplified shader math * Telephones will auto hang up 60 seconds after the last person on a call stops speaking * Added better support for AI requests when multiple AI cores are on the station * The call controls pop up for the AI when they accept a summons from a holopad * Compatibility mode fix for the hologram shader * Further shader fixes for compatibility mode * File clean up * More cleaning up * Removed access requirements from quantum holopads so they can used by nukies * The title of the holopad window now reflects the name of the device * Linked telephones will lose their connection if both move out of range of each other
204 lines
5.9 KiB
C#
204 lines
5.9 KiB
C#
using Content.Shared.Chat;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.Telephone;
|
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
|
[Access(typeof(SharedTelephoneSystem))]
|
|
public sealed partial class TelephoneComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// Sets how long the telephone will ring before it automatically hangs up
|
|
/// </summary>
|
|
[DataField]
|
|
public float RingingTimeout = 30;
|
|
|
|
/// <summary>
|
|
/// Sets how long the telephone can remain idle in-call before it automatically hangs up
|
|
/// </summary>
|
|
[DataField]
|
|
public float IdlingTimeout = 60;
|
|
|
|
/// <summary>
|
|
/// Sets how long the telephone will stay in the hanging up state before return to idle
|
|
/// </summary>
|
|
[DataField]
|
|
public float HangingUpTimeout = 2;
|
|
|
|
/// <summary>
|
|
/// Tone played while the phone is ringing
|
|
/// </summary>
|
|
[DataField]
|
|
public SoundSpecifier? RingTone = null;
|
|
|
|
/// <summary>
|
|
/// Sets the number of seconds before the next ring tone is played
|
|
/// </summary>
|
|
[DataField]
|
|
public float RingInterval = 2f;
|
|
|
|
/// <summary>
|
|
/// The time at which the next tone will be played
|
|
/// </summary>
|
|
[DataField]
|
|
public TimeSpan NextRingToneTime;
|
|
|
|
/// <summary>
|
|
/// The volume at which relayed messages are played
|
|
/// </summary>
|
|
[DataField]
|
|
public TelephoneVolume SpeakerVolume = TelephoneVolume.Whisper;
|
|
|
|
/// <summary>
|
|
/// The range at which the telephone can connect to another
|
|
/// </summary>
|
|
[DataField]
|
|
public TelephoneRange TransmissionRange = TelephoneRange.Grid;
|
|
|
|
/// <summary>
|
|
/// The range at which the telephone picks up voices
|
|
/// </summary>
|
|
[DataField]
|
|
public float ListeningRange = 2;
|
|
|
|
/// <summary>
|
|
/// Specifies whether this telephone require power to fucntion
|
|
/// </summary>
|
|
[DataField]
|
|
public bool RequiresPower = true;
|
|
|
|
/// <summary>
|
|
/// This telephone does not appear on public telephone directories
|
|
/// </summary>
|
|
[DataField]
|
|
public bool UnlistedNumber = false;
|
|
|
|
/// <summary>
|
|
/// Telephone number for this device
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// For future use - a system for generating and handling telephone numbers has not been implemented yet
|
|
/// </remarks>
|
|
[ViewVariables]
|
|
public int TelephoneNumber = -1;
|
|
|
|
/// <summary>
|
|
/// Linked telephone
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public HashSet<Entity<TelephoneComponent>> LinkedTelephones = new();
|
|
|
|
/// <summary>
|
|
/// Defines the current state the telephone is in
|
|
/// </summary>
|
|
[ViewVariables, AutoNetworkedField]
|
|
public TelephoneState CurrentState = TelephoneState.Idle;
|
|
|
|
/// <summary>
|
|
/// The game tick the current state started
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public TimeSpan StateStartTime;
|
|
|
|
/// <summary>
|
|
/// Sets whether the telphone can pick up nearby speech
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public bool Muted = false;
|
|
|
|
/// <summary>
|
|
/// The presumed name and/or job of the last person to call this telephone
|
|
/// </summary>
|
|
[ViewVariables, AutoNetworkedField]
|
|
public (string?, string?) LastCallerId;
|
|
}
|
|
|
|
#region: Telephone events
|
|
|
|
/// <summary>
|
|
/// Raised when one telephone is attempting to call another
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public record struct TelephoneCallAttemptEvent(Entity<TelephoneComponent> Source, Entity<TelephoneComponent> Receiver, EntityUid? User)
|
|
{
|
|
public bool Cancelled = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Raised when a telephone's state changes
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public record struct TelephoneStateChangeEvent(TelephoneState OldState, TelephoneState NewState);
|
|
|
|
/// <summary>
|
|
/// Raised when communication between one telephone and another begins
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public record struct TelephoneCallCommencedEvent(Entity<TelephoneComponent> Receiver);
|
|
|
|
/// <summary>
|
|
/// Raised when a telephone hangs up
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public record struct TelephoneCallEndedEvent();
|
|
|
|
/// <summary>
|
|
/// Raised when a chat message is sent by a telephone to another
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public readonly record struct TelephoneMessageSentEvent(string Message, MsgChatMessage ChatMsg, EntityUid MessageSource);
|
|
|
|
/// <summary>
|
|
/// Raised when a chat message is received by a telephone from another
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public readonly record struct TelephoneMessageReceivedEvent(string Message, MsgChatMessage ChatMsg, EntityUid MessageSource, Entity<TelephoneComponent> TelephoneSource);
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// Options for tailoring telephone calls
|
|
/// </summary>
|
|
[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 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
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public enum TelephoneVisuals : byte
|
|
{
|
|
Key
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public enum TelephoneState : byte
|
|
{
|
|
Idle,
|
|
Calling,
|
|
Ringing,
|
|
InCall,
|
|
EndingCall
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public enum TelephoneVolume : byte
|
|
{
|
|
Whisper,
|
|
Speak
|
|
}
|
|
|
|
[Serializable, NetSerializable]
|
|
public enum TelephoneRange : byte
|
|
{
|
|
Grid, // Can call grid/map range telephones that are on the same grid
|
|
Map, // Can call grid/map range telephones that are on the same map
|
|
Long, // Can only long range telephones that are on a different map
|
|
Unlimited // Can call any telephone
|
|
}
|