Files
wwdpublic/Content.Server/Radio/Components/RadioMicrophoneComponent.cs
sleepyyapril 5eb30586c9 Handheld Frequencies (#1574)
<!--
This is a semi-strict format, you can add/remove sections as needed but
the order/format should be kept the same
Remove these comments before submitting
-->

# Description

<!--
Explain this PR in as much detail as applicable

Some example prompts to consider:
How might this affect the game? The codebase?
What might be some alternatives to this?
How/Who does this benefit/hurt [the game/codebase]?
-->

Adds frequencies to handheld radios. Ports [this
PR](https://github.com/new-frontiers-14/frontier-station-14/pull/1833)
with changes.

![image](https://github.com/user-attachments/assets/e39d8fce-7fa3-4e0a-918a-506b0446de35)

---

# Changelog

<!--
You can add an author after the `🆑` to change the name that appears
in the changelog (ex: `🆑 Death`)
Leaving it blank will default to your GitHub display name
This includes all available types for the changelog
-->

🆑
- add: Added handheld radio frequencies, accessible by pressing your
"Use Item" key while holding one.

---------

Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com>
(cherry picked from commit 19a350fc9ae0d958406b3d6018f71ab8af5447c4)
2025-01-20 20:50:30 +03:00

51 lines
1.6 KiB
C#

using Content.Server.Radio.EntitySystems;
using Content.Shared.Chat;
using Content.Shared.Radio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Server.Radio.Components;
/// <summary>
/// Listens for local chat messages and relays them to some radio frequency
/// </summary>
[RegisterComponent]
[Access(typeof(RadioDeviceSystem))]
public sealed partial class RadioMicrophoneComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("broadcastChannel", customTypeSerializer: typeof(PrototypeIdSerializer<RadioChannelPrototype>))]
public string BroadcastChannel = SharedChatSystem.CommonChannel;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("listenRange")]
public int ListenRange = 4;
[DataField("enabled")]
public bool Enabled = false;
[DataField("powerRequired")]
public bool PowerRequired = false;
/// <summary>
/// Whether or not interacting with this entity
/// toggles it on or off.
/// </summary>
[DataField("toggleOnInteract")]
public bool ToggleOnInteract = true;
/// <summary>
/// Whether or not the speaker must have an
/// unobstructed path to the radio to speak
/// </summary>
[DataField("unobstructedRequired")]
public bool UnobstructedRequired = false;
// Nuclear-14
/// <summary>
// The radio frequency on which the message will be transmitted
/// </summary>
[DataField]
public int Frequency = 1459; // Common channel frequency
}