diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 116e9e01d..6c0e60891 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -73,7 +73,7 @@ body: label: Version description: Which version of the game did the bug happen in? You can see the current version number in the bottom left corner of your screen in the main menu. options: - - v1.2.6.0 (Winter Update) + - v1.2.7.0 (Winter Update hotfix) - Other validations: required: true diff --git a/Barotrauma/BarotraumaClient/ClientSource/DebugConsole.cs b/Barotrauma/BarotraumaClient/ClientSource/DebugConsole.cs index 6be290ce4..c075978f0 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/DebugConsole.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/DebugConsole.cs @@ -1402,7 +1402,7 @@ namespace Barotrauma { if (!(MapEntityPrefab.Find(null, deconstructItem.ItemIdentifier, showErrorMessages: false) is ItemPrefab targetItem)) { - ThrowError("Error in item \"" + itemPrefab.Name + "\" - could not find deconstruct item \"" + deconstructItem.ItemIdentifier + "\"!"); + ThrowErrorLocalized("Error in item \"" + itemPrefab.Name + "\" - could not find deconstruct item \"" + deconstructItem.ItemIdentifier + "\"!"); continue; } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Items/Item.cs b/Barotrauma/BarotraumaClient/ClientSource/Items/Item.cs index 1633cf7bc..6552ba373 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Items/Item.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Item.cs @@ -536,7 +536,7 @@ namespace Barotrauma rotation: RotationRad, clr: Color.White, depth: 0, - thickness: 2f / Screen.Selected.Cam.Zoom); + thickness: Math.Max(2f / Screen.Selected.Cam.Zoom, 1)); foreach (Rectangle t in Prefab.Triggers) { diff --git a/Barotrauma/BarotraumaClient/ClientSource/Map/Hull.cs b/Barotrauma/BarotraumaClient/ClientSource/Map/Hull.cs index b4786982f..a3ab80804 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Map/Hull.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Map/Hull.cs @@ -218,6 +218,7 @@ namespace Barotrauma { if (primaryMouseButtonHeld) { + ShowHulls = true; hull.WaterVolume += 100000.0f * deltaTime; hull.networkUpdatePending = true; hull.serverUpdateDelay = 0.5f; diff --git a/Barotrauma/BarotraumaClient/ClientSource/Map/Submarine.cs b/Barotrauma/BarotraumaClient/ClientSource/Map/Submarine.cs index 3d9e53dc6..9cf47521f 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Map/Submarine.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Map/Submarine.cs @@ -499,6 +499,13 @@ namespace Barotrauma } } + if (Hull.HullList.Any(h => h.WaterVolume > 0.0f)) + { + errorMsgs.Add(TextManager.Get("WaterInHullsWarning").Value); + warnings.Add(SubEditorScreen.WarningType.WaterInHulls); + Hull.ShowHulls = true; + } + if (Info.Type == SubmarineType.Player) { foreach (Item item in Item.ItemList) diff --git a/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs index 2b9c41301..ef16d6ca7 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Networking/GameClient.cs @@ -1599,7 +1599,7 @@ namespace Barotrauma.Networking } catch (Exception e) { - DebugConsole.ThrowError("There was an error initializing the round.", e, true); + DebugConsole.ThrowError("There was an error initializing the round.", e, createMessageBox: true); roundInitStatus = RoundInitStatus.Error; break; } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Particles/ParticleManager.cs b/Barotrauma/BarotraumaClient/ClientSource/Particles/ParticleManager.cs index 37c906798..457755dfa 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Particles/ParticleManager.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Particles/ParticleManager.cs @@ -27,10 +27,9 @@ namespace Barotrauma.Particles get { return maxParticles; } set { - if (maxParticles == value || value < 4) return; + if (maxParticles == value || value < 4) { return; } Particle[] newParticles = new Particle[value]; - for (int i = 0; i < Math.Min(maxParticles, value); i++) { newParticles[i] = particles[i]; @@ -39,6 +38,16 @@ namespace Barotrauma.Particles particleCount = Math.Min(particleCount, value); particles = newParticles; maxParticles = value; + + var oldParticlesInCreationOrder = particlesInCreationOrder.ToList(); + particlesInCreationOrder.Clear(); + foreach (var particle in oldParticlesInCreationOrder) + { + if (particles.Contains(particle)) + { + particlesInCreationOrder.AddLast(particle); + } + } } } private Particle[] particles; diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/CharacterEditor/CharacterEditorScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/CharacterEditor/CharacterEditorScreen.cs index f93163433..7dc80f765 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/CharacterEditor/CharacterEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/CharacterEditor/CharacterEditorScreen.cs @@ -1219,7 +1219,7 @@ namespace Barotrauma.CharacterEditor { if (RagdollParams.Joints.Any(j => j.Limb1 == fromLimb && j.Limb2 == toLimb)) { - DebugConsole.ThrowError(GetCharacterEditorTranslation("ExistingJointFound").Replace("[limbid1]", fromLimb.ToString()).Replace("[limbid2]", toLimb.ToString())); + DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("ExistingJointFound").Replace("[limbid1]", fromLimb.ToString()).Replace("[limbid2]", toLimb.ToString())); return; } if (RagdollParams.MainElement == null) @@ -1239,7 +1239,7 @@ namespace Barotrauma.CharacterEditor var lastJointElement = RagdollParams.MainElement.GetChildElements("joint").LastOrDefault() ?? RagdollParams.MainElement.GetChildElements("limb").LastOrDefault(); if (lastJointElement == null) { - DebugConsole.ThrowError(GetCharacterEditorTranslation("CantAddJointsNoLimbElements")); + DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("CantAddJointsNoLimbElements")); return; } lastJointElement.AddAfterSelf(newJointElement); @@ -1271,7 +1271,7 @@ namespace Barotrauma.CharacterEditor { if (character.IsHumanoid) { - DebugConsole.ThrowError(GetCharacterEditorTranslation("HumanoidLimbDeletionDisabled")); + DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("HumanoidLimbDeletionDisabled")); break; } var limb = selectedLimbs[i]; @@ -1675,7 +1675,7 @@ namespace Barotrauma.CharacterEditor if (contentPackage == null) { // This should not be possible. - DebugConsole.ThrowError(GetCharacterEditorTranslation("NoContentPackageSelected")); + DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("NoContentPackageSelected")); return false; } if (vanilla != null && contentPackage == vanilla) @@ -2898,7 +2898,7 @@ namespace Barotrauma.CharacterEditor } catch (Exception e) { - DebugConsole.ThrowError(GetCharacterEditorTranslation("CouldntOpenDirectory").Replace("[folder]", RagdollParams.Folder), e); + DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("CouldntOpenDirectory").Replace("[folder]", RagdollParams.Folder), e); } } PopulateListBox(); @@ -2932,7 +2932,7 @@ namespace Barotrauma.CharacterEditor } catch (Exception e) { - DebugConsole.ThrowError(TextManager.Get("DeleteFileError").Replace("[file]", selectedFile), e); + DebugConsole.ThrowErrorLocalized(TextManager.Get("DeleteFileError").Replace("[file]", selectedFile), e); } msgBox.Close(); listBox.ClearChildren(); @@ -3058,7 +3058,7 @@ namespace Barotrauma.CharacterEditor } catch (Exception e) { - DebugConsole.ThrowError(GetCharacterEditorTranslation("CouldntOpenDirectory").Replace("[folder]", CurrentAnimation.Folder), e); + DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("CouldntOpenDirectory").Replace("[folder]", CurrentAnimation.Folder), e); } } PopulateListBox(); @@ -3092,7 +3092,7 @@ namespace Barotrauma.CharacterEditor } catch (Exception e) { - DebugConsole.ThrowError(TextManager.GetWithVariable("DeleteFileError", "[file]", selectedFile), e); + DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariable("DeleteFileError", "[file]", selectedFile), e); } msgBox.Close(); PopulateListBox(); @@ -3129,7 +3129,7 @@ namespace Barotrauma.CharacterEditor humanAnimController.SwimFastParams = HumanSwimFastParams.GetAnimParams(character, fileName); break; default: - DebugConsole.ThrowError(GetCharacterEditorTranslation("AnimationTypeNotImplemented").Replace("[type]", selectedType.ToString())); + DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("AnimationTypeNotImplemented").Replace("[type]", selectedType.ToString())); break; } } @@ -3150,7 +3150,7 @@ namespace Barotrauma.CharacterEditor character.AnimController.SwimFastParams = FishSwimFastParams.GetAnimParams(character, fileName); break; default: - DebugConsole.ThrowError(GetCharacterEditorTranslation("AnimationTypeNotImplemented").Replace("[type]", selectedType.ToString())); + DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("AnimationTypeNotImplemented").Replace("[type]", selectedType.ToString())); break; } } @@ -3548,7 +3548,7 @@ namespace Barotrauma.CharacterEditor } else { - DebugConsole.ThrowError(GetCharacterEditorTranslation("NoFieldForParameterFound").Replace("[parameter]", name.Value)); + DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("NoFieldForParameterFound").Replace("[parameter]", name.Value)); } } } diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs index 646c04ed5..a8a5b1701 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs @@ -80,7 +80,8 @@ namespace Barotrauma WallCount, ItemCount, LightCount, - ShadowCastingLightCount + ShadowCastingLightCount, + WaterInHulls } public static Vector2 MouseDragStart = Vector2.Zero; @@ -1320,7 +1321,7 @@ namespace Barotrauma } catch (Exception e) { - DebugConsole.ThrowError(TextManager.GetWithVariable("DeleteFileError", "[file]", assemblyPrefab.Name), e); + DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariable("DeleteFileError", "[file]", assemblyPrefab.Name), e); } return true; }; @@ -1560,7 +1561,9 @@ namespace Barotrauma if (editorSelectedTime.TryUnwrap(out DateTime selectedTime)) { TimeSpan timeInEditor = DateTime.Now - selectedTime; - if (timeInEditor.TotalSeconds > Timing.TotalTime) + //this is intended for diagnosing why the "x hours in editor" achievement seems to sometimes trigger too soon + //require the time in editor to be x1.5 higher to disregard any rounding errors or discrepancies in Datetime.Now and the game's own timekeeping + if (timeInEditor.TotalSeconds > Timing.TotalTime * 1.5) { DebugConsole.ThrowErrorAndLogToGA( "SubEditorScreen.DeselectEditorSpecific:InvalidTimeInEditor", @@ -3714,7 +3717,7 @@ namespace Barotrauma } catch (Exception e) { - DebugConsole.ThrowError(TextManager.GetWithVariable("DeleteFileError", "[file]", sub.FilePath), e); + DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariable("DeleteFileError", "[file]", sub.FilePath), e); } return true; }; @@ -5202,9 +5205,7 @@ namespace Barotrauma SkipInventorySlotUpdate = false; ImageManager.Update((float)deltaTime); -#if DEBUG Hull.UpdateCheats((float)deltaTime, cam); -#endif if (GameMain.GraphicsWidth != screenResolution.X || GameMain.GraphicsHeight != screenResolution.Y) { diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj index 3c82dcebe..b2fe621db 100644 --- a/Barotrauma/BarotraumaClient/LinuxClient.csproj +++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.2.6.0 + 1.2.7.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj index 8b874e7ae..95a6177e9 100644 --- a/Barotrauma/BarotraumaClient/MacClient.csproj +++ b/Barotrauma/BarotraumaClient/MacClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.2.6.0 + 1.2.7.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaClient/WindowsClient.csproj b/Barotrauma/BarotraumaClient/WindowsClient.csproj index 47cd54dbd..f83fc3c06 100644 --- a/Barotrauma/BarotraumaClient/WindowsClient.csproj +++ b/Barotrauma/BarotraumaClient/WindowsClient.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma - 1.2.6.0 + 1.2.7.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 Barotrauma diff --git a/Barotrauma/BarotraumaServer/LinuxServer.csproj b/Barotrauma/BarotraumaServer/LinuxServer.csproj index 06f6a5f3f..7d308cb7b 100644 --- a/Barotrauma/BarotraumaServer/LinuxServer.csproj +++ b/Barotrauma/BarotraumaServer/LinuxServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.2.6.0 + 1.2.7.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/MacServer.csproj b/Barotrauma/BarotraumaServer/MacServer.csproj index 4f0888ea8..f206e053c 100644 --- a/Barotrauma/BarotraumaServer/MacServer.csproj +++ b/Barotrauma/BarotraumaServer/MacServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.2.6.0 + 1.2.7.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaServer/ServerSource/GameMain.cs b/Barotrauma/BarotraumaServer/ServerSource/GameMain.cs index 7c07d532a..ab5fb76a8 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/GameMain.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/GameMain.cs @@ -126,7 +126,7 @@ namespace Barotrauma { if (Version < VanillaContent.GameVersion) { - DebugConsole.ThrowError( + DebugConsole.ThrowErrorLocalized( TextManager.GetWithVariables("versionmismatchwarning", ("[gameversion]", Version.ToString()), ("[contentversion]", VanillaContent.GameVersion.ToString()))); diff --git a/Barotrauma/BarotraumaServer/WindowsServer.csproj b/Barotrauma/BarotraumaServer/WindowsServer.csproj index 99afbb8c9..42dc9b4e4 100644 --- a/Barotrauma/BarotraumaServer/WindowsServer.csproj +++ b/Barotrauma/BarotraumaServer/WindowsServer.csproj @@ -6,7 +6,7 @@ Barotrauma FakeFish, Undertow Games Barotrauma Dedicated Server - 1.2.6.0 + 1.2.7.0 Copyright © FakeFish 2018-2023 AnyCPU;x64 DedicatedServer diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveGetItem.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveGetItem.cs index 1ed1fe400..963be9a2b 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveGetItem.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveGetItem.cs @@ -454,6 +454,7 @@ namespace Barotrauma if (!itemInventory.Container.HasRequiredItems(character, addMessage: false)) { continue; } } float itemPriority = item.Prefab.BotPriority; + if (itemPriority <= 0) { continue; } if (GetItemPriority != null) { itemPriority *= GetItemPriority(item); diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveManager.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveManager.cs index b636c9219..6c4b671f2 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveManager.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/AI/Objectives/AIObjectiveManager.cs @@ -172,6 +172,10 @@ namespace Barotrauma continue; } } + if (autonomousObjective.IgnoreAtNonOutpost && !Level.IsLoadedFriendlyOutpost) + { + continue; + } var objective = CreateObjective(order, autonomousObjective.PriorityModifier); if (objective != null && objective.CanBeCompleted) { diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs index abab4a0c6..628e91e55 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/Ragdoll.cs @@ -741,28 +741,32 @@ namespace Barotrauma { Stairs = character.SelectedBy.AnimController.Stairs; } + + var collisionResponse = getStairCollisionResponse(); + if (collisionResponse == LimbStairCollisionResponse.ClimbWithLimbCollision) + { + Stairs = structure; + } else { - var collisionResponse = handleLimbStairCollision(); - if (collisionResponse == LimbStairCollisionResponse.ClimbWithLimbCollision) - { - Stairs = structure; - } - else - { - if (collisionResponse == LimbStairCollisionResponse.DontClimbStairs) { Stairs = null; } + if (collisionResponse == LimbStairCollisionResponse.DontClimbStairs) { Stairs = null; } - return false; - } - } + return false; + } - LimbStairCollisionResponse handleLimbStairCollision() + LimbStairCollisionResponse getStairCollisionResponse() { //don't collide with stairs if //1. bottom of the collider is at the bottom of the stairs and the character isn't trying to move upwards float stairBottomPos = ConvertUnits.ToSimUnits(structure.Rect.Y - structure.Rect.Height + 10); if (colliderBottom.Y < stairBottomPos && targetMovement.Y < 0.5f) { return LimbStairCollisionResponse.DontClimbStairs; } + if (character.SelectedBy != null && + character.SelectedBy.AnimController.GetColliderBottom().Y < stairBottomPos && + character.SelectedBy.AnimController.targetMovement.Y < 0.5f) + { + return LimbStairCollisionResponse.DontClimbStairs; + } //2. bottom of the collider is at the top of the stairs and the character isn't trying to move downwards if (targetMovement.Y >= 0.0f && colliderBottom.Y >= ConvertUnits.ToSimUnits(structure.Rect.Y - Submarine.GridSize.Y * 5)) { return LimbStairCollisionResponse.DontClimbStairs; } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/Afflictions/AfflictionPrefab.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/Afflictions/AfflictionPrefab.cs index 035a8c9ae..2e760b73d 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/Afflictions/AfflictionPrefab.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Health/Afflictions/AfflictionPrefab.cs @@ -904,7 +904,7 @@ namespace Barotrauma string indicatorLimbName = element.GetAttributeString("indicatorlimb", "Torso"); if (!Enum.TryParse(indicatorLimbName, out IndicatorLimb)) { - DebugConsole.ThrowError("Error in affliction prefab " + Name + " - limb type \"" + indicatorLimbName + "\" not found."); + DebugConsole.ThrowErrorLocalized("Error in affliction prefab " + Name + " - limb type \"" + indicatorLimbName + "\" not found."); } } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/Job.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/Job.cs index 411ff78b0..2dff4a2f4 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/Job.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/Job.cs @@ -150,11 +150,11 @@ namespace Barotrauma if (itemElement.Attribute("name") != null) { string itemName = itemElement.Attribute("name").Value; - DebugConsole.ThrowError("Error in Job config (" + Name + ") - use item identifiers instead of names to configure the items."); + DebugConsole.ThrowErrorLocalized("Error in Job config (" + Name + ") - use item identifiers instead of names to configure the items."); itemPrefab = MapEntityPrefab.FindByName(itemName) as ItemPrefab; if (itemPrefab == null) { - DebugConsole.ThrowError("Tried to spawn \"" + Name + "\" with the item \"" + itemName + "\". Matching item prefab not found."); + DebugConsole.ThrowErrorLocalized("Tried to spawn \"" + Name + "\" with the item \"" + itemName + "\". Matching item prefab not found."); return; } } @@ -164,7 +164,7 @@ namespace Barotrauma itemPrefab = MapEntityPrefab.FindByIdentifier(itemIdentifier.ToIdentifier()) as ItemPrefab; if (itemPrefab == null) { - DebugConsole.ThrowError("Tried to spawn \"" + Name + "\" with the item \"" + itemIdentifier + "\". Matching item prefab not found."); + DebugConsole.ThrowErrorLocalized("Tried to spawn \"" + Name + "\" with the item \"" + itemIdentifier + "\". Matching item prefab not found."); return; } } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs index e93e38566..a01454ba2 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs @@ -13,7 +13,14 @@ namespace Barotrauma public readonly Identifier Identifier; public readonly Identifier Option; public readonly float PriorityModifier; + /// + /// The order is ignored in outpost levels. Doesn't apply to outpost NPCs. + /// public readonly bool IgnoreAtOutpost; + /// + /// The order is ignored in "normal" non-outpost levels + /// + public readonly bool IgnoreAtNonOutpost; public AutonomousObjective(XElement element) { @@ -29,6 +36,7 @@ namespace Barotrauma PriorityModifier = element.GetAttributeFloat("prioritymodifier", 1); PriorityModifier = MathHelper.Max(PriorityModifier, 0); IgnoreAtOutpost = element.GetAttributeBool("ignoreatoutpost", false); + IgnoreAtNonOutpost = element.GetAttributeBool("ignoreatnonoutpost", false); } } @@ -244,14 +252,14 @@ namespace Barotrauma { if (itemElement.Element("name") != null) { - DebugConsole.ThrowError("Error in job config \"" + Name + "\" - use identifiers instead of names to configure the items."); + DebugConsole.ThrowErrorLocalized("Error in job config \"" + Name + "\" - use identifiers instead of names to configure the items."); continue; } Identifier itemIdentifier = itemElement.GetAttributeIdentifier("identifier", Identifier.Empty); if (itemIdentifier.IsEmpty) { - DebugConsole.ThrowError("Error in job config \"" + Name + "\" - item with no identifier."); + DebugConsole.ThrowErrorLocalized("Error in job config \"" + Name + "\" - item with no identifier."); } else { diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionData/AbilityConditionAttackData.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionData/AbilityConditionAttackData.cs index 905adea68..37faf6a24 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionData/AbilityConditionAttackData.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/AbilityConditionals/AbilityConditionData/AbilityConditionAttackData.cs @@ -1,8 +1,7 @@ -using System; using Barotrauma.Items.Components; +using System; using System.Collections.Generic; using System.Linq; -using System.Xml.Linq; namespace Barotrauma.Abilities { @@ -25,11 +24,15 @@ namespace Barotrauma.Abilities private readonly Identifier[] tags; private readonly WeaponType weapontype; private readonly bool ignoreNonHarmfulAttacks; + + private readonly bool ignoreOwnAttacks; + public AbilityConditionAttackData(CharacterTalent characterTalent, ContentXElement conditionElement) : base(characterTalent, conditionElement) { - itemIdentifier = conditionElement.GetAttributeString("itemidentifier", string.Empty); - tags = conditionElement.GetAttributeIdentifierArray("tags", Array.Empty()); - ignoreNonHarmfulAttacks = conditionElement.GetAttributeBool("ignorenonharmfulattacks", false); + itemIdentifier = conditionElement.GetAttributeString(nameof(itemIdentifier), string.Empty); + tags = conditionElement.GetAttributeIdentifierArray(nameof(tags), Array.Empty()); + ignoreNonHarmfulAttacks = conditionElement.GetAttributeBool(nameof(ignoreNonHarmfulAttacks), false); + ignoreOwnAttacks = conditionElement.GetAttributeBool(nameof(ignoreOwnAttacks), false); string weaponTypeStr = conditionElement.GetAttributeString("weapontype", "Any"); if (!Enum.TryParse(weaponTypeStr, ignoreCase: true, out weapontype)) @@ -43,6 +46,8 @@ namespace Barotrauma.Abilities { if (abilityObject is AbilityAttackData attackData) { + if (ignoreOwnAttacks && attackData.Attacker == character) { return false; } + if (ignoreNonHarmfulAttacks && attackData.SourceAttack != null) { if (attackData.SourceAttack.Stun <= 0.0f && (attackData.SourceAttack.Afflictions?.All(a => a.Key.Prefab.IsBuff) ?? true)) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityReplaceAffliction.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityReplaceAffliction.cs new file mode 100644 index 000000000..180319723 --- /dev/null +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/Abilities/CharacterAbilityReplaceAffliction.cs @@ -0,0 +1,47 @@ +#nullable enable + +namespace Barotrauma.Abilities +{ + internal sealed class CharacterAbilityReplaceAffliction : CharacterAbility + { + private readonly Identifier afflictionId; + private readonly Identifier newAfflictionId; + private readonly float strengthMultiplier; + + public CharacterAbilityReplaceAffliction(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement) + { + afflictionId = abilityElement.GetAttributeIdentifier("afflictionid", abilityElement.GetAttributeIdentifier("affliction", Identifier.Empty)); + newAfflictionId = abilityElement.GetAttributeIdentifier("newafflictionid", abilityElement.GetAttributeIdentifier("newaffliction", Identifier.Empty)); + + strengthMultiplier = abilityElement.GetAttributeFloat("strengthmultiplier", 1.0f); + + if (afflictionId.IsEmpty) + { + DebugConsole.ThrowError($"Error in {nameof(CharacterAbilityReplaceAffliction)} - affliction identifier not set."); + } + } + + protected override void ApplyEffect() + { + var affliction = Character.CharacterHealth.GetAffliction(afflictionId); + if (affliction != null) + { + float afflictionStrength = affliction.Strength; + Limb limb = Character.CharacterHealth.GetAfflictionLimb(affliction); + Character.CharacterHealth.ReduceAfflictionOnAllLimbs(affliction.Identifier, afflictionStrength); + if (!newAfflictionId.IsEmpty && AfflictionPrefab.Prefabs.TryGet(newAfflictionId, out var newAfflictionPrefab)) + { + Character.CharacterHealth.ApplyAffliction(targetLimb: limb, newAfflictionPrefab.Instantiate(afflictionStrength * strengthMultiplier)); + } + } + } + + protected override void VerifyState(bool conditionsMatched, float timeSinceLastUpdate) + { + if (conditionsMatched) + { + ApplyEffect(); + } + } + } +} \ No newline at end of file diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/AbilityGroups/CharacterAbilityGroupInterval.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/AbilityGroups/CharacterAbilityGroupInterval.cs index cf1100db6..18855af2e 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/AbilityGroups/CharacterAbilityGroupInterval.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Talents/AbilityGroups/CharacterAbilityGroupInterval.cs @@ -1,14 +1,13 @@ using System.Collections.Generic; -using System.Linq; namespace Barotrauma.Abilities { class CharacterAbilityGroupInterval : CharacterAbilityGroup { - private float interval { get; set; } + private readonly float interval; public float TimeSinceLastUpdate { get; private set; } - private float effectDelay; + private readonly float effectDelay; private float effectDelayTimer; diff --git a/Barotrauma/BarotraumaShared/SharedSource/DebugConsole.cs b/Barotrauma/BarotraumaShared/SharedSource/DebugConsole.cs index dc4edbb99..51109b057 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/DebugConsole.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/DebugConsole.cs @@ -2562,9 +2562,9 @@ namespace Barotrauma } } - public static void ThrowError(LocalizedString error, Exception e = null, bool createMessageBox = false, bool appendStackTrace = false) + public static void ThrowErrorLocalized(LocalizedString error, Exception e = null, ContentPackage contentPackage = null, bool createMessageBox = false, bool appendStackTrace = false) { - ThrowError(error.Value, e, createMessageBox, appendStackTrace); + ThrowError(error.Value, e, contentPackage, createMessageBox, appendStackTrace); } public static void ThrowError(string error, Exception e = null, ContentPackage contentPackage = null, bool createMessageBox = false, bool appendStackTrace = false) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Events/EventActions/AfflictionAction.cs b/Barotrauma/BarotraumaShared/SharedSource/Events/EventActions/AfflictionAction.cs index c6792de8d..a5b62d869 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Events/EventActions/AfflictionAction.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Events/EventActions/AfflictionAction.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; using System.Linq; -using System.Xml.Linq; namespace Barotrauma { @@ -36,8 +33,7 @@ namespace Barotrauma public override void Update(float deltaTime) { if (isFinished) { return; } - var afflictionPrefab = AfflictionPrefab.List.FirstOrDefault(p => p.Identifier == Affliction); - if (afflictionPrefab != null) + if (AfflictionPrefab.Prefabs.TryGet(Affliction, out var afflictionPrefab)) { var targets = ParentEvent.GetTargets(TargetTag); foreach (var target in targets) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/MissionPrefab.cs b/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/MissionPrefab.cs index 4df37a741..064527a38 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/MissionPrefab.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Events/Missions/MissionPrefab.cs @@ -364,12 +364,12 @@ namespace Barotrauma if (!Enum.TryParse(missionTypeName.Value, true, out Type)) { - DebugConsole.ThrowError("Error in mission prefab \"" + Name + "\" - \"" + missionTypeName + "\" is not a valid mission type."); + DebugConsole.ThrowErrorLocalized("Error in mission prefab \"" + Name + "\" - \"" + missionTypeName + "\" is not a valid mission type."); return; } if (Type == MissionType.None) { - DebugConsole.ThrowError("Error in mission prefab \"" + Name + "\" - mission type cannot be none."); + DebugConsole.ThrowErrorLocalized("Error in mission prefab \"" + Name + "\" - mission type cannot be none."); return; } @@ -383,7 +383,7 @@ namespace Barotrauma } else { - DebugConsole.ThrowError("Error in mission prefab \"" + Name + "\" - unsupported mission type \"" + Type.ToString() + "\""); + DebugConsole.ThrowErrorLocalized("Error in mission prefab \"" + Name + "\" - unsupported mission type \"" + Type.ToString() + "\""); } if (constructor == null) { diff --git a/Barotrauma/BarotraumaShared/SharedSource/GameAnalytics/GameAnalyticsConsent.cs b/Barotrauma/BarotraumaShared/SharedSource/GameAnalytics/GameAnalyticsConsent.cs index b87dd7027..a6ba4d40d 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/GameAnalytics/GameAnalyticsConsent.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/GameAnalytics/GameAnalyticsConsent.cs @@ -269,7 +269,7 @@ namespace Barotrauma { if (response.ErrorException != null) { - DebugConsole.ThrowError(TextManager.GetWithVariable("MasterServerErrorException", "[error]", response.ErrorException.ToString())); + DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariable("MasterServerErrorException", "[error]", response.ErrorException.ToString())); return false; } @@ -278,13 +278,13 @@ namespace Barotrauma switch (response.StatusCode) { case HttpStatusCode.NotFound: - DebugConsole.ThrowError(TextManager.GetWithVariable("MasterServerError404", "[masterserverurl]", consentServerUrl)); + DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariable("MasterServerError404", "[masterserverurl]", consentServerUrl)); break; case HttpStatusCode.ServiceUnavailable: - DebugConsole.ThrowError(TextManager.Get("MasterServerErrorUnavailable")); + DebugConsole.ThrowErrorLocalized(TextManager.Get("MasterServerErrorUnavailable")); break; default: - DebugConsole.ThrowError(TextManager.GetWithVariables("MasterServerErrorDefault", + DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariables("MasterServerErrorDefault", ("[statuscode]", response.StatusCode.ToString()), ("[statusdescription]", response.StatusDescription))); break; diff --git a/Barotrauma/BarotraumaShared/SharedSource/GameSession/GameModes/CampaignMode.cs b/Barotrauma/BarotraumaShared/SharedSource/GameSession/GameModes/CampaignMode.cs index e12456b62..374768a3b 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/GameSession/GameModes/CampaignMode.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/GameSession/GameModes/CampaignMode.cs @@ -557,7 +557,7 @@ namespace Barotrauma if (availableTransition == TransitionType.None) { - DebugConsole.ThrowError("Failed to load a new campaign level. No available level transitions " + + DebugConsole.ThrowErrorLocalized("Failed to load a new campaign level. No available level transitions " + "(current location: " + (map.CurrentLocation?.DisplayName ?? "null") + ", " + "selected location: " + (map.SelectedLocation?.DisplayName ?? "null") + ", " + "leaving sub: " + (leavingSub?.Info?.Name ?? "null") + ", " + @@ -568,7 +568,7 @@ namespace Barotrauma } if (nextLevel == null) { - DebugConsole.ThrowError("Failed to load a new campaign level. No available level transitions " + + DebugConsole.ThrowErrorLocalized("Failed to load a new campaign level. No available level transitions " + "(transition type: " + availableTransition + ", " + "current location: " + (map.CurrentLocation?.DisplayName ?? "null") + ", " + "selected location: " + (map.SelectedLocation?.DisplayName ?? "null") + ", " + diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Fabricator.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Fabricator.cs index 63de9cce6..4331f4199 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Fabricator.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Fabricator.cs @@ -170,7 +170,7 @@ namespace Barotrauma.Items.Components { if (recipe.RequiredItems.Length > inputContainer.Capacity) { - DebugConsole.ThrowError("Error in item \"" + item.Name + "\": There's not enough room in the input inventory for the ingredients of \"" + recipe.TargetItem.Name + "\"!"); + DebugConsole.ThrowErrorLocalized("Error in item \"" + item.Name + "\": There's not enough room in the input inventory for the ingredients of \"" + recipe.TargetItem.Name + "\"!"); } } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/ItemAssemblyPrefab.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/ItemAssemblyPrefab.cs index 706996a5d..9746cb9ae 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/ItemAssemblyPrefab.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/ItemAssemblyPrefab.cs @@ -176,7 +176,7 @@ namespace Barotrauma } catch (Exception e) { - DebugConsole.ThrowError("Deleting item assembly \"" + Name + "\" failed.", e); + DebugConsole.ThrowErrorLocalized("Deleting item assembly \"" + Name + "\" failed.", e); } } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/Map/Location.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/Map/Location.cs index 552b93ade..7a0ef7607 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/Map/Location.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/Map/Location.cs @@ -570,9 +570,9 @@ namespace Barotrauma if (nameIdentifier.IsEmpty) { //backwards compatibility - rawName = element.GetAttributeString("basename", ""); - nameIdentifier = rawName.ToIdentifier(); DisplayName = element.GetAttributeString("name", ""); + rawName = element.GetAttributeString("rawname", element.GetAttributeString("basename", DisplayName.Value)); + nameIdentifier = rawName.ToIdentifier(); } else { @@ -1088,12 +1088,12 @@ namespace Barotrauma { if (!Type.HasHireableCharacters) { - DebugConsole.ThrowError("Cannot hire a character from location \"" + DisplayName + "\" - the location has no hireable characters.\n" + Environment.StackTrace.CleanupStackTrace()); + DebugConsole.ThrowErrorLocalized("Cannot hire a character from location \"" + DisplayName + "\" - the location has no hireable characters.\n" + Environment.StackTrace.CleanupStackTrace()); return; } if (HireManager == null) { - DebugConsole.ThrowError("Cannot hire a character from location \"" + DisplayName + "\" - hire manager has not been instantiated.\n" + Environment.StackTrace.CleanupStackTrace()); + DebugConsole.ThrowErrorLocalized("Cannot hire a character from location \"" + DisplayName + "\" - hire manager has not been instantiated.\n" + Environment.StackTrace.CleanupStackTrace()); return; } diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/StructurePrefab.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/StructurePrefab.cs index a089421ab..8bdbea685 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/StructurePrefab.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/StructurePrefab.cs @@ -185,7 +185,7 @@ namespace Barotrauma if (subElement.GetAttribute("sourcerect") == null && subElement.GetAttribute("sheetindex") == null) { - DebugConsole.ThrowError("Warning - sprite sourcerect not configured for structure \"" + Name + "\"!"); + DebugConsole.ThrowErrorLocalized("Warning - sprite sourcerect not configured for structure \"" + Name + "\"!"); } #if CLIENT if (subElement.GetAttributeBool("fliphorizontal", false)) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Networking/ClientPermissions.cs b/Barotrauma/BarotraumaShared/SharedSource/Networking/ClientPermissions.cs index b17701a49..d8f76a414 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Networking/ClientPermissions.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Networking/ClientPermissions.cs @@ -51,7 +51,7 @@ namespace Barotrauma.Networking string permissionsStr = element.GetAttributeString("permissions", ""); if (!Enum.TryParse(permissionsStr, out Permissions)) { - DebugConsole.ThrowError("Error in permission preset \"" + DisplayName + "\" - " + permissionsStr + " is not a valid permission!"); + DebugConsole.ThrowErrorLocalized("Error in permission preset \"" + DisplayName + "\" - " + permissionsStr + " is not a valid permission!"); } PermittedCommands = new HashSet(); @@ -66,7 +66,7 @@ namespace Barotrauma.Networking if (command == null) { #if SERVER - DebugConsole.ThrowError("Error in permission preset \"" + DisplayName + "\" - " + commandName + "\" is not a valid console command."); + DebugConsole.ThrowErrorLocalized("Error in permission preset \"" + DisplayName + "\" - " + commandName + "\" is not a valid console command."); #endif continue; } diff --git a/Barotrauma/BarotraumaShared/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt index 73a4ca7f7..a64e7dc57 100644 --- a/Barotrauma/BarotraumaShared/changelog.txt +++ b/Barotrauma/BarotraumaShared/changelog.txt @@ -1,3 +1,22 @@ +------------------------------------------------------------------------------------------------------------------------------------------------- +v1.2.7.0 +------------------------------------------------------------------------------------------------------------------------------------------------- + +- Fixed an issue that sometimes caused the game to crash without generating a crash report (which would lead to a "pipe was broken" error if the issue happened server-side). The issue had to do with a stack overflow when throwing specific kinds of console errors: one common case was when the game failed to connect to our server to check the GameAnalytics consent, which lead to a crash on startup. +- Fixed piezo crystals sometimes spawning right at the start of the level. +- Fixed assistants not being able to pick all tier 1 and 2 talents. +- Fixed location names disappearing when locations change their type in saves started in pre-1.2 versions. +- Fixed selection rectangle disappearing from items when zoomed in by more than x2 in the sub editor. +- Fixed "killcrawlerswarmlarge2" mission not having a description. +- Fixed bots sometimes choosing to wear broken diving suits. +- Fixed currently visible particles freezing when lowering the particle limit. +- Fixed dragged characters always colliding with stairs, making it impossible to drag them past the stairs. +- Fixed "drunken sailor" talent not nullifying the negative effects of drunkenness. +- Fixed stun from the "lightning wizard" talent activating if you cause damage to yourself (e.g. by breaking a wall and taking damage from the shrapnel). +- Fixed escorted security officers sometimes inspecting the crew for stolen items during escort missions. +- Fixed basics tutorial sometimes getting stuck in the "weld leak" objective. +- Fixed ancient weapon not flipping horizontally when aiming it to the left. + ------------------------------------------------------------------------------------------------------------------------------------------------- v1.2.6.0 -------------------------------------------------------------------------------------------------------------------------------------------------