Skip to content

Commit

Permalink
Add pronouns to crew manifest (#2647)
Browse files Browse the repository at this point in the history
* Refactored crew manifest

* Add Delta-V Comments, Move locale file to _DV scope.

* Missed adding comments to a file.

* Made the comments slightly more verbose to make it clear why the changes were made.

* Comments are love, comments are life.

---------

Co-authored-by: TGRCDev <[email protected]>
  • Loading branch information
FaintSpeaker and TGRCdev authored Jan 8, 2025
1 parent 1206ef6 commit 29879a1
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 8 deletions.
50 changes: 44 additions & 6 deletions Content.Client/CrewManifest/UI/CrewManifestSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,62 @@ public CrewManifestSection(
Text = Loc.GetString($"department-{section.ID}")
});

var gridContainer = new GridContainer()
// Delta-V - changed type from GridContainer to BoxContainer to better handle long names and titles.
var gridContainer = new BoxContainer()
{
Orientation = LayoutOrientation.Horizontal,
HorizontalExpand = true,
Columns = 2
};

// Delta-V - Start of column BoxContainers.
var namesContainer = new BoxContainer()
{
Orientation = LayoutOrientation.Vertical,
HorizontalExpand = true,
SizeFlagsStretchRatio = 3,
};

var titlesContainer = new BoxContainer()
{
Orientation = LayoutOrientation.Vertical,
HorizontalExpand = true,
SizeFlagsStretchRatio = 2,
};

gridContainer.AddChild(namesContainer);
gridContainer.AddChild(titlesContainer);
// Delta-V - end of column BoxContainers.

AddChild(gridContainer);

foreach (var entry in entries)
{
var name = new RichTextLabel()
// Delta-V - start of name and pronoun container
var nameContainer = new BoxContainer()
{
Orientation = LayoutOrientation.Horizontal,
HorizontalExpand = true,
};

var name = new RichTextLabel();
name.SetMessage(entry.Name);

var gender = new RichTextLabel()
{
Margin = new Thickness(6, 0, 0, 0),
StyleClasses = { "CrewManifestGender" }
};
gender.SetMessage(Loc.GetString("gender-display", ("gender", entry.Gender)));

nameContainer.AddChild(name);
nameContainer.AddChild(gender);
// Delta-V - end of name and pronoun container

var titleContainer = new BoxContainer()
{
Orientation = LayoutOrientation.Horizontal,
HorizontalExpand = true
HorizontalExpand = true,
SizeFlagsStretchRatio = 1, // Delta-V
};

var title = new RichTextLabel();
Expand All @@ -69,8 +105,10 @@ public CrewManifestSection(
titleContainer.AddChild(title);
}

gridContainer.AddChild(name);
gridContainer.AddChild(titleContainer);
// Delta-V - grid was replaced with two BoxContainer columns
namesContainer.AddChild(nameContainer);
titlesContainer.AddChild(titleContainer);
// Delta-V - end of grid container change
}
}
}
9 changes: 9 additions & 0 deletions Content.Client/Stylesheets/StyleNano.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ public sealed class StyleNano : StyleBase
public const string StyleClassPinButtonPinned = "pinButtonPinned";
public const string StyleClassPinButtonUnpinned = "pinButtonUnpinned";

//Delta-V - Manifest pronouns
public const string StyleClassCrewManifestGender = "CrewManifestGender";


public override Stylesheet Stylesheet { get; }

Expand Down Expand Up @@ -1291,6 +1294,12 @@ public StyleNano(IResourceCache resCache) : base(resCache)
.Prop("font", notoSansItalic10)
.Prop("font-color", ItemStatusNotHeldColor),

// Delta-V add style for pronouns on the crew manifest
Element<RichTextLabel>()
.Class(StyleClassCrewManifestGender)
.Prop("font", notoSansItalic10)
.Prop("font-style", "italic"),

Element<RichTextLabel>()
.Class(StyleClassItemStatus)
.Prop(nameof(RichTextLabel.LineHeightScale), 0.7f)
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/CrewManifest/CrewManifestSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ private void BuildCrewManifest(EntityUid station)
foreach (var recordObject in iter)
{
var record = recordObject.Item2;
var entry = new CrewManifestEntry(record.Name, record.JobTitle, record.JobIcon, record.JobPrototype);
// Delta-V: Added gender to crew manifest
var entry = new CrewManifestEntry(record.Name, record.Gender.ToString().ToLowerInvariant(), record.JobTitle, record.JobIcon, record.JobPrototype);

_prototypeManager.TryIndex(record.JobPrototype, out JobPrototype? job);
entriesSort.Add((job, entry));
Expand Down
5 changes: 4 additions & 1 deletion Content.Shared/CrewManifest/SharedCrewManifestSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@ public sealed class CrewManifestEntry
{
public string Name { get; }

public string Gender { get; } // Delta-V: Added gender to crew manifest

public string JobTitle { get; }

public string JobIcon { get; }

public string JobPrototype { get; }

public CrewManifestEntry(string name, string jobTitle, string jobIcon, string jobPrototype)
public CrewManifestEntry(string name, string gender, string jobTitle, string jobIcon, string jobPrototype)
{
Name = name;
Gender = gender; // Delta-V: Added gender to crew manifest
JobTitle = jobTitle;
JobIcon = jobIcon;
JobPrototype = jobPrototype;
Expand Down
6 changes: 6 additions & 0 deletions Resources/Locale/en-US/_DV/gender.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gender-display = ({$gender ->
[male] He / Him
[female] She / Her
[neuter] It / It
*[other] They / Them
})

0 comments on commit 29879a1

Please sign in to comment.