From b8b61ebb026103d26a53f3b0afe949d69fb74143 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Mon, 15 Apr 2019 13:44:05 +0300 Subject: [PATCH] (a405d1aed) Check volume validity in SoundPlayer.UpdateWaterAmbience (there was a report on GameAnalytics about the method setting the gain to an invalid value) + Merge fix --- .../Source/Characters/Limb.cs | 1 - .../BarotraumaClient/Source/DebugConsole.cs | 25 +- .../Source/GameSession/CrewManager.cs | 1 - .../Source/Sounds/SoundPlayer.cs | 7 + .../AI/Objectives/AIObjectiveFindSafety.cs | 2 +- .../Items/Components/Machines/Controller.cs | 1 - .../BarotraumaShared/Source/Map/Hull.cs | 482 ------------------ 7 files changed, 9 insertions(+), 510 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs index 5e2696495..63beecb56 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs @@ -292,7 +292,6 @@ namespace Barotrauma if (!string.IsNullOrWhiteSpace(damageModifier.DamageSound)) { damageSoundType = damageModifier.DamageSound; - SoundPlayer.PlayDamageSound(damageSoundType, Math.Max(damage, bleedingDamage), WorldPosition); break; } } diff --git a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs index 0f3dd625c..18c1b7424 100644 --- a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs +++ b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs @@ -906,30 +906,7 @@ namespace Barotrauma { if (GameMain.Client != null) { - foreach (var mapEntity in MapEntity.SelectedList) - { - if (mapEntity is Item item) - { - item.Rect = new Rectangle(item.Rect.X, item.Rect.Y, - (int)(item.Prefab.sprite.size.X * item.Prefab.Scale), - (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale)); - } - else if (mapEntity is Structure structure) - { - if (!structure.ResizeHorizontal) - { - structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y, - (int)structure.Prefab.ScaledSize.X, - structure.Rect.Height); - } - if (!structure.ResizeVertical) - { - structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y, - structure.Rect.Width, - (int)structure.Prefab.ScaledSize.Y); - } - } - } + GameMain.Client.SendChatMessage(ToolBox.RandomSeed(msgLength)); } } })); diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index b8def88eb..cf7bebf10 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -4,7 +4,6 @@ using Barotrauma.Networking; using FarseerPhysics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using System; using System.Collections.Generic; using System.Linq; diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs b/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs index 5609902ab..0a1abe7ea 100644 --- a/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs +++ b/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs @@ -269,6 +269,13 @@ namespace Barotrauma } movementSoundVolume = Math.Max(movementSoundVolume, movementFactor); + if (!MathUtils.IsValid(movementSoundVolume)) + { + string errorMsg = "Failed to update water ambience volume - submarine's movement value invalid (" + movementSoundVolume + ", sub velocity: " + sub.Velocity + ")"; + DebugConsole.Log(errorMsg); + GameAnalyticsManager.AddErrorEventOnce("SoundPlayer.UpdateWaterAmbience:InvalidVolume", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); + movementSoundVolume = 0.0f; + } } if (waterAmbiences.Count > 1) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs index 6b735f0f5..77e9c5901 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs @@ -84,7 +84,7 @@ namespace Barotrauma { searchHullTimer -= deltaTime; } - else if (currenthullSafety < HumanAIController.HULL_SAFETY_THRESHOLD) + else { var bestHull = FindBestHull(); if (bestHull != null && bestHull != currentHull) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs index f9afc6f22..69a209f97 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs @@ -207,7 +207,6 @@ namespace Barotrauma.Items.Components cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, (focusTarget as Item).Prefab.OffsetOnSelected, deltaTime * 10.0f); HideHUDs(true); } - HideHUDs(true); #endif if (!character.IsRemotePlayer || character.ViewTarget == focusTarget) diff --git a/Barotrauma/BarotraumaShared/Source/Map/Hull.cs b/Barotrauma/BarotraumaShared/Source/Map/Hull.cs index 4b5a0fea4..4c3b594d6 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Hull.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Hull.cs @@ -63,488 +63,6 @@ namespace Barotrauma return "Hull"; } } - - [Editable, Serialize("", true)] - public string RoomName - { - get; - set; - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true)] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true)] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } - - public string DisplayName - { - get; - private set; - } - - private string roomName; - [Editable, Serialize("", true, translationTextTag: "RoomName.")] - public string RoomName - { - get { return roomName; } - set - { - if (roomName == value) { return; } - roomName = value; - DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName; - } - } public string DisplayName {