Role subtypes (#35359)

This commit is contained in:
Errant
2025-04-16 19:04:48 +02:00
committed by GitHub
parent 7aa0c7562e
commit fb388d2265
20 changed files with 414 additions and 121 deletions

View File

@@ -221,18 +221,11 @@ public sealed class CharacterUIController : UIController, IOnStateEntered<Gamepl
if (!_ent.TryGetComponent<MindComponent>(container.Mind.Value, out var mind))
return;
var roleText = Loc.GetString("role-type-crew-aligned-name");
var color = Color.White;
if (_prototypeManager.TryIndex(mind.RoleType, out var proto))
{
roleText = Loc.GetString(proto.Name);
color = proto.Color;
}
else
_sawmill.Error($"{_player.LocalEntity} has invalid Role Type '{mind.RoleType}'. Displaying '{roleText}' instead");
if (!_prototypeManager.TryIndex(mind.RoleType, out var proto))
_sawmill.Error($"Player '{_player.LocalSession}' has invalid Role Type '{mind.RoleType}'. Displaying default instead");
_window.RoleType.Text = roleText;
_window.RoleType.FontColorOverride = color;
_window.RoleType.Text = Loc.GetString(proto?.Name ?? "role-type-crew-aligned-name");
_window.RoleType.FontColorOverride = proto?.Color ?? Color.White;
}
private void CharacterDetached(EntityUid uid)