Good Intercoms (#17950)
* crystal anomaly * Good intercoms * fixes * fix construction fail * Revert "crystal anomaly" This reverts commit 0d9e3f62ff82c79e72f882b9c7f4ca1b9c6e6dd8. * migration
This commit is contained in:
23
Content.Shared/Radio/Components/IntercomComponent.cs
Normal file
23
Content.Shared/Radio/Components/IntercomComponent.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
|
||||
namespace Content.Shared.Radio.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Handles intercom ui and is authoritative on the channels an intercom can access.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class IntercomComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Does this intercom require popwer to function
|
||||
/// </summary>
|
||||
[DataField("requiresPower"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool RequiresPower = true;
|
||||
|
||||
/// <summary>
|
||||
/// The list of radio channel prototypes this intercom can choose between.
|
||||
/// </summary>
|
||||
[DataField("supportedChannels", customTypeSerializer: typeof(PrototypeIdListSerializer<RadioChannelPrototype>))]
|
||||
public List<string> SupportedChannels = new();
|
||||
}
|
||||
@@ -5,11 +5,13 @@ namespace Content.Shared.Radio;
|
||||
[Serializable, NetSerializable]
|
||||
public enum RadioDeviceVisuals : byte
|
||||
{
|
||||
Broadcasting
|
||||
Broadcasting,
|
||||
Speaker
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum RadioDeviceVisualLayers : byte
|
||||
{
|
||||
Broadcasting
|
||||
Broadcasting,
|
||||
Speaker
|
||||
}
|
||||
|
||||
59
Content.Shared/Radio/SharedIntercom.cs
Normal file
59
Content.Shared/Radio/SharedIntercom.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Radio;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum IntercomUiKey
|
||||
{
|
||||
Key,
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class IntercomBoundUIState : BoundUserInterfaceState
|
||||
{
|
||||
public bool MicEnabled;
|
||||
public bool SpeakerEnabled;
|
||||
public List<string> AvailableChannels;
|
||||
public string SelectedChannel;
|
||||
|
||||
public IntercomBoundUIState(bool micEnabled, bool speakerEnabled, List<string> availableChannels, string selectedChannel)
|
||||
{
|
||||
MicEnabled = micEnabled;
|
||||
SpeakerEnabled = speakerEnabled;
|
||||
AvailableChannels = availableChannels;
|
||||
SelectedChannel = selectedChannel;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class ToggleIntercomMicMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public bool Enabled;
|
||||
|
||||
public ToggleIntercomMicMessage(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class ToggleIntercomSpeakerMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public bool Enabled;
|
||||
|
||||
public ToggleIntercomSpeakerMessage(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class SelectIntercomChannelMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public string Channel;
|
||||
|
||||
public SelectIntercomChannelMessage(string channel)
|
||||
{
|
||||
Channel = channel;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user