Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Regalis11/Barotrauma into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
evilfactory committed Dec 20, 2023
2 parents 2043f64 + 8ea2b47 commit 2ebaa72
Show file tree
Hide file tree
Showing 36 changed files with 182 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/ClientSource/DebugConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ private static void InitProjectSpecific()
{
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;
}
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/ClientSource/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ public void Draw(SpriteBatch spriteBatch, bool editing, bool back = true, Color?
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)
{
Expand Down
1 change: 1 addition & 0 deletions Barotrauma/BarotraumaClient/ClientSource/Map/Hull.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ public static void UpdateCheats(float deltaTime, Camera cam)
{
if (primaryMouseButtonHeld)
{
ShowHulls = true;
hull.WaterVolume += 100000.0f * deltaTime;
hull.networkUpdatePending = true;
hull.serverUpdateDelay = 0.5f;
Expand Down
7 changes: 7 additions & 0 deletions Barotrauma/BarotraumaClient/ClientSource/Map/Submarine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,13 @@ public void CheckForErrors()
}
}

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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,7 @@ private IEnumerable<CoroutineStatus> StartGame(IReadMessage inc)
}
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ public int MaxParticles
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];
Expand All @@ -39,6 +38,16 @@ public int MaxParticles
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ private void CreateJoint(int fromLimb, int toLimb, Vector2? anchor1 = null, Vect
{
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)
Expand All @@ -1239,7 +1239,7 @@ private void CreateJoint(int fromLimb, int toLimb, Vector2? anchor1 = null, Vect
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);
Expand Down Expand Up @@ -1271,7 +1271,7 @@ private void DeleteSelected()
{
if (character.IsHumanoid)
{
DebugConsole.ThrowError(GetCharacterEditorTranslation("HumanoidLimbDeletionDisabled"));
DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("HumanoidLimbDeletionDisabled"));
break;
}
var limb = selectedLimbs[i];
Expand Down Expand Up @@ -1675,7 +1675,7 @@ public bool CreateCharacter(Identifier name, string mainFolder, bool isHumanoid,
if (contentPackage == null)
{
// This should not be possible.
DebugConsole.ThrowError(GetCharacterEditorTranslation("NoContentPackageSelected"));
DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("NoContentPackageSelected"));
return false;
}
if (vanilla != null && contentPackage == vanilla)
Expand Down Expand Up @@ -2898,7 +2898,7 @@ void PopulateListBox()
}
catch (Exception e)
{
DebugConsole.ThrowError(GetCharacterEditorTranslation("CouldntOpenDirectory").Replace("[folder]", RagdollParams.Folder), e);
DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("CouldntOpenDirectory").Replace("[folder]", RagdollParams.Folder), e);
}
}
PopulateListBox();
Expand Down Expand Up @@ -2932,7 +2932,7 @@ void PopulateListBox()
}
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();
Expand Down Expand Up @@ -3058,7 +3058,7 @@ void PopulateListBox()
}
catch (Exception e)
{
DebugConsole.ThrowError(GetCharacterEditorTranslation("CouldntOpenDirectory").Replace("[folder]", CurrentAnimation.Folder), e);
DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("CouldntOpenDirectory").Replace("[folder]", CurrentAnimation.Folder), e);
}
}
PopulateListBox();
Expand Down Expand Up @@ -3092,7 +3092,7 @@ void PopulateListBox()
}
catch (Exception e)
{
DebugConsole.ThrowError(TextManager.GetWithVariable("DeleteFileError", "[file]", selectedFile), e);
DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariable("DeleteFileError", "[file]", selectedFile), e);
}
msgBox.Close();
PopulateListBox();
Expand Down Expand Up @@ -3129,7 +3129,7 @@ void PopulateListBox()
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;
}
}
Expand All @@ -3150,7 +3150,7 @@ void PopulateListBox()
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;
}
}
Expand Down Expand Up @@ -3548,7 +3548,7 @@ private void TryUpdateSubParam(RagdollParams.SubParam ragdollSubParams, Identifi
}
else
{
DebugConsole.ThrowError(GetCharacterEditorTranslation("NoFieldForParameterFound").Replace("[parameter]", name.Value));
DebugConsole.ThrowErrorLocalized(GetCharacterEditorTranslation("NoFieldForParameterFound").Replace("[parameter]", name.Value));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public enum WarningType
WallCount,
ItemCount,
LightCount,
ShadowCastingLightCount
ShadowCastingLightCount,
WaterInHulls
}

public static Vector2 MouseDragStart = Vector2.Zero;
Expand Down Expand Up @@ -1320,7 +1321,7 @@ private void CreateEntityElement(MapEntityPrefab ep, int entitiesPerRow, GUIComp
}
catch (Exception e)
{
DebugConsole.ThrowError(TextManager.GetWithVariable("DeleteFileError", "[file]", assemblyPrefab.Name), e);
DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariable("DeleteFileError", "[file]", assemblyPrefab.Name), e);
}
return true;
};
Expand Down Expand Up @@ -1560,7 +1561,9 @@ protected override void DeselectEditorSpecific()
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",
Expand Down Expand Up @@ -3714,7 +3717,7 @@ private void TryDeleteSub(SubmarineInfo sub)
}
catch (Exception e)
{
DebugConsole.ThrowError(TextManager.GetWithVariable("DeleteFileError", "[file]", sub.FilePath), e);
DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariable("DeleteFileError", "[file]", sub.FilePath), e);
}
return true;
};
Expand Down Expand Up @@ -5202,9 +5205,7 @@ public override void Update(double deltaTime)
SkipInventorySlotUpdate = false;
ImageManager.Update((float)deltaTime);

#if DEBUG
Hull.UpdateCheats((float)deltaTime, cam);
#endif

if (GameMain.GraphicsWidth != screenResolution.X || GameMain.GraphicsHeight != screenResolution.Y)
{
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/LinuxClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.2.6.0</Version>
<Version>1.2.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/MacClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.2.6.0</Version>
<Version>1.2.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/WindowsClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.2.6.0</Version>
<Version>1.2.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaServer/LinuxServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.2.6.0</Version>
<Version>1.2.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaServer/MacServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.2.6.0</Version>
<Version>1.2.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaServer/ServerSource/GameMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void CheckContentPackage()
{
if (Version < VanillaContent.GameVersion)
{
DebugConsole.ThrowError(
DebugConsole.ThrowErrorLocalized(
TextManager.GetWithVariables("versionmismatchwarning",
("[gameversion]", Version.ToString()),
("[contentversion]", VanillaContent.GameVersion.ToString())));
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaServer/WindowsServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.2.6.0</Version>
<Version>1.2.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ private void FindTargetItem()
if (!itemInventory.Container.HasRequiredItems(character, addMessage: false)) { continue; }
}
float itemPriority = item.Prefab.BotPriority;
if (itemPriority <= 0) { continue; }
if (GetItemPriority != null)
{
itemPriority *= GetItemPriority(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ public void CreateAutonomousObjectives()
continue;
}
}
if (autonomousObjective.IgnoreAtNonOutpost && !Level.IsLoadedFriendlyOutpost)
{
continue;
}
var objective = CreateObjective(order, autonomousObjective.PriorityModifier);
if (objective != null && objective.CanBeCompleted)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,28 +741,32 @@ public bool OnLimbCollision(Fixture f1, Fixture f2, Contact contact)
{
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; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ public AfflictionPrefab(ContentXElement element, AfflictionsFile file, Type type
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.");
}
}

Expand Down
Loading

0 comments on commit 2ebaa72

Please sign in to comment.