Faction Test 100.4.0.0

This commit is contained in:
Markus Isberg
2022-11-14 18:28:28 +02:00
parent 87426b68b2
commit c772b61fc1
412 changed files with 16984 additions and 5530 deletions
@@ -214,6 +214,7 @@ namespace Barotrauma
return splitValue;
}
public static Identifier[] GetAttributeIdentifierArray(this XElement element, string name, Identifier[] defaultValue, bool trim = true)
{
return element.GetAttributeStringArray(name, null, trim: trim, convertToLowerInvariant: false)
@@ -221,6 +222,12 @@ namespace Barotrauma
?? defaultValue;
}
public static ImmutableHashSet<Identifier> GetAttributeIdentifierImmutableHashSet(this XElement element, string key, ImmutableHashSet<Identifier> defaultValue, bool trim = true)
{
return element.GetAttributeIdentifierArray(key, null, trim)?.ToImmutableHashSet()
?? defaultValue;
}
public static float GetAttributeFloat(this XElement element, float defaultValue, params string[] matchingAttributeName)
{
if (element == null) { return defaultValue; }
@@ -769,7 +776,15 @@ namespace Barotrauma
#endif
return Color.White;
}
if (stringColor.StartsWith("faction.", StringComparison.OrdinalIgnoreCase))
{
Identifier factionId = stringColor.Substring(8).ToIdentifier();
if (FactionPrefab.Prefabs.TryGet(factionId, out var faction))
{
return faction.IconColor;
}
return Color.White;
}
string[] strComponents = stringColor.Split(',');