(0976ef4d1) Fix repair hint text being displayed even when the item condition is not below the threshold. Move the GetHUDText method from shared to client project.

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:29:50 +03:00
parent 32fe6e24de
commit ca3b5ae04b
9 changed files with 372 additions and 105 deletions
@@ -777,6 +777,38 @@ namespace Barotrauma
}
}
List<ColoredText> texts = new List<ColoredText>();
public List<ColoredText> GetHUDTexts(Character character)
{
texts.Clear();
foreach (ItemComponent ic in components)
{
if (string.IsNullOrEmpty(ic.DisplayMsg)) continue;
if (!ic.CanBePicked && !ic.CanBeSelected) continue;
if (ic is Holdable holdable && !holdable.CanBeDeattached()) continue;
Color color = Color.Gray;
bool hasRequiredSkillsAndItems = ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false);
if (hasRequiredSkillsAndItems)
{
if (ic is Repairable repairable)
{
if (Condition < repairable.ShowRepairUIThreshold)
{
color = Color.Cyan;
}
}
else
{
color = Color.Cyan;
}
}
texts.Add(new ColoredText(ic.DisplayMsg, color, false));
}
return texts;
}
public override void AddToGUIUpdateList()
{
AddToGUIUpdateList(addLinkedHUDs: true);