Unstable 1.8.4.0
This commit is contained in:
@@ -504,10 +504,8 @@ namespace Barotrauma
|
||||
|
||||
foreach (Character c in Character.CharacterList)
|
||||
{
|
||||
if (c.AnimController.CurrentHull != null && c.AnimController.CanEnterSubmarine != CanEnterSubmarine.True)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//character inside some sub, no need to displace
|
||||
if (c.Submarine != null) { continue; }
|
||||
|
||||
foreach (Limb limb in c.AnimController.Limbs)
|
||||
{
|
||||
@@ -517,7 +515,7 @@ namespace Barotrauma
|
||||
|
||||
//cast a line from the position of the character to the same direction as the translation of the sub
|
||||
//and see where it intersects with the bounding box
|
||||
if (!MathUtils.GetLineRectangleIntersection(limb.WorldPosition,
|
||||
if (!MathUtils.GetLineWorldRectangleIntersection(limb.WorldPosition,
|
||||
limb.WorldPosition + translateDir * 100000.0f, worldBorders, out Vector2 intersection))
|
||||
{
|
||||
//should never happen when casting a line out from inside the bounding box
|
||||
@@ -525,13 +523,11 @@ namespace Barotrauma
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//"+ translatedir" in order to move the character slightly away from the wall
|
||||
c.AnimController.SetPosition(ConvertUnits.ToSimUnits(c.WorldPosition + (intersection - limb.WorldPosition)) + translateDir);
|
||||
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,9 +581,7 @@ namespace Barotrauma
|
||||
|
||||
private void UpdateDepthDamage(float deltaTime)
|
||||
{
|
||||
#if CLIENT
|
||||
if (GameMain.GameSession?.GameMode is TestGameMode) { return; }
|
||||
#endif
|
||||
if (Level.Loaded == null) { return; }
|
||||
|
||||
//camera shake and sounds start playing 500 meters before crush depth
|
||||
@@ -598,7 +592,7 @@ namespace Barotrauma
|
||||
const float MaxWallDamageProbability = 1.0f;
|
||||
const float MinWallDamage = 50f;
|
||||
const float MaxWallDamage = 500.0f;
|
||||
const float MinCameraShake = 5f;
|
||||
const float MinCameraShake = 10f;
|
||||
const float MaxCameraShake = 50.0f;
|
||||
//delay at the start of the round during which you take no depth damage
|
||||
//(gives you a bit of time to react and return if you start the round in a level that's too deep)
|
||||
@@ -612,8 +606,11 @@ namespace Barotrauma
|
||||
damageSoundTimer -= deltaTime;
|
||||
if (damageSoundTimer <= 0.0f)
|
||||
{
|
||||
const float PressureSoundRange = -CosmeticEffectThreshold;
|
||||
//Ratio between 0 (where the 'approaching crush depth' indication starts) and 1 (at crush depth or past it)
|
||||
float closenessToCrushDepthRatio = Math.Clamp((Submarine.RealWorldDepth - (Submarine.RealWorldCrushDepth + CosmeticEffectThreshold)) / PressureSoundRange, 0f, 1f);
|
||||
#if CLIENT
|
||||
SoundPlayer.PlayDamageSound("pressure", Rand.Range(0.0f, 100.0f), submarine.WorldPosition + Rand.Vector(Rand.Range(0.0f, Math.Min(submarine.Borders.Width, submarine.Borders.Height))), 20000.0f);
|
||||
SoundPlayer.PlayDamageSound("pressure", MathHelper.Lerp(0f, 100f, closenessToCrushDepthRatio), submarine.WorldPosition + Rand.Vector(Rand.Range(0.0f, Math.Min(submarine.Borders.Width, submarine.Borders.Height))), 20000.0f, gain: 1f + closenessToCrushDepthRatio * 2);
|
||||
#endif
|
||||
damageSoundTimer = Rand.Range(5.0f, 10.0f);
|
||||
}
|
||||
@@ -919,6 +916,13 @@ namespace Barotrauma
|
||||
{
|
||||
Debug.Assert(otherSub != submarine);
|
||||
|
||||
//submarine outside the level (despawned respawn shuttle?)
|
||||
//no need to apply impacts between colliding subs
|
||||
if (submarine.IsAboveLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 normal = impact.Normal;
|
||||
if (impact.Target.Body == otherSub.SubBody.Body.FarseerBody)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user