v1.2.6.0 (Winter Update)

This commit is contained in:
Regalis11
2023-12-14 16:11:27 +02:00
parent af8cc89fce
commit b91e85559d
375 changed files with 7771 additions and 2874 deletions
@@ -50,7 +50,8 @@ namespace Barotrauma
if (identifier.IsEmpty)
{
DebugConsole.ThrowError(
$"No identifier defined for the affliction '{elementName}' in file '{Path}'");
$"No identifier defined for the affliction '{elementName}' in file '{Path}'",
contentPackage: element?.ContentPackage);
return;
}
@@ -60,12 +61,13 @@ namespace Barotrauma
{
DebugConsole.NewMessage(
$"Overriding an affliction or a buff with the identifier '{identifier}' using the file '{Path}'",
Color.Yellow);
Color.MediumPurple);
}
else
{
DebugConsole.ThrowError(
$"Duplicate affliction: '{identifier}' defined in {elementName} of '{Path}'");
$"Duplicate affliction: '{identifier}' defined in {elementName} of '{Path}'",
contentPackage: element?.ContentPackage);
return;
}
}
@@ -17,12 +17,12 @@ namespace Barotrauma
XDocument doc = XMLExtensions.TryLoadXml(Path);
if (doc == null)
{
DebugConsole.ThrowError($"Loading character file failed: {Path}");
DebugConsole.ThrowError($"Loading character file failed: {Path}", contentPackage: ContentPackage);
return;
}
if (CharacterPrefab.Prefabs.AllPrefabs.Any(kvp => kvp.Value.Any(cf => cf?.ContentFile == this)))
{
DebugConsole.ThrowError($"Duplicate path: {Path}");
DebugConsole.ThrowError($"Duplicate path: {Path}", contentPackage: ContentPackage);
return;
}
var mainElement = doc.Root.FromPackage(ContentPackage);
@@ -69,7 +69,8 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError($"Failed to preload a ragdoll file for the character \"{characterPrefab.Name}\"", e);
DebugConsole.ThrowError($"Failed to preload a ragdoll file for the character \"{characterPrefab.Name}\"", e,
contentPackage: characterPrefab.ContentPackage);
return;
}
@@ -76,7 +76,8 @@ namespace Barotrauma
{
DebugConsole.AddWarning(
$"The content type \"TraitorMission\" in content package \"{package.Name}\" is no longer supported." +
$" Traitor missions should be implemented using the scripted event system and the content type TraitorEvents.");
$" Traitor missions should be implemented using the scripted event system and the content type TraitorEvents.",
package);
}
return true;
}
@@ -55,7 +55,7 @@ namespace Barotrauma
}
else
{
DebugConsole.ThrowError($"GenericPrefabFile: Invalid {GetType().Name} element: {parentElement.Name} in {Path}");
DebugConsole.ThrowError($"GenericPrefabFile: Invalid {GetType().Name} element: {parentElement.Name} in {Path}", contentPackage: ContentPackage);
}
}
@@ -2,6 +2,7 @@ using System.Xml.Linq;
namespace Barotrauma
{
[NotSyncedInMultiplayer]
sealed class NPCConversationsFile : ContentFile
{
public NPCConversationsFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
@@ -42,7 +42,8 @@ namespace Barotrauma
}
else
{
DebugConsole.ThrowError($"OrdersFile: Invalid {GetType().Name} element: {parentElement.Name} in {Path}");
DebugConsole.ThrowError($"OrdersFile: Invalid {GetType().Name} element: {parentElement.Name} in {Path}",
contentPackage: parentElement?.ContentPackage);
}
}
@@ -65,7 +65,8 @@ namespace Barotrauma
}
else
{
DebugConsole.ThrowError($"RandomEventsFile: Invalid {GetType().Name} element: {parentElement.Name} in {Path}");
DebugConsole.ThrowError($"RandomEventsFile: Invalid {GetType().Name} element: {parentElement.Name} in {Path}",
contentPackage: parentElement.ContentPackage);
}
}
@@ -4,6 +4,7 @@ using System.Xml.Linq;
namespace Barotrauma
{
[NotSyncedInMultiplayer]
public sealed class TextFile : ContentFile
{
public TextFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
@@ -18,13 +19,12 @@ namespace Barotrauma
LanguageIdentifier language = languageName.ToLanguageIdentifier();
if (!TextManager.TextPacks.ContainsKey(language))
{
TextManager.TextPacks.TryAdd(language, ImmutableHashSet<TextPack>.Empty);
TextManager.TextPacks.TryAdd(language, ImmutableList<TextPack>.Empty);
}
var newPack = new TextPack(this, mainElement, language);
var newHashSet = TextManager.TextPacks[language].Add(newPack);
var newList = TextManager.TextPacks[language].Add(newPack);
TextManager.TextPacks.TryRemove(language, out _);
TextManager.TextPacks.TryAdd(language, newHashSet);
TextManager.TextPacks.TryAdd(language, newList);
TextManager.IncrementLanguageVersion();
}
@@ -32,16 +32,27 @@ namespace Barotrauma
{
foreach (var kvp in TextManager.TextPacks.ToArray())
{
var newHashSet = kvp.Value.Where(p => p.ContentFile != this).ToImmutableHashSet();
var newList = kvp.Value.Where(p => p.ContentFile != this).ToImmutableList();
TextManager.TextPacks.TryRemove(kvp.Key, out _);
if (newHashSet.Count != 0) { TextManager.TextPacks.TryAdd(kvp.Key, newHashSet); }
if (newList.Count != 0) { TextManager.TextPacks.TryAdd(kvp.Key, newList); }
}
TextManager.IncrementLanguageVersion();
if (!TextManager.TextPacks.ContainsKey(GameSettings.CurrentConfig.Language))
{
DebugConsole.AddWarning($"The language {GameSettings.CurrentConfig.Language} is no longer available. Switching to {TextManager.DefaultLanguage}...");
var config = GameSettings.CurrentConfig;
config.Language = TextManager.DefaultLanguage;
GameSettings.SetCurrentConfig(config);
}
}
public override void Sort()
{
//Overrides for text packs don't exist! Should we change this?
foreach (var language in TextManager.TextPacks.Keys.ToList())
{
TextManager.TextPacks[language] =
TextManager.TextPacks[language].Sort((t1, t2) => (t1.ContentFile.ContentPackage?.Index ?? int.MaxValue) - (t2.ContentFile.ContentPackage?.Index ?? int.MaxValue));
}
}
}
}