Update radio prefix parsing (#13777)
This commit is contained in:
22
Content.Shared/Radio/Components/EncryptionKeyComponent.cs
Normal file
22
Content.Shared/Radio/Components/EncryptionKeyComponent.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Content.Shared.Chat;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
|
||||
|
||||
namespace Content.Shared.Radio.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This component is currently used for providing access to channels for "HeadsetComponent"s.
|
||||
/// It should be used for intercoms and other radios in future.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class EncryptionKeyComponent : Component
|
||||
{
|
||||
[DataField("channels", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<RadioChannelPrototype>))]
|
||||
public HashSet<string> Channels = new();
|
||||
|
||||
/// <summary>
|
||||
/// This is the channel that will be used when using the default/department prefix (<see cref="SharedChatSystem.DefaultChannelKey"/>).
|
||||
/// </summary>
|
||||
[DataField("defaultChannel", customTypeSerializer: typeof(PrototypeIdSerializer<RadioChannelPrototype>))]
|
||||
public readonly string? DefaultChannel;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Tools;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.Radio.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This component is by entities that can contain encryption keys
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class EncryptionKeyHolderComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether or not encryption keys can be removed from the headset.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("keysUnlocked")]
|
||||
public bool KeysUnlocked = true;
|
||||
|
||||
/// <summary>
|
||||
/// The tool required to extract the encryption keys from the headset.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("keysExtractionMethod", customTypeSerializer: typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
|
||||
public string KeysExtractionMethod = "Screwing";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("keySlots")]
|
||||
public int KeySlots = 2;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("keyExtractionSound")]
|
||||
public SoundSpecifier KeyExtractionSound = new SoundPathSpecifier("/Audio/Items/pistol_magout.ogg");
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("keyInsertionSound")]
|
||||
public SoundSpecifier KeyInsertionSound = new SoundPathSpecifier("/Audio/Items/pistol_magin.ogg");
|
||||
|
||||
[ViewVariables]
|
||||
public Container KeyContainer = default!;
|
||||
public const string KeyContainerName = "key_slots";
|
||||
|
||||
/// <summary>
|
||||
/// Combined set of radio channels provided by all contained keys.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public HashSet<string> Channels = new();
|
||||
|
||||
/// <summary>
|
||||
/// This is the channel that will be used when using the default/department prefix (<see cref="SharedChatSystem.DefaultChannelKey"/>).
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public string? DefaultChannel;
|
||||
}
|
||||
18
Content.Shared/Radio/Components/HeadsetComponent.cs
Normal file
18
Content.Shared/Radio/Components/HeadsetComponent.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Content.Shared.Inventory;
|
||||
|
||||
namespace Content.Shared.Radio.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This component relays radio messages to the parent entity's chat when equipped.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class HeadsetComponent : Component
|
||||
{
|
||||
[DataField("enabled")]
|
||||
public bool Enabled = true;
|
||||
|
||||
public bool IsEquipped = false;
|
||||
|
||||
[DataField("requiredSlot")]
|
||||
public SlotFlags RequiredSlot = SlotFlags.EARS;
|
||||
}
|
||||
Reference in New Issue
Block a user