public void UnregisterQueue(VoipQueue queue) { if (queues.Contains(queue)) { queues.Remove(queue); } }
partial void DisposeProjSpecific() { GameMain.Server.VoipServer.UnregisterQueue(VoipQueue); VoipQueue.Dispose(); characterInfo?.Remove(); characterInfo = null; }
public void RegisterQueue(VoipQueue queue) { if (!queues.Contains(queue)) { queues.Add(queue); } }
partial void InitProjSpecific() { JobPreferences = new List <JobPrefab>(JobPrefab.List.GetRange(0, Math.Min(JobPrefab.List.Count, 3))); VoipQueue = new VoipQueue(ID, true, true); GameMain.Server.VoipServer.RegisterQueue(VoipQueue); }
partial void InitProjSpecific() { JobPreferences = new List <Pair <JobPrefab, int> >(); VoipQueue = new VoipQueue(ID, true, true); GameMain.Server.VoipServer.RegisterQueue(VoipQueue); //initialize to infinity, gets set to a proper value when initializing midround syncing MidRoundSyncTimeOut = double.PositiveInfinity; }
partial void InitProjSpecific() { var jobs = JobPrefab.List.Values.ToList(); // TODO: modding support? JobPreferences = new List <Pair <JobPrefab, int> >(jobs.GetRange(0, Math.Min(jobs.Count, 3)).Select(j => new Pair <JobPrefab, int>(j, 0))); VoipQueue = new VoipQueue(ID, true, true); GameMain.Server.VoipServer.RegisterQueue(VoipQueue); }
partial void InitProjSpecific() { VoipQueue = null; VoipSound = null; if (ID == GameMain.Client.ID) { return; } VoipQueue = new VoipQueue(ID, false, true); GameMain.Client?.VoipClient?.RegisterQueue(VoipQueue); VoipSound = null; }
public void RegisterQueue(VoipQueue queue) { if (queue == VoipCapture.Instance) { return; } if (!queues.Contains(queue)) { queues.Add(queue); } }
partial void InitProjSpecific() { var jobs = JobPrefab.Prefabs.ToList(); // TODO: modding support? JobPreferences = new List <Pair <JobPrefab, int> >(jobs.GetRange(0, Math.Min(jobs.Count, 3)).Select(j => new Pair <JobPrefab, int>(j, 0))); VoipQueue = new VoipQueue(ID, true, true); GameMain.Server.VoipServer.RegisterQueue(VoipQueue); //initialize to infinity, gets set to a proper value when initializing midround syncing MidRoundSyncTimeOut = double.PositiveInfinity; }
public void Read(NetBuffer msg) { byte queueId = msg.ReadByte(); VoipQueue queue = queues.Find(q => q.QueueID == queueId); if (queue == null) { #if DEBUG DebugConsole.NewMessage("Couldn't find VoipQueue with id " + queueId.ToString() + "!", Color.Red); #endif return; } if (queue.Read(msg)) { Client client = gameClient.ConnectedClients.Find(c => c.VoipQueue == queue); if (client.Muted || client.MutedLocally) { return; } if (client.VoipSound == null) { DebugConsole.Log("Recreating voipsound " + queueId); client.VoipSound = new VoipSound(GameMain.SoundManager, client.VoipQueue); } if (client.Character != null && !client.Character.IsDead && !client.Character.IsDead && client.Character.SpeechImpediment <= 100.0f) { var messageType = ChatMessage.CanUseRadio(client.Character, out WifiComponent radio) ? ChatMessageType.Radio : ChatMessageType.Default; client.Character.ShowSpeechBubble(1.25f, ChatMessage.MessageColor[(int)messageType]); client.VoipSound.UseRadioFilter = messageType == ChatMessageType.Radio; if (client.VoipSound.UseRadioFilter) { client.VoipSound.SetRange(radio.Range * 0.8f, radio.Range); } else { client.VoipSound.SetRange(ChatMessage.SpeakRange * 0.4f, ChatMessage.SpeakRange); } if (!client.VoipSound.UseRadioFilter && Character.Controlled != null) { client.VoipSound.UseMuffleFilter = SoundPlayer.ShouldMuffleSound(Character.Controlled, client.Character.WorldPosition, ChatMessage.SpeakRange, client.Character.CurrentHull); } } GameMain.NetLobbyScreen.SetPlayerSpeaking(client); GameMain.GameSession?.CrewManager?.SetPlayerSpeaking(client); } }
partial void DisposeProjSpecific() { GameMain.Server.VoipServer.UnregisterQueue(VoipQueue); VoipQueue.Dispose(); }
public void Read(IReadMessage msg) { byte queueId = msg.ReadByte(); VoipQueue queue = queues.Find(q => q.QueueID == queueId); if (queue == null) { #if DEBUG DebugConsole.NewMessage("Couldn't find VoipQueue with id " + queueId.ToString() + "!", GUI.Style.Red); #endif return; } Client client = gameClient.ConnectedClients.Find(c => c.VoipQueue == queue); if (queue.Read(msg, discardData: client.Muted || client.MutedLocally)) { if (client.Muted || client.MutedLocally) { return; } if (client.VoipSound == null) { DebugConsole.Log("Recreating voipsound " + queueId); client.VoipSound = new VoipSound(client.Name, GameMain.SoundManager, client.VoipQueue); } if (client.Character != null && !client.Character.IsDead && !client.Character.Removed && client.Character.SpeechImpediment <= 100.0f) { WifiComponent radio = null; var messageType = !client.VoipQueue.ForceLocal && ChatMessage.CanUseRadio(client.Character, out radio) ? ChatMessageType.Radio : ChatMessageType.Default; client.Character.ShowSpeechBubble(1.25f, ChatMessage.MessageColor[(int)messageType]); client.VoipSound.UseRadioFilter = messageType == ChatMessageType.Radio && !GameMain.Config.DisableVoiceChatFilters; if (client.VoipSound.UseRadioFilter) { client.VoipSound.SetRange(radio.Range * 0.8f, radio.Range); } else { client.VoipSound.SetRange(ChatMessage.SpeakRange * 0.4f, ChatMessage.SpeakRange); } if (!client.VoipSound.UseRadioFilter && Character.Controlled != null && !GameMain.Config.DisableVoiceChatFilters) { client.VoipSound.UseMuffleFilter = SoundPlayer.ShouldMuffleSound(Character.Controlled, client.Character.WorldPosition, ChatMessage.SpeakRange, client.Character.CurrentHull); } } GameMain.NetLobbyScreen?.SetPlayerSpeaking(client); GameMain.GameSession?.CrewManager?.SetClientSpeaking(client); if ((client.VoipSound.CurrentAmplitude * client.VoipSound.Gain * GameMain.SoundManager.GetCategoryGainMultiplier("voip")) > 0.1f) //TODO: might need to tweak { if (client.Character != null && !client.Character.Removed) { Vector3 clientPos = new Vector3(client.Character.WorldPosition.X, client.Character.WorldPosition.Y, 0.0f); Vector3 listenerPos = GameMain.SoundManager.ListenerPosition; float attenuationDist = client.VoipSound.Near * 1.125f; if (Vector3.DistanceSquared(clientPos, listenerPos) < attenuationDist * attenuationDist) { GameMain.SoundManager.VoipAttenuatedGain = 0.5f; } } else { GameMain.SoundManager.VoipAttenuatedGain = 0.5f; } } } }