Fire extinguisher, burnt limbs, spectating improvements, option to disable spectating, jumpsuits for engi & mech, fireproof items, stuff

This commit is contained in:
Regalis
2015-11-18 20:02:45 +02:00
parent 7b6d92bb27
commit 9b08201972
36 changed files with 429 additions and 85 deletions
+7 -7
View File
@@ -68,6 +68,7 @@ namespace Barotrauma.Particles
public void Init(ParticlePrefab prefab, Vector2 position, Vector2 speed, float rotation, Hull hullGuess = null)
{
this.prefab = prefab;
spriteIndex = Rand.Int(prefab.Sprites.Count);
@@ -77,7 +78,8 @@ namespace Barotrauma.Particles
drawPosition = position;
velocity = speed;
velocity = MathUtils.IsValid(speed) ? speed : Vector2.Zero;
this.rotation = rotation + Rand.Range(prefab.StartRotationMin, prefab.StartRotationMax);
prevRotation = rotation;
@@ -172,12 +174,12 @@ namespace Barotrauma.Particles
if (!gap.isHorizontal)
{
if (gap.Rect.X > position.X || gap.Rect.Right < position.X) continue;
if (Math.Sign(velocity.Y) != Math.Sign(gap.Rect.Y - position.Y)) continue;
if (Math.Sign(velocity.Y) != Math.Sign(gap.Rect.Y - (currentHull.Rect.Y-currentHull.Rect.Height))) continue;
}
else
{
if (gap.Rect.Y < position.Y || gap.Rect.Y - gap.Rect.Height > position.Y) continue;
if (Math.Sign(velocity.X) != Math.Sign(gap.Rect.X - position.X)) continue;
if (Math.Sign(velocity.X) != Math.Sign(gap.Rect.Center.X - currentHull.Rect.Center.X)) continue;
}
//Rectangle enlargedRect = new Rectangle(gap.Rect.X - 10, gap.Rect.Y + 10, gap.Rect.Width + 20, gap.Rect.Height + 20);
@@ -221,9 +223,7 @@ namespace Barotrauma.Particles
}
private void OnWallCollision(Hull prevHull, Vector2 position)
{
float restitution = 0.5f;
{
if (position.Y < prevHull.Rect.Y - prevHull.Rect.Height)
{
position.Y = prevHull.Rect.Y - prevHull.Rect.Height + 1.0f;
@@ -247,7 +247,7 @@ namespace Barotrauma.Particles
velocity.X = -velocity.X;
}
velocity *= restitution;
velocity *= prefab.Restitution;
}
public void Draw(SpriteBatch spriteBatch)
@@ -49,13 +49,19 @@ namespace Barotrauma.Particles
public Particle CreateParticle(string prefabName, Vector2 position, float angle, float speed)
{
return CreateParticle(prefabName, position, new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * speed, angle);
return CreateParticle(prefabName, position, new Vector2((float)Math.Cos(angle), (float)-Math.Sin(angle)) * speed, angle);
}
public Particle CreateParticle(string prefabName, Vector2 position, Vector2 speed, float rotation=0.0f, Hull hullGuess = null)
{
ParticlePrefab prefab = FindPrefab(prefabName);
if (prefab == null)
{
DebugConsole.ThrowError("Particle prefab ''" + prefabName+"'' not found!");
return null;
}
return CreateParticle(prefab, position, speed, rotation, hullGuess);
}
@@ -33,6 +33,8 @@ namespace Barotrauma.Particles
public readonly bool DeleteOnCollision;
public readonly bool CollidesWithWalls;
public readonly float Restitution;
public readonly Vector2 VelocityChange;
public readonly DrawTargetType DrawTarget;
@@ -87,6 +89,8 @@ namespace Barotrauma.Particles
SizeChangeMax = SizeChangeMin;
}
Restitution = ToolBox.GetAttributeFloat(element, "restitution", 0.5f);
switch (ToolBox.GetAttributeString(element, "blendstate", "alphablend"))
{
case "alpha":