Particle fixes/improvements:
- Fixed particles going through closed gaps (e.g. closed doors). - Gaps can emit particles even if the target hull is full of water (-> water running into the sub through an already flooded room is more apparent). - The air-only splash & waterdrop particles are not emitted if the target room is full of water. - Fixed heavy water particles never moving upwards (even if the water is rushing into a room from a gap on the floor).
This commit is contained in:
@@ -62,7 +62,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
partial void EmitParticles(float deltaTime)
|
partial void EmitParticles(float deltaTime)
|
||||||
{
|
{
|
||||||
if (flowTargetHull == null || flowTargetHull.WaterVolume >= flowTargetHull.Volume) return;
|
if (flowTargetHull == null) return;
|
||||||
|
|
||||||
particleTimer += deltaTime;
|
particleTimer += deltaTime;
|
||||||
|
|
||||||
@@ -94,8 +94,16 @@ namespace Barotrauma
|
|||||||
velocity.X *= Rand.Range(1.0f, 3.0f);
|
velocity.X *= Rand.Range(1.0f, 3.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
var particle = GameMain.ParticleManager.CreateParticle(
|
if (flowTargetHull.WaterVolume < flowTargetHull.Volume)
|
||||||
Rand.Range(0.0f, open) < 0.05f ? "waterdrop" : "watersplash",
|
{
|
||||||
|
GameMain.ParticleManager.CreateParticle(
|
||||||
|
Rand.Range(0.0f, open) < 0.05f ? "waterdrop" : "watersplash",
|
||||||
|
(Submarine == null ? pos : pos + Submarine.Position),
|
||||||
|
velocity, 0, flowTargetHull);
|
||||||
|
}
|
||||||
|
|
||||||
|
GameMain.ParticleManager.CreateParticle(
|
||||||
|
"bubbles",
|
||||||
(Submarine == null ? pos : pos + Submarine.Position),
|
(Submarine == null ? pos : pos + Submarine.Position),
|
||||||
velocity, 0, flowTargetHull);
|
velocity, 0, flowTargetHull);
|
||||||
|
|
||||||
@@ -112,14 +120,17 @@ namespace Barotrauma
|
|||||||
MathHelper.Clamp(flowForce.X, -5000.0f, 5000.0f) * Rand.Range(0.5f, 0.7f),
|
MathHelper.Clamp(flowForce.X, -5000.0f, 5000.0f) * Rand.Range(0.5f, 0.7f),
|
||||||
flowForce.Y * Rand.Range(0.5f, 0.7f));
|
flowForce.Y * Rand.Range(0.5f, 0.7f));
|
||||||
|
|
||||||
var particle = GameMain.ParticleManager.CreateParticle(
|
if (flowTargetHull.WaterVolume < flowTargetHull.Volume)
|
||||||
"watersplash",
|
|
||||||
(Submarine == null ? pos : pos + Submarine.Position) - Vector2.UnitY * Rand.Range(0.0f, 10.0f),
|
|
||||||
velocity, 0, flowTargetHull);
|
|
||||||
|
|
||||||
if (particle != null)
|
|
||||||
{
|
{
|
||||||
particle.Size = particle.Size * Math.Min(Math.Abs(flowForce.X / 1000.0f), 5.0f);
|
var particle = GameMain.ParticleManager.CreateParticle(
|
||||||
|
"watersplash",
|
||||||
|
(Submarine == null ? pos : pos + Submarine.Position) - Vector2.UnitY * Rand.Range(0.0f, 10.0f),
|
||||||
|
velocity, 0, flowTargetHull);
|
||||||
|
|
||||||
|
if (particle != null)
|
||||||
|
{
|
||||||
|
particle.Size = particle.Size * Math.Min(Math.Abs(flowForce.X / 1000.0f), 5.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.Abs(flowForce.X) > 300.0f)
|
if (Math.Abs(flowForce.X) > 300.0f)
|
||||||
@@ -143,12 +154,12 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Vector2 velocity = new Vector2(
|
Vector2 velocity = new Vector2(
|
||||||
lerpedFlowForce.X * Rand.Range(0.5f, 0.7f),
|
lerpedFlowForce.X * Rand.Range(0.5f, 0.7f),
|
||||||
Math.Max(lerpedFlowForce.Y, -100.0f) * Rand.Range(0.5f, 0.7f));
|
MathHelper.Clamp(lerpedFlowForce.Y, -500.0f, 1000.0f) * Rand.Range(0.5f, 0.7f));
|
||||||
|
|
||||||
var splash = GameMain.ParticleManager.CreateParticle(
|
var splash = GameMain.ParticleManager.CreateParticle(
|
||||||
"watersplash",
|
"watersplash",
|
||||||
Submarine == null ? pos : pos + Submarine.Position,
|
Submarine == null ? pos : pos + Submarine.Position,
|
||||||
-velocity, 0, FlowTargetHull);
|
velocity, 0, FlowTargetHull);
|
||||||
|
|
||||||
if (splash != null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f);
|
if (splash != null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f);
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ namespace Barotrauma.Particles
|
|||||||
bool gapFound = false;
|
bool gapFound = false;
|
||||||
foreach (Gap gap in hullGaps)
|
foreach (Gap gap in hullGaps)
|
||||||
{
|
{
|
||||||
if (gap.IsHorizontal != (collisionNormal.X != 0.0f)) continue;
|
if (gap.Open <= 0.0f || gap.IsHorizontal != (collisionNormal.X != 0.0f)) continue;
|
||||||
|
|
||||||
if (gap.IsHorizontal)
|
if (gap.IsHorizontal)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user