- Fixed creature disable list only taking config files in the Content/Characters folder into account (making it impossible to disable spawning of custom monsters outside the folder)

- Removed hard-coded ruin structure, particle & decal config paths and moved them to content package (custom ones can be added now without modifying the original files).
This commit is contained in:
Joonas Rikkonen
2018-02-25 15:03:29 +02:00
parent e02a1dc6ae
commit 9e2966e9cb
8 changed files with 68 additions and 57 deletions
@@ -162,29 +162,31 @@ namespace Barotrauma
private void SerializeAll()
{
XDocument doc = XMLExtensions.TryLoadXml(GameMain.ParticleManager.ConfigFile);
if (doc == null || doc.Root == null) return;
var prefabList = GameMain.ParticleManager.GetPrefabList();
foreach (ParticlePrefab prefab in prefabList)
foreach (string configFile in GameMain.Config.SelectedContentPackage.GetFilesOfType(ContentType.Particles))
{
foreach (XElement element in doc.Root.Elements())
XDocument doc = XMLExtensions.TryLoadXml(configFile);
if (doc == null || doc.Root == null) continue;
var prefabList = GameMain.ParticleManager.GetPrefabList();
foreach (ParticlePrefab prefab in prefabList)
{
if (element.Name.ToString().ToLowerInvariant() != prefab.Name.ToLowerInvariant()) continue;
SerializableProperty.SerializeProperties(prefab, element, true);
foreach (XElement element in doc.Root.Elements())
{
if (element.Name.ToString().ToLowerInvariant() != prefab.Name.ToLowerInvariant()) continue;
SerializableProperty.SerializeProperties(prefab, element, true);
}
}
}
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.OmitXmlDeclaration = true;
settings.NewLineOnAttributes = true;
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.OmitXmlDeclaration = true;
settings.NewLineOnAttributes = true;
using (var writer = XmlWriter.Create(GameMain.ParticleManager.ConfigFile, settings))
{
doc.WriteTo(writer);
writer.Flush();
using (var writer = XmlWriter.Create(configFile, settings))
{
doc.WriteTo(writer);
writer.Flush();
}
}
}