Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into unstable

This commit is contained in:
EvilFactory
2022-09-29 12:13:55 -03:00
602 changed files with 19759 additions and 16312 deletions
@@ -26,6 +26,12 @@ namespace Barotrauma
private set;
}
/// <summary>
/// "Diagonal" gaps are used on sloped walls to allow characters to pass through them either horizontally or vertically.
/// Water still flows through them only horizontally or vertically
/// </summary>
public bool IsDiagonal { get; }
//a value between 0.0f-1.0f (0.0 = closed, 1.0f = open)
private float open;
@@ -136,12 +142,13 @@ namespace Barotrauma
: this(rect, rect.Width < rect.Height, submarine)
{ }
public Gap(Rectangle rect, bool isHorizontal, Submarine submarine, ushort id = Entity.NullEntityID)
public Gap(Rectangle rect, bool isHorizontal, Submarine submarine, bool isDiagonal = false, ushort id = Entity.NullEntityID)
: base(CoreEntityPrefab.GapPrefab, submarine, id)
{
this.rect = rect;
flowForce = Vector2.Zero;
IsHorizontal = isHorizontal;
IsDiagonal = isDiagonal;
open = 1.0f;
FindHulls();
@@ -671,15 +678,15 @@ namespace Barotrauma
{
foreach (Gap gap in gaps)
{
if (gap.Open == 0.0f || gap.IsRoomToRoom) continue;
if (gap.Open == 0.0f || gap.IsRoomToRoom) { continue; }
if (gap.ConnectedWall != null)
{
int sectionIndex = gap.ConnectedWall.FindSectionIndex(gap.Position);
if (sectionIndex > -1 && !gap.ConnectedWall.SectionBodyDisabled(sectionIndex)) continue;
if (sectionIndex > -1 && !gap.ConnectedWall.SectionBodyDisabled(sectionIndex)) { continue; }
}
if (gap.IsHorizontal)
if (gap.IsHorizontal || gap.IsDiagonal)
{
if (worldPos.Y < gap.WorldRect.Y && worldPos.Y > gap.WorldRect.Y - gap.WorldRect.Height &&
Math.Abs(gap.WorldRect.Center.X - worldPos.X) < allowedOrthogonalDist)
@@ -687,7 +694,7 @@ namespace Barotrauma
return gap;
}
}
else
if (!gap.IsHorizontal || gap.IsDiagonal)
{
if (worldPos.X > gap.WorldRect.X && worldPos.X < gap.WorldRect.Right &&
Math.Abs(gap.WorldRect.Y - gap.WorldRect.Height / 2 - worldPos.Y) < allowedOrthogonalDist)
@@ -759,7 +766,7 @@ namespace Barotrauma
isHorizontal = horizontalAttribute.Value.ToString() == "true";
}
Gap g = new Gap(rect, isHorizontal, submarine, idRemap.GetOffsetId(element))
Gap g = new Gap(rect, isHorizontal, submarine, id: idRemap.GetOffsetId(element))
{
linkedToID = new List<ushort>(),
};