(457e4ebe5) Fixed: Submarine navigation labels being translated when loading a sub in editor

This commit is contained in:
Joonas Rikkonen
2019-05-16 06:13:49 +03:00
parent fc584c1bc4
commit 5f524ddd3f
42 changed files with 631 additions and 379 deletions
@@ -443,12 +443,22 @@ namespace Barotrauma
identifier = element.GetAttributeString("identifier", "");
name = TextManager.Get("EntityName." + identifier, true) ?? element.GetAttributeString("name", "");
if (name == "") DebugConsole.ThrowError("Unnamed item in " + filePath + "!");
//nameidentifier can be used to make multiple items use the same names and descriptions
string nameIdentifier = element.GetAttributeString("nameidentifier", "");
if (string.IsNullOrEmpty(nameIdentifier))
{
name = TextManager.Get("EntityName." + identifier, true) ?? element.GetAttributeString("name", "");
}
else
{
name = TextManager.Get("EntityName." + nameIdentifier, true) ?? element.GetAttributeString("name", "");
}
if (name == "") { DebugConsole.ThrowError("Unnamed item in " + filePath + "!"); }
DebugConsole.Log(" " + name);
Aliases = element.GetAttributeStringArray("aliases", new string[0], convertToLowerInvariant: true);
if (!Enum.TryParse(element.GetAttributeString("category", "Misc"), true, out MapEntityCategory category))
@@ -481,7 +491,15 @@ namespace Barotrauma
SerializableProperty.DeserializeProperties(this, element);
string translatedDescription = TextManager.Get("EntityDescription." + identifier, true);
string translatedDescription = "";
if (string.IsNullOrEmpty(nameIdentifier))
{
translatedDescription = TextManager.Get("EntityDescription." + identifier, true);
}
else
{
translatedDescription = TextManager.Get("EntityDescription." + nameIdentifier, true);
}
if (!string.IsNullOrEmpty(translatedDescription)) Description = translatedDescription;
foreach (XElement subElement in element.Elements())