Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port borg preferred name from goob #2123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading