diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index 0b95e4306..c96a76c05 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -80,8 +80,8 @@ - - ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll + + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\GameAnalytics.Mono.dll ..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\lib\net45\MonoGame.Framework.dll @@ -101,7 +101,7 @@ - ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\System.Data.SQLite.dll + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\System.Data.SQLite.dll @@ -350,13 +350,13 @@ - - + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj index 797f42a80..b57d6b7cc 100644 --- a/Barotrauma/BarotraumaClient/MacClient.csproj +++ b/Barotrauma/BarotraumaClient/MacClient.csproj @@ -79,8 +79,8 @@ - - ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll + + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\GameAnalytics.Mono.dll ..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\lib\net45\MonoGame.Framework.dll @@ -100,7 +100,7 @@ - ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\System.Data.SQLite.dll + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\System.Data.SQLite.dll @@ -271,13 +271,12 @@ - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + - + - + + + \ No newline at end of file diff --git a/Barotrauma/BarotraumaClient/Source/GameMain.cs b/Barotrauma/BarotraumaClient/Source/GameMain.cs index e7c9ad2fa..a055efc07 100644 --- a/Barotrauma/BarotraumaClient/Source/GameMain.cs +++ b/Barotrauma/BarotraumaClient/Source/GameMain.cs @@ -891,7 +891,7 @@ namespace Barotrauma { if (NetworkMember != null) NetworkMember.Disconnect(); SteamManager.ShutDown(); - if (GameSettings.SendUserStatistics) GameAnalytics.OnStop(); + if (GameSettings.SendUserStatistics) GameAnalytics.OnQuit(); base.OnExiting(sender, args); } } diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index bf758c5ea..c2e36d361 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -505,7 +505,10 @@ namespace Barotrauma btn.OnClicked += (GUIButton button, object userData) => { - if (Character.Controlled == null || Character.Controlled.SpeechImpediment >= 100.0f) return false; +#if CLIENT + if (GameMain.Client != null && Character.Controlled == null) { return false; } +#endif + if (Character.Controlled != null && Character.Controlled.SpeechImpediment >= 100.0f) { return false; } if (btn.GetChildByUserData("selected").Visible) { @@ -919,7 +922,9 @@ namespace Barotrauma Font = GUI.SmallFont, OnClicked = (btn, userData) => { - if (Character.Controlled == null) return false; +#if CLIENT + if (GameMain.Client != null && Character.Controlled == null) { return false; } +#endif SetCharacterOrder(character, userData as Order, option, Character.Controlled); orderTargetFrame = null; OrderOptionButtons.Clear(); @@ -957,7 +962,9 @@ namespace Barotrauma UserData = item == null ? order : new Order(order, item, item.Components.FirstOrDefault(ic => ic.GetType() == order.ItemComponentType)), OnClicked = (btn, userData) => { - if (Character.Controlled == null) return false; +#if CLIENT + if (GameMain.Client != null && Character.Controlled == null) { return false; } +#endif SetCharacterOrder(character, userData as Order, option, Character.Controlled); orderTargetFrame = null; OrderOptionButtons.Clear(); diff --git a/Barotrauma/BarotraumaClient/Source/Networking/ServerSettings.cs b/Barotrauma/BarotraumaClient/Source/Networking/ServerSettings.cs index a4e27b2e1..2af9e3428 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/ServerSettings.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/ServerSettings.cs @@ -464,7 +464,8 @@ namespace Barotrauma.Networking ((GUIComponent)obj).Visible = !((GUIComponent)obj).Visible; return true; }; - + + InitMonstersEnabled(); List monsterNames = MonsterEnabled.Keys.ToList(); tempMonsterEnabled = new Dictionary(MonsterEnabled); foreach (string s in monsterNames) diff --git a/Barotrauma/BarotraumaClient/Source/Screens/CreditsPlayer.cs b/Barotrauma/BarotraumaClient/Source/Screens/CreditsPlayer.cs index e06a6db38..594fac1ca 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/CreditsPlayer.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/CreditsPlayer.cs @@ -9,7 +9,6 @@ namespace Barotrauma private GUIListBox listBox; private XElement configElement; - private RectTransform parent; private float scrollSpeed; diff --git a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs index 9c8731bbd..3fe290c8f 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs @@ -217,22 +217,6 @@ namespace Barotrauma return true; } - private bool RefreshJoinButtonState(GUIComponent component, object obj) - { - if (obj == null || waitingForRefresh) { return false; } - - if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text)) - { - joinButton.Enabled = true; - } - else - { - joinButton.Enabled = false; - } - - return true; - } - private bool SelectServer(GUIComponent component, object obj) { if (obj == null || waitingForRefresh || (!(obj is ServerInfo))) { return false; } diff --git a/Barotrauma/BarotraumaClient/WindowsClient.csproj b/Barotrauma/BarotraumaClient/WindowsClient.csproj index 3466d3dd7..dc6b33c63 100644 --- a/Barotrauma/BarotraumaClient/WindowsClient.csproj +++ b/Barotrauma/BarotraumaClient/WindowsClient.csproj @@ -80,8 +80,8 @@ - - ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll + + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\GameAnalytics.Mono.dll ..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\lib\net45\MonoGame.Framework.dll @@ -132,7 +132,7 @@ - ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\System.Data.SQLite.dll + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\System.Data.SQLite.dll @@ -306,13 +306,13 @@ - - + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + diff --git a/Barotrauma/BarotraumaClient/packages.config b/Barotrauma/BarotraumaClient/packages.config index d637bffbb..e593ce09a 100644 --- a/Barotrauma/BarotraumaClient/packages.config +++ b/Barotrauma/BarotraumaClient/packages.config @@ -1,6 +1,6 @@  - + diff --git a/Barotrauma/BarotraumaServer/Server.csproj b/Barotrauma/BarotraumaServer/Server.csproj index 99289cacd..6b66b1b69 100644 --- a/Barotrauma/BarotraumaServer/Server.csproj +++ b/Barotrauma/BarotraumaServer/Server.csproj @@ -149,7 +149,13 @@ true + + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\GameAnalytics.Mono.dll + + + ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\System.Data.SQLite.dll + @@ -163,12 +169,6 @@ ..\..\Libraries\NuGet\NLog.4.3.8\lib\net45\NLog.dll - - ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll - - - ..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\System.Data.SQLite.dll - ..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll @@ -293,5 +293,11 @@ - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + \ No newline at end of file diff --git a/Barotrauma/BarotraumaServer/Source/GameMain.cs b/Barotrauma/BarotraumaServer/Source/GameMain.cs index d14010a5f..f97944a3e 100644 --- a/Barotrauma/BarotraumaServer/Source/GameMain.cs +++ b/Barotrauma/BarotraumaServer/Source/GameMain.cs @@ -296,7 +296,7 @@ namespace Barotrauma CloseServer(); SteamManager.ShutDown(); - if (GameSettings.SendUserStatistics) GameAnalytics.OnStop(); + if (GameSettings.SendUserStatistics) GameAnalytics.OnQuit(); } public static void ResetFrameTime() diff --git a/Barotrauma/BarotraumaServer/Source/Items/Item.cs b/Barotrauma/BarotraumaServer/Source/Items/Item.cs index beb831abf..8e29b0a21 100644 --- a/Barotrauma/BarotraumaServer/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaServer/Source/Items/Item.cs @@ -193,7 +193,7 @@ namespace Barotrauma { if (GameMain.Server == null) return; - msg.Write(Prefab.Name); + msg.Write(Prefab.OriginalName); msg.Write(Prefab.Identifier); msg.Write(Description != prefab.Description); if (Description != prefab.Description) diff --git a/Barotrauma/BarotraumaServer/Source/Networking/RespawnManager.cs b/Barotrauma/BarotraumaServer/Source/Networking/RespawnManager.cs index 593bec08f..a27e15083 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/RespawnManager.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/RespawnManager.cs @@ -232,7 +232,7 @@ namespace Barotrauma.Networking //add the ID card tags they should've gotten when spawning in the shuttle foreach (Item item in character.Inventory.Items) { - if (item == null || item.Prefab.Name != "ID Card") continue; + if (item == null || item.Prefab.Identifier != "idcard") continue; foreach (string s in shuttleSpawnPoints[i].IdCardTags) { item.AddTag(s); diff --git a/Barotrauma/BarotraumaServer/Source/Networking/SteamManager.cs b/Barotrauma/BarotraumaServer/Source/Networking/SteamManager.cs index c0bbd0c9d..1bc7105a6 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/SteamManager.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/SteamManager.cs @@ -37,7 +37,7 @@ namespace Barotrauma.Steam public static bool RefreshServerDetails(Networking.GameServer server) { - if (instance == null || !instance.isInitialized) + if (instance?.server == null || !instance.isInitialized) { return false; } diff --git a/Barotrauma/BarotraumaServer/Source/Program.cs b/Barotrauma/BarotraumaServer/Source/Program.cs index f58204d7a..01070636e 100644 --- a/Barotrauma/BarotraumaServer/Source/Program.cs +++ b/Barotrauma/BarotraumaServer/Source/Program.cs @@ -35,7 +35,7 @@ namespace Barotrauma inputThread.Start(); game.Run(); inputThread.Abort(); inputThread.Join(); - if (GameSettings.SendUserStatistics) GameAnalytics.OnStop(); + if (GameSettings.SendUserStatistics) GameAnalytics.OnQuit(); SteamManager.ShutDown(); #if !DEBUG } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveManager.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveManager.cs index 19a21b7ff..ec1e63d2c 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveManager.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveManager.cs @@ -234,6 +234,7 @@ namespace Barotrauma switch (order.AITag.ToLowerInvariant()) { case "follow": + if (orderGiver == null) { return null; } newObjective = new AIObjectiveGoTo(orderGiver, character, this, repeat: true, priorityModifier: priorityModifier) { CloseEnough = 150, diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs index a33207b92..52d84e829 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs @@ -17,6 +17,12 @@ namespace Barotrauma { public abstract RagdollParams RagdollParams { get; protected set; } + const float ImpactDamageMultiplayer = 10.0f; + /// + /// Maximum damage per impact (0.1 = 10% of the character's maximum health) + /// + const float MaxImpactDamage = 0.1f; + private static List list = new List(); protected Hull currentHull; @@ -688,8 +694,10 @@ namespace Barotrauma Vector2 impactPos = ConvertUnits.ToDisplayUnits(points[0]); if (character.Submarine != null) impactPos += character.Submarine.Position; + float impactDamage = Math.Min((impact - ImpactTolerance) * ImpactDamageMultiplayer, character.MaxVitality * MaxImpactDamage); + character.LastDamageSource = null; - character.AddDamage(impactPos, new List() { AfflictionPrefab.InternalDamage.Instantiate((impact - ImpactTolerance) * 10.0f) }, 0.0f, true); + character.AddDamage(impactPos, new List() { AfflictionPrefab.InternalDamage.Instantiate(impactDamage) }, 0.0f, true); strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance); character.ApplyStatusEffects(ActionType.OnImpact, 1.0f); //briefly disable impact damage @@ -1303,13 +1311,6 @@ namespace Barotrauma } } } - foreach (Limb limb in Limbs) - { - limb.body.SetTransform(Collider.SimPosition, 0.0f); - limb.body.ResetDynamics(); - } - SetInitialLimbPositions(); - return false; } UpdateProjSpecific(deltaTime); } diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Health/Afflictions/AfflictionHusk.cs b/Barotrauma/BarotraumaShared/Source/Characters/Health/Afflictions/AfflictionHusk.cs index db7d465b2..234203834 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Health/Afflictions/AfflictionHusk.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Health/Afflictions/AfflictionHusk.cs @@ -217,7 +217,16 @@ namespace Barotrauma limb.body.AngularVelocity = matchingLimb.body.AngularVelocity; } } - for (int i = 0; i < character.Inventory.Items.Length; i++) + + if (character.Inventory.Items.Length != husk.Inventory.Items.Length) + { + string errorMsg = "Failed to move items from a human's inventory into a humanhusk's inventory (inventory sizes don't match)"; + DebugConsole.ThrowError(errorMsg); + GameAnalyticsManager.AddErrorEventOnce("AfflictionHusk.CreateAIHusk:InventoryMismatch", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); + yield return CoroutineStatus.Success; + } + + for (int i = 0; i < character.Inventory.Items.Length && i < husk.Inventory.Items.Length; i++) { if (character.Inventory.Items[i] == null) continue; husk.Inventory.TryPutItem(character.Inventory.Items[i], i, true, false, null); diff --git a/Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs b/Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs index 32e255691..7a47bff0e 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs @@ -159,8 +159,14 @@ namespace Barotrauma public void StartRound(Level level, bool reloadSub = true, bool loadSecondSub = false, bool mirrorLevel = false) { #if CLIENT - GameMain.LightManager.LosEnabled = GameMain.Client == null || GameMain.Client.CharacterInfo != null; - if (GameMain.Client == null) GameMain.LightManager.LosMode = GameMain.Config.LosMode; + if (GameMain.Client == null) + { + GameMain.LightManager.LosMode = GameMain.Config.LosMode; + } + else + { + GameMain.LightManager.LosEnabled = GameMain.Client.CharacterInfo != null; + } #endif this.Level = level; diff --git a/Barotrauma/BarotraumaShared/Source/Networking/ServerSettings.cs b/Barotrauma/BarotraumaShared/Source/Networking/ServerSettings.cs index 5dd5f1546..01ccc1c0e 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/ServerSettings.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/ServerSettings.cs @@ -656,7 +656,7 @@ namespace Barotrauma.Networking private set; } = new List>(); - public void ReadMonsterEnabled(NetBuffer inc) + private void InitMonstersEnabled() { //monster spawn settings if (MonsterEnabled == null) @@ -673,7 +673,11 @@ namespace Barotrauma.Networking if (!MonsterEnabled.ContainsKey(s)) MonsterEnabled.Add(s, true); } } + } + public void ReadMonsterEnabled(NetBuffer inc) + { + InitMonstersEnabled(); List monsterNames = MonsterEnabled.Keys.ToList(); foreach (string s in monsterNames) { @@ -681,7 +685,7 @@ namespace Barotrauma.Networking } inc.ReadPadBits(); } - + public void WriteMonsterEnabled(NetBuffer msg, Dictionary monsterEnabled = null) { //monster spawn settings @@ -703,13 +707,17 @@ namespace Barotrauma.Networking Dictionary extraCargo = new Dictionary(); for (int i = 0; i < count; i++) { + string prefabIdentifier = msg.ReadString(); string prefabName = msg.ReadString(); byte amount = msg.ReadByte(); - ItemPrefab ip = MapEntityPrefab.List.Find(p => p is ItemPrefab && p.Name.Equals(prefabName, StringComparison.InvariantCulture)) as ItemPrefab; - if (ip != null && amount > 0) + + var itemPrefab = string.IsNullOrEmpty(prefabIdentifier) ? + MapEntityPrefab.Find(prefabName, null, showErrorMessages: false) as ItemPrefab : + MapEntityPrefab.Find(prefabName, prefabIdentifier, showErrorMessages: false) as ItemPrefab; + if (itemPrefab != null && amount > 0) { - if (changed || !ExtraCargo.ContainsKey(ip) || ExtraCargo[ip] != amount) changed = true; - extraCargo.Add(ip, amount); + if (changed || !ExtraCargo.ContainsKey(itemPrefab) || ExtraCargo[itemPrefab] != amount) changed = true; + extraCargo.Add(itemPrefab, amount); } } if (changed) ExtraCargo = extraCargo; @@ -727,7 +735,9 @@ namespace Barotrauma.Networking msg.Write((UInt32)ExtraCargo.Count); foreach (KeyValuePair kvp in ExtraCargo) { - msg.Write(kvp.Key.Name); msg.Write((byte)kvp.Value); + msg.Write(kvp.Key.Identifier ?? ""); + msg.Write(kvp.Key.OriginalName ?? ""); + msg.Write((byte)kvp.Value); } } } diff --git a/Barotrauma/BarotraumaShared/Submarines/Remora.sub b/Barotrauma/BarotraumaShared/Submarines/Remora.sub index 6e3afa65c..26d37bd22 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Remora.sub and b/Barotrauma/BarotraumaShared/Submarines/Remora.sub differ diff --git a/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub b/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub index ec48ad330..49ade4d29 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub and b/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub differ