ModsMicMuteManager
A class in Root.Township, Alta.QuickAccessActions.
Network behaviour that lets moderators (developer status or above) mute the mics of normal players near them. The server relays requests; clients mute themselves. Reached through the static instance.
- Listed in Players and characters
- Inherits or implements
NetworkEntityBehaviour
Constructors
| Member | What it is |
|---|---|
ModsMicMuteManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
static ModsMicMuteManager instance | The manager in the scene. |
5 private and internal fields
| Member | What it is |
|---|---|
private static Logger logger | NLog logger for this class. |
private float muteDistanceSquared | Squared range of the moderator mute (400, so 20 m). |
private MethodSync syncOnConnected | Sync that sends the muting moderator list to a joining player. |
private MethodSyncStruct<ModMuteArgument> syncRequest | Sync for mute requests. |
private IUnityUpdateMethod updateMute | Handle for the registered mute check. |
Properties
| Member | What it is |
|---|---|
Dictionary<uint, Player> ModsMuting { get; } | Moderators muting now, by entity identifier. On the server the values are null. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Sets up the request and on connect syncs. |
override void OnConnected(Player player) | Server: sends the muting moderator list to a joining non-moderator player. |
void SendRequest(ModMuteArgument argument) | Sends a moderator's mute on or off request. Called by the mods mic mute quick access action. |
8 private and internal methods
| Member | What it is |
|---|---|
private void AddEntityAsModPlayer(NetworkEntity entity) | Records a moderator's player entity as muting. |
private void Awake() | Sets the static instance. |
private void DelayMute() | Starts the mute check if moderators are muting and it isn't running. |
private bool IsPlayerControllerMissing(PlayerController playerController) | True if the player controller is null or being destroyed. |
private void OnDestroy() | Stops the mute check. |
private void SyncOnConnected(IPlayer player, Stream stream) | Message handler for the moderator list sent on join; the client waits for each moderator to spawn, then starts checking. |
private void SyncRequest(IPlayer player, Stream stream, ModMuteArgument argument) | Message handler for mute requests. Server accepts only from moderators and relays; non-moderator clients start or stop muting. |
private void UpdateMute() | Budgeted update: mutes the local mic if any muting moderator's head is within muteDistanceSquared. |