Unstable 1.2.4.0
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using Barotrauma.Extensions;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -32,7 +33,7 @@ namespace Barotrauma
|
||||
|
||||
(string value, bool loaded) tryLoad(LanguageIdentifier lang)
|
||||
{
|
||||
IReadOnlyList<string> candidates = Array.Empty<string>();
|
||||
IReadOnlyList<TextPack.Text> candidates = Array.Empty<TextPack.Text>();
|
||||
int tagIndex = 0;
|
||||
|
||||
if (TextManager.TextPacks.TryGetValue(lang, out var packs))
|
||||
@@ -50,8 +51,17 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
bool loaded = candidates.Count > 0;
|
||||
return (loaded ? candidates.GetRandomUnsynced() : "", loaded);
|
||||
if (candidates.Count == 0) { return (string.Empty, loaded: false); }
|
||||
var firstOverride = candidates.FirstOrDefault(c => c.IsOverride);
|
||||
if (firstOverride != default)
|
||||
{
|
||||
//if there's overrides defined, choose from the first pack that defines overrides
|
||||
return (candidates.Where(static c => c.IsOverride).Where(c => c.TextPack == firstOverride.TextPack).GetRandomUnsynced().String, loaded: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (candidates.GetRandomUnsynced().String, loaded: true);
|
||||
}
|
||||
}
|
||||
|
||||
var (value, loaded) = tryLoad(Language);
|
||||
|
||||
Reference in New Issue
Block a user