Build 1.1.4.0

This commit is contained in:
Markus Isberg
2023-03-31 18:40:44 +03:00
parent efba17e0ff
commit 9470edead3
483 changed files with 17487 additions and 8548 deletions
@@ -81,6 +81,8 @@ namespace Barotrauma
get { return base.Prefab.Sprite; }
}
public bool IsExteriorWall { get; private set; } = true;
public bool IsPlatform
{
get { return Prefab.Platform; }
@@ -402,6 +404,8 @@ namespace Barotrauma
}
}
CheckIsExteriorWall();
#if CLIENT
convexHulls?.ForEach(x => x.Move(amount));
@@ -697,15 +701,41 @@ namespace Barotrauma
}
}
private static Vector2[] CalculateExtremes(Rectangle sectionRect)
public void CheckIsExteriorWall()
{
Vector2[] corners = new Vector2[4];
corners[0] = new Vector2(sectionRect.X, sectionRect.Y - sectionRect.Height);
corners[1] = new Vector2(sectionRect.X, sectionRect.Y);
corners[2] = new Vector2(sectionRect.Right, sectionRect.Y);
corners[3] = new Vector2(sectionRect.Right, sectionRect.Y - sectionRect.Height);
if (!HasBody)
{
IsExteriorWall = false;
return;
}
return corners;
Vector2 point1 = WorldPosition + BodyOffset * Scale;
//point1 = MathUtils.RotatePointAroundTarget(WorldPosition, point1, BodyRotation);
Vector2 point2 = point1;
Vector2 normal = new Vector2(
(float)-Math.Sin(IsHorizontal ? -BodyRotation : MathHelper.PiOver2 - BodyRotation),
(float)Math.Cos(IsHorizontal ? -BodyRotation : MathHelper.PiOver2 - BodyRotation));
float thickness = IsHorizontal ?
(BodyHeight > 0 ? BodyHeight : rect.Height) :
(BodyWidth > 0 ? BodyWidth : rect.Width);
point1 += normal * (thickness / 2 + 16);
point2 -= normal * (thickness / 2 + 16);
IsExteriorWall =
Hull.FindHullUnoptimized(point1, null, useWorldCoordinates: true) == null ||
Hull.FindHullUnoptimized(point2, null, useWorldCoordinates: true) == null;
#if CLIENT
if (convexHulls != null)
{
foreach (ConvexHull ch in convexHulls)
{
ch.IsExteriorWall = IsExteriorWall;
}
}
#endif
}
/// <summary>
@@ -715,7 +745,7 @@ namespace Barotrauma
{
foreach (MapEntity mapEntity in mapEntityList)
{
if (!(mapEntity is Structure structure)) { continue; }
if (mapEntity is not Structure structure) { continue; }
if (!structure.Prefab.AllowAttachItems) { continue; }
if (structure.Bodies != null && structure.Bodies.Count > 0) { continue; }
Rectangle worldRect = mapEntity.WorldRect;
@@ -939,7 +969,7 @@ namespace Barotrauma
Rand.Range(worldRect.X, worldRect.Right + 1),
Rand.Range(worldRect.Y - worldRect.Height, worldRect.Y + 1));
var particle = GameMain.ParticleManager.CreateParticle("shrapnel", particlePos, Rand.Vector(Rand.Range(1.0f, 50.0f)), collisionIgnoreTimer: 1f);
var particle = GameMain.ParticleManager.CreateParticle(Prefab.DamageParticle, particlePos, Rand.Vector(Rand.Range(1.0f, 50.0f)), collisionIgnoreTimer: 1f);
if (particle == null) break;
}
}
@@ -1085,9 +1115,9 @@ namespace Barotrauma
return new AttackResult(damageAmount, null);
}
public void SetDamage(int sectionIndex, float damage, Character attacker = null, bool createNetworkEvent = true, bool createExplosionEffect = true)
public void SetDamage(int sectionIndex, float damage, Character attacker = null, bool createNetworkEvent = true, bool isNetworkEvent = true, bool createExplosionEffect = true)
{
if (Submarine != null && Submarine.GodMode || Indestructible) { return; }
if (Submarine != null && Submarine.GodMode || (Indestructible && !isNetworkEvent)) { return; }
if (!Prefab.Body) { return; }
if (!MathUtils.IsValid(damage)) { return; }
@@ -1635,6 +1665,7 @@ namespace Barotrauma
{
SetDamage(i, Sections[i].damage, createNetworkEvent: false, createExplosionEffect: false);
}
CheckIsExteriorWall();
}
public virtual void Reset()