Skip to content

Commit

Permalink
port borg preferred name from goob
Browse files Browse the repository at this point in the history
  • Loading branch information
deltanedas committed Nov 5, 2024
1 parent ec0962a commit b0568fa
Show file tree
Hide file tree
Showing 11 changed files with 4,053 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@
<Control HorizontalExpand="True"/>
<LineEdit Name="AgeEdit" MinSize="40 0" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Goobstation - Preferred Borg Name Container-->
<!-- Borg Name -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-borgname-label'}" />
<Control HorizontalExpand="True"/>
<LineEdit Name="BorgNameEdit" MinSize="270 0" HorizontalAlignment="Right" />
<Button Name="BorgNameRandomize" Text="{Loc 'humanoid-profile-editor-name-random-button'}" />
</BoxContainer>
<!-- End of Goobstation-->
<!-- Sex -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-sex-label'}" />
Expand Down
39 changes: 39 additions & 0 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ public HumanoidProfileEditor(

#endregion Age

// # Goobstation - Preferred Cyborg Name Thing


#region BorgName

BorgNameRandomize.OnPressed += args => RandomizeBorgName();
BorgNameEdit.OnTextChanged += args =>
{
if (!string.IsNullOrEmpty(args.Text))
SetBorgName(args.Text);
};

# endregion BorgName

#region Gender

PronounsButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-male-text"), (int) Gender.Male);
Expand Down Expand Up @@ -1168,6 +1182,16 @@ private void SetAge(int newAge)
SetDirty();
}

// #Goobstation - Prefered Cyborg Name Stuff
private void SetBorgName(string newBName)
{
Profile = Profile?.WithBorgName(newBName);
SetDirty();

if (!IsDirty)
return;
}

private void SetSex(Sex newSex)
{
Profile = Profile?.WithSex(newSex);
Expand Down Expand Up @@ -1261,6 +1285,12 @@ private void UpdateAgeEdit()
AgeEdit.Text = Profile?.Age.ToString() ?? "";
}

// #Goobstation - More Borg Name Stuff
private void UpdateBorgNameEdit()
{
BorgNameEdit.Text = Profile?.BorgName.ToString() ?? "";
}

/// <summary>
/// Updates selected job priorities to the profile's.
/// </summary>
Expand Down Expand Up @@ -1553,6 +1583,15 @@ private void RandomizeName()
UpdateNameEdit();
}

// #Goobstation - Borg Preferred Name
private void RandomizeBorgName()
{
if (Profile == null) return;
var name = HumanoidCharacterProfile.GetBorgName();
SetBorgName(name);
UpdateBorgNameEdit();
}

private async void ExportImage()
{
if (_imaging)
Expand Down
Loading

0 comments on commit b0568fa

Please sign in to comment.