(f0d812055) v0.9.9.0

This commit is contained in:
Joonas Rikkonen
2020-04-23 19:19:37 +03:00
parent b647059b93
commit ac37a3b0e4
391 changed files with 15054 additions and 5420 deletions
@@ -11,7 +11,18 @@ namespace Barotrauma.Particles
public string OriginalName { get { return Name; } }
public string Identifier { get { return Name.ToLowerInvariant(); } }
private string _identifier;
public string Identifier
{
get
{
if (_identifier == null)
{
_identifier = Name.ToLowerInvariant();
}
return _identifier;
}
}
public string FilePath { get; private set; }
@@ -46,7 +57,7 @@ namespace Barotrauma.Particles
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().ToLowerInvariant() == "sprite")
if (subElement.Name.ToString().Equals("sprite", StringComparison.OrdinalIgnoreCase))
{
Sprites.Add(new Sprite(subElement));
}
@@ -108,7 +108,8 @@ namespace Barotrauma.Particles
public readonly bool CopyEntityAngle;
public readonly bool DrawOnTop;
public bool DrawOnTop => forceDrawOnTop || ParticlePrefab.DrawOnTop;
private readonly bool forceDrawOnTop;
public ParticleEmitterPrefab(XElement element)
{
@@ -150,6 +151,12 @@ namespace Barotrauma.Particles
{
DistanceMin = DistanceMax = element.GetAttributeFloat("distance", 0.0f);
}
if (DistanceMax < DistanceMin)
{
var temp = DistanceMin;
DistanceMin = DistanceMax;
DistanceMax = temp;
}
if (element.Attribute("velocity") == null)
{
@@ -160,13 +167,19 @@ namespace Barotrauma.Particles
{
VelocityMin = VelocityMax = element.GetAttributeFloat("velocity", 0.0f);
}
if (VelocityMax < VelocityMin)
{
var temp = VelocityMin;
VelocityMin = VelocityMax;
VelocityMax = temp;
}
EmitInterval = element.GetAttributeFloat("emitinterval", 0.0f);
ParticlesPerSecond = element.GetAttributeInt("particlespersecond", 0);
ParticleAmount = element.GetAttributeInt("particleamount", 0);
HighQualityCollisionDetection = element.GetAttributeBool("highqualitycollisiondetection", false);
CopyEntityAngle = element.GetAttributeBool("copyentityangle", false);
DrawOnTop = element.GetAttributeBool("drawontop", false);
forceDrawOnTop = element.GetAttributeBool("drawontop", false);
}
}
}
@@ -228,14 +228,7 @@ namespace Barotrauma.Particles
if (inSub.HasValue)
{
bool isOutside = particle.CurrentHull == null;
if (particle.DrawOnTop)
{
if (isOutside != inSub.Value)
{
continue;
}
}
else if (isOutside == inSub.Value)
if (!particle.DrawOnTop && isOutside == inSub.Value)
{
continue;
}
@@ -199,6 +199,9 @@ namespace Barotrauma.Particles
[Editable, Serialize(DrawTargetType.Air, false, description: "Should the particle be rendered in air, water or both.")]
public DrawTargetType DrawTarget { get; private set; }
[Editable, Serialize(false, false, description: "Should the particle be always rendered on top of entities?")]
public bool DrawOnTop { get; private set; }
[Editable, Serialize(ParticleBlendState.AlphaBlend, false, description: "The type of blending to use when rendering the particle.")]
public ParticleBlendState BlendState { get; private set; }