Skip to main content

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.

Constructors​

MemberWhat it is
ModsMicMuteManager()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
static ModsMicMuteManager instanceThe manager in the scene.
5 private and internal fields
MemberWhat it is
private static Logger loggerNLog logger for this class.
private float muteDistanceSquaredSquared range of the moderator mute (400, so 20 m).
private MethodSync syncOnConnectedSync that sends the muting moderator list to a joining player.
private MethodSyncStruct<ModMuteArgument> syncRequestSync for mute requests.
private IUnityUpdateMethod updateMuteHandle for the registered mute check.

Properties​

MemberWhat it is
Dictionary<uint, Player> ModsMuting { get; }Moderators muting now, by entity identifier. On the server the values are null.

Methods​

MemberWhat 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
MemberWhat 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.