Unstable 0.17.0.0

This commit is contained in:
Markus Isberg
2022-02-26 02:43:01 +09:00
parent a83f375681
commit 3974067915
913 changed files with 32472 additions and 32364 deletions
@@ -17,7 +17,7 @@ namespace Barotrauma.Particles
public float AngleMinRad { get; private set; }
public float AngleMaxRad { get; private set; }
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 360, MinValueFloat = -360f), Serialize(0f, true)]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 360, MinValueFloat = -360f), Serialize(0f, IsPropertySaveable.Yes)]
public float AngleMin
{
get => angleMin;
@@ -28,7 +28,7 @@ namespace Barotrauma.Particles
}
}
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 360, MinValueFloat = -360f), Serialize(0f, true)]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 360, MinValueFloat = -360f), Serialize(0f, IsPropertySaveable.Yes)]
public float AngleMax
{
get => angleMax;
@@ -39,77 +39,77 @@ namespace Barotrauma.Particles
}
}
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = MaxValue, MinValueFloat = MinValue), Serialize(0f, true)]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = MaxValue, MinValueFloat = MinValue), Serialize(0f, IsPropertySaveable.Yes)]
public float DistanceMin { get; set; }
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = MaxValue, MinValueFloat = MinValue), Serialize(0f, true)]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = MaxValue, MinValueFloat = MinValue), Serialize(0f, IsPropertySaveable.Yes)]
public float DistanceMax { get; set; }
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = MaxValue, MinValueFloat = MinValue), Serialize(0f, true)]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = MaxValue, MinValueFloat = MinValue), Serialize(0f, IsPropertySaveable.Yes)]
public float VelocityMin { get; set; }
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = MaxValue, MinValueFloat = MinValue), Serialize(0f, true)]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = MaxValue, MinValueFloat = MinValue), Serialize(0f, IsPropertySaveable.Yes)]
public float VelocityMax { get; set; }
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 100.0f, MinValueFloat = 0.0f), Serialize(1f, true)]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 100.0f, MinValueFloat = 0.0f), Serialize(1f, IsPropertySaveable.Yes)]
public float ScaleMin { get; set; }
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 100.0f, MinValueFloat = 0.0f), Serialize(1f, true)]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 100.0f, MinValueFloat = 0.0f), Serialize(1f, IsPropertySaveable.Yes)]
public float ScaleMax { get; set; }
[Editable(), Serialize("1,1", true)]
[Editable(), Serialize("1,1", IsPropertySaveable.Yes)]
public Vector2 ScaleMultiplier { get; set; }
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 100.0f, MinValueFloat = 0.0f), Serialize(0f, true)]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 100.0f, MinValueFloat = 0.0f), Serialize(0f, IsPropertySaveable.Yes)]
public float EmitInterval { get; set; }
[Editable(ValueStep = 1, MinValueInt = 0, MaxValueInt = 1000), Serialize(0, true, description: "The number of particles to spawn per frame, or every x seconds if EmitInterval is set.")]
[Editable(ValueStep = 1, MinValueInt = 0, MaxValueInt = 1000), Serialize(0, IsPropertySaveable.Yes, description: "The number of particles to spawn per frame, or every x seconds if EmitInterval is set.")]
public int ParticleAmount { get; set; }
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 1000.0f, MinValueFloat = 0.0f), Serialize(0f, true)]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 1000.0f, MinValueFloat = 0.0f), Serialize(0f, IsPropertySaveable.Yes)]
public float ParticlesPerSecond { get; set; }
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 10.0f, MinValueFloat = 0.0f), Serialize(0f, true, description: "If larger than 0, a particle is spawned every x pixels across the ray cast by a hitscan weapon.")]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 10.0f, MinValueFloat = 0.0f), Serialize(0f, IsPropertySaveable.Yes, description: "If larger than 0, a particle is spawned every x pixels across the ray cast by a hitscan weapon.")]
public float EmitAcrossRayInterval { get; set; }
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 100.0f, MinValueFloat = 0.0f), Serialize(0f, true, description: "Delay before the emitter becomes active after being created.")]
[Editable(ValueStep = 1, DecimalCount = 2, MaxValueFloat = 100.0f, MinValueFloat = 0.0f), Serialize(0f, IsPropertySaveable.Yes, description: "Delay before the emitter becomes active after being created.")]
public float InitialDelay { get; set; }
[Editable, Serialize(false, true)]
[Editable, Serialize(false, IsPropertySaveable.Yes)]
public bool HighQualityCollisionDetection { get; set; }
[Editable, Serialize(false, true)]
[Editable, Serialize(false, IsPropertySaveable.Yes)]
public bool CopyEntityAngle { get; set; }
[Editable, Serialize("1,1,1,1", true)]
[Editable, Serialize("1,1,1,1", IsPropertySaveable.Yes)]
public Color ColorMultiplier { get; set; }
[Editable, Serialize(false, true)]
[Editable, Serialize(false, IsPropertySaveable.Yes)]
public bool DrawOnTop { get; set; }
[Serialize(0f, true)]
[Serialize(0f, IsPropertySaveable.Yes)]
public float Angle
{
get => AngleMin;
set => AngleMin = AngleMax = value;
}
[Serialize(0f, true)]
[Serialize(0f, IsPropertySaveable.Yes)]
public float Distance
{
get => DistanceMin;
set => DistanceMin = DistanceMax = value;
}
[Serialize(0f, true)]
[Serialize(0f, IsPropertySaveable.Yes)]
public float Velocity
{
get => VelocityMin;
set => VelocityMin = VelocityMax = value;
}
public Dictionary<string, SerializableProperty> SerializableProperties { get; }
public Dictionary<Identifier, SerializableProperty> SerializableProperties { get; }
public ParticleEmitterProperties(XElement element)
{
@@ -125,7 +125,7 @@ namespace Barotrauma.Particles
public readonly ParticleEmitterPrefab Prefab;
public ParticleEmitter(XElement element)
public ParticleEmitter(ContentXElement element)
{
Prefab = new ParticleEmitterPrefab(element);
}
@@ -253,40 +253,24 @@ namespace Barotrauma.Particles
class ParticleEmitterPrefab
{
private string particlePrefabName;
private readonly Identifier particlePrefabName;
private ParticlePrefab particlePrefab;
public ParticlePrefab ParticlePrefab
{
get
{
if (particlePrefab == null && particlePrefabName != null)
{
particlePrefab = GameMain.ParticleManager?.FindPrefab(particlePrefabName);
if (particlePrefab == null)
{
DebugConsole.ThrowError($"Failed to find particle prefab \"{particlePrefabName}\".");
particlePrefabName = null;
}
}
return particlePrefab;
}
}
public ParticlePrefab ParticlePrefab => ParticlePrefab.Prefabs[particlePrefabName];
public readonly ParticleEmitterProperties Properties;
public bool DrawOnTop => Properties.DrawOnTop || ParticlePrefab.DrawOnTop;
public ParticleEmitterPrefab(XElement element)
public ParticleEmitterPrefab(ContentXElement element)
{
Properties = new ParticleEmitterProperties(element);
particlePrefabName = element.GetAttributeString("particle", "");
particlePrefabName = element.GetAttributeIdentifier("particle", "");
}
public ParticleEmitterPrefab(ParticlePrefab prefab, ParticleEmitterProperties properties)
{
Properties = properties;
particlePrefab = prefab;
particlePrefabName = prefab.Identifier;
}
}
}
@@ -44,8 +44,6 @@ namespace Barotrauma.Particles
}
private Particle[] particles;
public readonly PrefabCollection<ParticlePrefab> Prefabs = new PrefabCollection<ParticlePrefab>();
private Camera cam;
public Camera Camera
@@ -58,62 +56,9 @@ namespace Barotrauma.Particles
{
this.cam = cam;
MaxParticles = GameMain.Config.ParticleLimit;
MaxParticles = GameSettings.CurrentConfig.Graphics.ParticleLimit;
}
public void LoadPrefabs()
{
foreach (ContentFile configFile in GameMain.Instance.GetFilesOfType(ContentType.Particles))
{
LoadPrefabsFromFile(configFile);
}
}
public void LoadPrefabsFromFile(ContentFile configFile)
{
var particleElements = new Dictionary<string, XElement>();
XDocument doc = XMLExtensions.TryLoadXml(configFile.Path);
if (doc == null) { return; }
bool allowOverriding = false;
var mainElement = doc.Root;
if (doc.Root.IsOverride())
{
mainElement = doc.Root.FirstElement();
allowOverriding = true;
}
foreach (XElement sourceElement in mainElement.Elements())
{
var element = sourceElement.IsOverride() ? sourceElement.FirstElement() : sourceElement;
string name = element.Name.ToString().ToLowerInvariant();
if (Prefabs.ContainsKey(name) || particleElements.ContainsKey(name))
{
if (allowOverriding || sourceElement.IsOverride())
{
DebugConsole.NewMessage($"Overriding the existing particle prefab '{name}' using the file '{configFile.Path}'", Color.Yellow);
}
else
{
DebugConsole.ThrowError($"Error in '{configFile.Path}': Duplicate particle prefab '{name}' found in '{configFile.Path}'! Each particle prefab must have a unique name. " +
"Use <override></override> tags to override prefabs.");
continue;
}
}
particleElements.Add(name, element);
}
foreach (var kvp in particleElements)
{
Prefabs.Add(new ParticlePrefab(kvp.Value, configFile), allowOverriding);
}
}
public void RemovePrefabsByFile(string configFile)
{
Prefabs.RemoveByFile(configFile);
}
public Particle CreateParticle(string prefabName, Vector2 position, float angle, float speed, Hull hullGuess = null, float collisionIgnoreTimer = 0f, Tuple<Vector2, Vector2> tracerPoints = null)
{
return CreateParticle(prefabName, position, new Vector2((float)Math.Cos(angle), (float)-Math.Sin(angle)) * speed, angle, hullGuess, collisionIgnoreTimer, tracerPoints: tracerPoints);
@@ -179,12 +124,12 @@ namespace Barotrauma.Particles
public List<ParticlePrefab> GetPrefabList()
{
return Prefabs.ToList();
return ParticlePrefab.Prefabs.ToList();
}
public ParticlePrefab FindPrefab(string prefabName)
{
return Prefabs.Find(p => p.Identifier.Equals(prefabName, StringComparison.OrdinalIgnoreCase));
return ParticlePrefab.Prefabs.Find(p => p.Identifier == prefabName);
}
private void RemoveParticle(int index)
@@ -211,7 +156,7 @@ namespace Barotrauma.Particles
public void Update(float deltaTime)
{
MaxParticles = GameMain.Config.ParticleLimit;
MaxParticles = GameSettings.CurrentConfig.Graphics.ParticleLimit;
for (int i = 0; i < particleCount; i++)
{
@@ -6,13 +6,15 @@ using System.Xml.Linq;
namespace Barotrauma.Particles
{
class ParticlePrefab : IPrefab, IDisposable, ISerializableEntity
class ParticlePrefab : Prefab, ISerializableEntity
{
public static readonly PrefabCollection<ParticlePrefab> Prefabs = new PrefabCollection<ParticlePrefab>();
public enum DrawTargetType { Air = 1, Water = 2, Both = 3 }
public readonly List<Sprite> Sprites;
public void Dispose()
public override void Dispose()
{
GameMain.ParticleManager?.RemoveByPrefab(this);
foreach (Sprite spr in Sprites)
@@ -22,51 +24,25 @@ namespace Barotrauma.Particles
Sprites.Clear();
}
public string Name
{
get;
private set;
}
public string FilePath
{
get;
private set;
}
public string OriginalName { get { return Name; } }
public string Identifier { get { return Name; } }
public ContentPackage ContentPackage
{
get;
private set;
}
public string DisplayName
{
get;
private set;
}
[Editable(0.0f, float.MaxValue), Serialize(5.0f, false, description: "How many seconds the particle remains alive.")]
public string Name => Identifier.Value;
[Editable(0.0f, float.MaxValue), Serialize(5.0f, IsPropertySaveable.No, description: "How many seconds the particle remains alive.")]
public float LifeTime { get; private set; }
[Editable(0.0f, float.MaxValue), Serialize(0.0f, false, description: "Will randomize lifetime value between lifetime and lifetimeMin. If left to 0 will use only lifetime value.")]
[Editable(0.0f, float.MaxValue), Serialize(0.0f, IsPropertySaveable.No, description: "Will randomize lifetime value between lifetime and lifetimeMin. If left to 0 will use only lifetime value.")]
public float LifeTimeMin { get; private set; }
[Editable, Serialize(0.0f, false, description: "How long it takes for the particle to appear after spawning it.")]
[Editable, Serialize(0.0f, IsPropertySaveable.No, description: "How long it takes for the particle to appear after spawning it.")]
public float StartDelayMin { get; private set; }
[Editable, Serialize(0.0f, false, description: "How long it takes for the particle to appear after spawning it.")]
[Editable, Serialize(0.0f, IsPropertySaveable.No, description: "How long it takes for the particle to appear after spawning it.")]
public float StartDelayMax { get; private set; }
//movement -----------------------------------------
private float angularVelocityMin;
public float AngularVelocityMinRad { get; private set; }
[Editable, Serialize(0.0f, false)]
[Editable, Serialize(0.0f, IsPropertySaveable.No)]
public float AngularVelocityMin
{
get { return angularVelocityMin; }
@@ -80,7 +56,7 @@ namespace Barotrauma.Particles
private float angularVelocityMax;
public float AngularVelocityMaxRad { get; private set; }
[Editable, Serialize(0.0f, false)]
[Editable, Serialize(0.0f, IsPropertySaveable.No)]
public float AngularVelocityMax
{
get { return angularVelocityMax; }
@@ -94,7 +70,7 @@ namespace Barotrauma.Particles
private float startRotationMin;
public float StartRotationMinRad { get; private set; }
[Editable, Serialize(0.0f, false, description: "The minimum initial rotation of the particle (in degrees).")]
[Editable, Serialize(0.0f, IsPropertySaveable.No, description: "The minimum initial rotation of the particle (in degrees).")]
public float StartRotationMin
{
get { return startRotationMin; }
@@ -108,7 +84,7 @@ namespace Barotrauma.Particles
private float startRotationMax;
public float StartRotationMaxRad { get; private set; }
[Editable, Serialize(0.0f, false, description: "The maximum initial rotation of the particle (in degrees).")]
[Editable, Serialize(0.0f, IsPropertySaveable.No, description: "The maximum initial rotation of the particle (in degrees).")]
public float StartRotationMax
{
get { return startRotationMax; }
@@ -119,19 +95,19 @@ namespace Barotrauma.Particles
}
}
[Editable, Serialize(false, false, description: "Should the particle face the direction it's moving towards.")]
[Editable, Serialize(false, IsPropertySaveable.No, description: "Should the particle face the direction it's moving towards.")]
public bool RotateToDirection { get; private set; }
[Editable(0.0f, float.MaxValue, DecimalCount = 3), Serialize(0.0f, false, description: "Drag applied to the particle when it's moving through air.")]
[Editable(0.0f, float.MaxValue, DecimalCount = 3), Serialize(0.0f, IsPropertySaveable.No, description: "Drag applied to the particle when it's moving through air.")]
public float Drag { get; private set; }
[Editable(0.0f, float.MaxValue, DecimalCount = 3), Serialize(0.0f, false, description: "Drag applied to the particle when it's moving through water.")]
[Editable(0.0f, float.MaxValue, DecimalCount = 3), Serialize(0.0f, IsPropertySaveable.No, description: "Drag applied to the particle when it's moving through water.")]
public float WaterDrag { get; private set; }
private Vector2 velocityChange;
public Vector2 VelocityChangeDisplay { get; private set; }
[Editable, Serialize("0.0,0.0", false, description: "How much the velocity of the particle changes per second.")]
[Editable, Serialize("0.0,0.0", IsPropertySaveable.No, description: "How much the velocity of the particle changes per second.")]
public Vector2 VelocityChange
{
get { return velocityChange; }
@@ -145,7 +121,7 @@ namespace Barotrauma.Particles
private Vector2 velocityChangeWater;
public Vector2 VelocityChangeWaterDisplay { get; private set; }
[Editable, Serialize("0.0,0.0", false, description: "How much the velocity of the particle changes per second when in water.")]
[Editable, Serialize("0.0,0.0", IsPropertySaveable.No, description: "How much the velocity of the particle changes per second when in water.")]
public Vector2 VelocityChangeWater
{
get { return velocityChangeWater; }
@@ -156,78 +132,78 @@ namespace Barotrauma.Particles
}
}
[Editable(0.0f, 10000.0f), Serialize(0.0f, false, description: "Radius of the particle's collider. Only has an effect if UseCollision is set to true.")]
[Editable(0.0f, 10000.0f), Serialize(0.0f, IsPropertySaveable.No, description: "Radius of the particle's collider. Only has an effect if UseCollision is set to true.")]
public float CollisionRadius { get; private set; }
[Editable, Serialize(false, false, description: "Does the particle collide with the walls of the submarine and the level.")]
[Editable, Serialize(false, IsPropertySaveable.No, description: "Does the particle collide with the walls of the submarine and the level.")]
public bool UseCollision { get; private set; }
[Editable, Serialize(false, false, description: "Does the particle disappear when it collides with something.")]
[Editable, Serialize(false, IsPropertySaveable.No, description: "Does the particle disappear when it collides with something.")]
public bool DeleteOnCollision { get; private set; }
[Editable(0.0f, 1.0f), Serialize(0.5f, false, description: "The friction coefficient of the particle, i.e. how much it slows down when it's sliding against a surface.")]
[Editable(0.0f, 1.0f), Serialize(0.5f, IsPropertySaveable.No, description: "The friction coefficient of the particle, i.e. how much it slows down when it's sliding against a surface.")]
public float Friction { get; private set; }
[Editable(0.0f, 1.0f)]
[Serialize(0.5f, false, description: "How much of the particle's velocity is conserved when it collides with something, i.e. the \"bounciness\" of the particle. (1.0 = the particle stops completely).")]
[Serialize(0.5f, IsPropertySaveable.No, description: "How much of the particle's velocity is conserved when it collides with something, i.e. the \"bounciness\" of the particle. (1.0 = the particle stops completely).")]
public float Restitution { get; private set; }
//size -----------------------------------------
[Editable, Serialize("1.0,1.0", false, description: "The minimum initial size of the particle.")]
[Editable, Serialize("1.0,1.0", IsPropertySaveable.No, description: "The minimum initial size of the particle.")]
public Vector2 StartSizeMin { get; private set; }
[Editable, Serialize("1.0,1.0", false, description: "The maximum initial size of the particle.")]
[Editable, Serialize("1.0,1.0", IsPropertySaveable.No, description: "The maximum initial size of the particle.")]
public Vector2 StartSizeMax { get; private set; }
[Editable, Serialize("0.0,0.0", false, description: "How much the size of the particle changes per second. The rate of growth for each particle is randomize between SizeChangeMin and SizeChangeMax.")]
[Editable, Serialize("0.0,0.0", IsPropertySaveable.No, description: "How much the size of the particle changes per second. The rate of growth for each particle is randomize between SizeChangeMin and SizeChangeMax.")]
public Vector2 SizeChangeMin { get; private set; }
[Editable, Serialize("0.0,0.0", false, description: "How much the size of the particle changes per second. The rate of growth for each particle is randomize between SizeChangeMin and SizeChangeMax.")]
[Editable, Serialize("0.0,0.0", IsPropertySaveable.No, description: "How much the size of the particle changes per second. The rate of growth for each particle is randomize between SizeChangeMin and SizeChangeMax.")]
public Vector2 SizeChangeMax { get; private set; }
[Editable, Serialize(0.0f, false, description: "How many seconds it takes for the particle to grow to it's initial size.")]
[Editable, Serialize(0.0f, IsPropertySaveable.No, description: "How many seconds it takes for the particle to grow to it's initial size.")]
public float GrowTime { get; private set; }
//rendering -----------------------------------------
[Editable, Serialize("1.0,1.0,1.0,1.0", false, description: "The initial color of the particle.")]
[Editable, Serialize("1.0,1.0,1.0,1.0", IsPropertySaveable.No, description: "The initial color of the particle.")]
public Color StartColor { get; private set; }
[Editable, Serialize("1.0,1.0,1.0,1.0", false, description: "The initial color of the particle.")]
[Editable, Serialize("1.0,1.0,1.0,1.0", IsPropertySaveable.No, description: "The initial color of the particle.")]
public Color MiddleColor { get; private set; }
[Editable, Serialize("1.0,1.0,1.0,1.0", false, description: "The color of the particle at the end of its lifetime.")]
[Editable, Serialize("1.0,1.0,1.0,1.0", IsPropertySaveable.No, description: "The color of the particle at the end of its lifetime.")]
public Color EndColor { get; private set; }
[Editable, Serialize(false, false, description: "If true the color will go from StartColor to EndcColor and back to StartColor.")]
[Editable, Serialize(false, IsPropertySaveable.No, description: "If true the color will go from StartColor to EndcColor and back to StartColor.")]
public bool UseMiddleColor { get; private set; }
[Editable, Serialize(DrawTargetType.Air, false, description: "Should the particle be rendered in air, water or both.")]
[Editable, Serialize(DrawTargetType.Air, IsPropertySaveable.No, 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?")]
[Editable, Serialize(false, IsPropertySaveable.No, 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.")]
[Editable, Serialize(ParticleBlendState.AlphaBlend, IsPropertySaveable.No, description: "The type of blending to use when rendering the particle.")]
public ParticleBlendState BlendState { get; private set; }
[Editable, Serialize(0, false, description: "Particles with a higher priority can replace lower-priority ones if the maximum number of active particles has been reached.")]
[Editable, Serialize(0, IsPropertySaveable.No, description: "Particles with a higher priority can replace lower-priority ones if the maximum number of active particles has been reached.")]
public int Priority { get; private set; }
//animation -----------------------------------------
[Editable(0.0f, float.MaxValue), Serialize(1.0f, false, description: "The duration of the particle's animation cycle (if it's animated).")]
[Editable(0.0f, float.MaxValue), Serialize(1.0f, IsPropertySaveable.No, description: "The duration of the particle's animation cycle (if it's animated).")]
public float AnimDuration { get; private set; }
[Editable, Serialize(true, false, description: "Should the sprite animation be looped, or stay at the last frame when the animation finishes.")]
[Editable, Serialize(true, IsPropertySaveable.No, description: "Should the sprite animation be looped, or stay at the last frame when the animation finishes.")]
public bool LoopAnim { get; private set; }
//----------------------------------------------------
public readonly List<ParticleEmitterPrefab> SubEmitters = new List<ParticleEmitterPrefab>();
public Dictionary<string, SerializableProperty> SerializableProperties
public Dictionary<Identifier, SerializableProperty> SerializableProperties
{
get;
private set;
@@ -235,18 +211,13 @@ namespace Barotrauma.Particles
//----------------------------------------------------
public ParticlePrefab(XElement element, ContentFile file)
public ParticlePrefab(ContentXElement element, ContentFile file) : base(file, element.NameAsIdentifier())
{
Name = element.Name.ToString();
FilePath = file.Path;
ContentPackage = file.ContentPackage;
DisplayName = TextManager.Get("particle." + Name, true) ?? Name;
Sprites = new List<Sprite>();
SerializableProperties = SerializableProperty.DeserializeProperties(this, element);
foreach (XElement subElement in element.Elements())
foreach (var subElement in element.Elements())
{
switch (subElement.Name.ToString().ToLowerInvariant())
{